mifflin has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl xs module that, up until recently, has been built on linking to a vendor's static libraries (.a) using gcc. The machine that I build it on is a Sun box.

However, they have recently started shipping only the dynamic libraries (.so). I've fixed my Makefile.PL to use these new libraries and built it all again.

The LIBS entry changed from
'LIBS' => ["-L$DIR/acelib -lace -lz4t -lffstub -L$DIR/comlib -ldi +racc -lmas -lliud -llgen -loptec -lm -lpsthr"],
to...
'LIBS' => ["-L$DIR -lace"], # libace.so

All seems to work great. However, the vendor documentation comes with a statement saying that they built their software using the "Sun One version 8" compiler and that I should be using it too. (It says they used gcc for Linux builds) It also says...

"Before using ACE 7.50c, you must ensure that your C++ Standard Library (runtime version) is compatible with the new compilers." (for me this would be the Sun One v8)

and...

"Verify that your system administrator has obtained an appropriate C++ runtime version of the appropriate compiler from your operating system vendor..."

Why would it matter what compiler I use?

Replies are listed 'Best First'.
Re: C compiler for xs
by Fletch (Bishop) on Oct 07, 2004 at 17:37 UTC

    For C compilers it's not as much of an issue, but the C++ standard (intentionally) leaves some important implementation details unspecified which can really bite you in the tuckus when you try and link different compilers' code. Two things specifically are name mangling (int Class::someMethod( char * ) might be converted into a symbol like Class__someMethod_i4_cp by one compiler and __Class_someMethod_cp__I by another) and static constructors (I can't recall exactly what the issue is but I think it's either order they're called in, or what they're called (related to name mangling)).

Re: C compiler for xs
by welchavw (Pilgrim) on Oct 07, 2004 at 19:02 UTC
    You may like a read of "info gcc Compatibility" if you have gcc installed. C++ link compatibility has bitten more folks than you. I often have to install C++ compatibility libraries when the vendor of a 3rd party library linked against a different version of gcc than that provided by default by my platform vendor, just as an example. In other words, this variation varies also by compiler version, not just by compiler vendor. You may want to determine if a compatibility library package is available for your platform.