Linux x86_64: libm format not recognized
I just installed the Studio 12 compilers on Scientific Linux (Red Hat Enterprise 5 clone, 64-bit version) on a machine with two dual-core Opterons. I wrote a Hello World program, and the C compiler handles it OK. The C++ compiler has trouble linking the 64-bit version.
$ /opt/sun/sunstudio12/bin/CC -m32 hello.c
$ ./a.out
Hello, world!
$ /opt/sun/sunstudio12/bin/CC -m64 hello.c
/usr/lib64/libm.so: file not recognized: File format not recognized
I checked that when I use the cc compiler with -m64 -lm, it uses the same library file with no complaints. Without the -lm option, it doesn't use libm at all. That makes sense.
I havent used Sun compilers for 10 years at least, and never on Linux. Have I missed something basic?
[776 byte] By [
bluethumba] at [2007-11-27 6:53:49]

# 1
> Have I missed something basic?
Not basic, really, but a known problem.
C++ had a problem with default linker on RH4 not being able to grok our object files due to its own bugs.
Thats why we bring updated linker with us (prod/lib/amd64/ld or something like this) and use it in 64bit compilation.
C does not have this problem and thus does not use this linker.
Some linuxes (like RH5 or SuSE10) have recently changed its object files format which causes our "older" linker to emit this "file not recognized" message.
regards,
__Fedor.
SFVa at 2007-7-12 18:28:38 >

# 2
Thanks.Is there a workaround? It sounds as if neither linker will work in this situation.
# 3
We don't currently support RH 5 or SuSE 10, primarily due to incompatible differences. We are looking into what we can do to support them.
# 4
The following fixes this:
rm /opt/sun/sunstudio12/prod/lib/amd64/ld
ln -s /usr/bin/ld /opt/sun/sunstudio12/prod/lib/amd64/ld
I can't say whether this might introduce other problems since I didn't find the sources for the modified GNU ld in the SunStudio distribution and thus can't say what sun has changed compared to the official GNU version.
Can anyone tell me where to find these sources?
# 5
> Can anyone tell me where to find these sources?
AFAIK, we did not actually change anything there, just rebuilt newer version on our build system.
Pointer to the exact version of gnu ld used to be there in README for express releases.
And you can imagine it is somewere at http://ftp.gnu.org/gnu/binutils/
> I can't say whether this might introduce other problems
As we did not test with those other linkers - neither can I. However if you take binutils newer than one we use (2.16+) you are likely to encounter problems different to ones we had with 2.15.90 ;)
Please, let us know if you have any abnormal linking issues when using newer linkers to compile with Sun C++.
regards,
__Fedor.
SFVa at 2007-7-12 18:28:38 >

# 6
> The following fixes this:
>
> rm /opt/sun/sunstudio12/prod/lib/amd64/ld
> ln -s /usr/bin/ld
> /opt/sun/sunstudio12/prod/lib/amd64/ld
>
> I can't say whether this might introduce other
> problems ...
C++ programs that throw exceptions will not work if linked with the system linker. That is why we provide our own linker. You can use compiler options to pick up the system linker if it turns out to solve a problem without breaking something else.
We contributed the linker fixes to the linux source base, but it might be a while before the fixed linker shows up in major distros like RH and SuSE.
# 7
Well, if you submitted your changes for inclusion into upstream binutils why not just pointing to some mail archive showing the patch or putting the patch somewhere on the net? If you did so (apart from honoring the GPL) you would allow us to check whether these problems are fixed in our version of the linker and if not, we could fix it and thus actually use the compiler. The only post I could find from a sun.com mail address on the binutils list in recent time is a post from Rod Evans but that seems to be unrelated to what you are describing here.
If you don't tell us details about the problem but just say that there might be some problems with the system linker it is really not quite interesting to use your product for anything because it is likely that it generates broken code although the cause of the issue was well known but just not communicated.
I mean after doing some benchmarks on C code that would provide many opportunities for optimization that were just not used by your compiler, the fact that it turns out to be extremely difficult to get even simple information about known problems makes me wonder why we should be interested in choosing this compiler at all.
# 8
You can download the source code that corresponds to the modifiedversion of GNU ld provided with SUn Studio 12 from this URL: http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=8&PartDetailId=SS12 -SRCID-MAY07-G-F&TransactionId=Try
# 9
Thank you!I will look into this one and might port your changes to the version available in modern systems.Note that there is a space in your URL that does not belong there and must be removed in order to make the link actually work.