[perl] Portably linking to libstdc++

Sisyphus sisyphus1@optusnet.com.au
Mon Oct 20 09:06:00 GMT 2008


----- Original Message ----- 
From: "Reini Urban" <rurban@x-ray.at>
.
.
>
> Current cygwin perl already has g++ as LD for some releases.

Good - I think that's a step in the right direction. (I wonder how we can
get linux builds to start doing the same.)
On my 5.8.8, LD is set to ld2 which, I think, is an alias for 'gcc:

----------------------------
Rob@desktop2 ~
$ perl -V:ld
ld='ld2';

Rob@desktop2 ~
$ ld2 -v
gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
............
----------------------------

>> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab):
>> undefined reference to `_WinMain@16'
>> collect2: ld returned 1 exit status
>>
>> Why does that happen ?
>
> Maybe because the linker believes you have a -mwindows GUI app?

There is some Microsoft-specific stuff in the XS file ... so such a 
confusion is not out of the question.
Is it strange that it believes that only when LD is set to g++ ?
If I leave LD set to gcc and explicitly link to libstdc++.a, then there's no 
problem.

> Which distro are you talking about?
> InlineX::CPP2XS I assume.

No problems with InlineX::CPP2XS.

I was doing some testing of someone else's upcoming release of Devel::Size 
(0.72), which
has been significantly rewritten and is quite different to the current CPAN
version (0.71).

It's only small, so I'll attach it and you can take a look if you like.
Sounds like it should build ok for you, without the need to make any
amendment.

In the Makefile.PL you'll see that I've commented out the line:

  LIBS => '-lstdc++',

If I'm to successfully build that module on my cygwin perl, I need to
include that line. And even then, that works only because I've added the 
location of
libstdc++.a to my $Config{libpth}.

If it does build for more recent cygwin perls, then I guess the matter has 
already been dealt with - and one can't ask for more than that :-)

Cheers,
Rob 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Devel-Size-test.tar.gz
Type: application/x-gzip
Size: 18161 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20081020/5a1bdeb2/attachment.bin>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list