participate


Sun Studio C++ - Linux x86_64: libm format not recognized
<<   Back to Forum  |   Give us Feedback
This topic has 12 replies on 1 page.
bluethumb
Posts:2
Registered: 6/8/07
Linux x86_64: libm format not recognized   
Jun 8, 2007 5:06 PM

 
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?
 
SFV
Posts:299
Registered: 9/17/06
Re: Linux x86_64: libm format not recognized   
Jun 8, 2007 11:15 PM (reply 1 of 12)  (In reply to original post )

 
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.
 
bluethumb
Posts:2
Registered: 6/8/07
Re: Linux x86_64: libm format not recognized   
Jun 11, 2007 9:54 AM (reply 2 of 12)  (In reply to #1 )

 
Thanks.

Is there a workaround? It sounds as if neither linker will work in this situation.
 
clamage45
Posts:3,034
Registered: 6/23/06
Re: Linux x86_64: libm format not recognized   
Jun 11, 2007 9:59 AM (reply 3 of 12)  (In reply to #2 )

 
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.
 
rschiele
Posts:13
Registered: 6/13/07
Re: Linux x86_64: libm format not recognized   
Jun 13, 2007 4:29 PM (reply 4 of 12)  (In reply to #2 )

 
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?
 
SFV
Posts:299
Registered: 9/17/06
Re: Linux x86_64: libm format not recognized   
Jun 14, 2007 3:03 AM (reply 5 of 12)  (In reply to #4 )

 
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.
 
clamage45
Posts:3,034
Registered: 6/23/06
Re: Linux x86_64: libm format not recognized   
Jun 15, 2007 10:07 AM (reply 6 of 12)  (In reply to #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 ...

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.
 
rschiele
Posts:13
Registered: 6/13/07
Re: Linux x86_64: libm format not recognized   
Jun 15, 2007 8:42 PM (reply 7 of 12)  (In reply to #6 )

 
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.
 
  SunCProjectLead
Posts:44
Registered: 12/9/04
Re: Linux x86_64: libm format not recognized   
Jun 19, 2007 5:29 PM (reply 8 of 12)  (In reply to #7 )

 
You can download the source code that corresponds to the modified
version 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
 
rschiele
Posts:13
Registered: 6/13/07
Re: Linux x86_64: libm format not recognized   
Jun 19, 2007 7:34 PM (reply 9 of 12)  (In reply to #8 )

 
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.
 
amduser
Posts:47
Registered: 8/26/06
Re: Linux x86_64: libm format not recognized   
Jul 8, 2009 9:56 AM (reply 10 of 12)  (In reply to #9 )

 
This is an old thread, but I remember having seen this problem, and our previously installed sunstudio12 needs the change to -/prod/lib/amd64/ld as described in this thread in order for the 'hello world' test to work with -m64. However, I can confirm that I've just repeated the test with the latest version 12 update 1 and it looks like the problem is fixed. We have CentOS 5.x, which is also now listed as a supported platform.
Out of interest, anyone know more background into the fix, and also if the patches made by Sun were applied upstream to the GNU ld?
 
SFV
Posts:299
Registered: 9/17/06
Re: Linux x86_64: libm format not recognized   
Jul 9, 2009 1:59 AM (reply 11 of 12)  (In reply to #10 )

 
anyone know more background into the fix

We have upgraded gnu ld to 2.17.90 and learnt to live with gnu-ld variation of COMDAT support (machinery used by C++ compilers to handle "vague linkage").
We still patch gnu ld a little tiny bit, you can find two-liner patch at {install-dir}/prod/src/patch-intel-Linux-2.17.90 if curious enough.

if the patches made by Sun were applied upstream to the GNU ld?

Nope, this change is not yet in upstream :(

regards,
__Fedor.
 
amduser
Posts:47
Registered: 8/26/06
Re: Linux x86_64: libm format not recognized   
Jul 9, 2009 7:05 AM (reply 12 of 12)  (In reply to #11 )

 
Thanks for those details, Fedor. Interesting to see that SS is up to 2.17.90, whilst the Centos/RHEL 5.x binutils package is only at 2.17.50. I presume this is tied to the 2.6.18 kernel version of RHEL5, so Fedora/Ubuntu etc would have newer versions. I don't suppose there will be any compatibility issues with Centos 5 libraries that have been linked with the older ld version?
 
This topic has 12 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 28
  • Guests : 133

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums