gcc-4.4.2 linking with static libraries on Intel mac 10.5 and libstdc++.a

Brett Grant grantb@grantb.org
Tue Oct 20 10:44:00 GMT 2009


I have a fairly old version of gcc-4.2.  I have removed the shared  
libraries from gcc-root/lib, so that there are only .a library files  
in it.

This causes my source code to only be dynamically dependent upon Apple  
provided libraries and removes dependencies to gcc libraries.  This  
works just fine, and is good because I run this executable on a  
cluster setup that doesn't have the gcc libraries installed.

I decided to build v4.4.2.  This build and installed just fine.  If I  
allow the dynamic libraries everything works just fine, but if I  
remove them I get an error:

/usr/bin/ld: /usr/local/gcc-4.4.2/lib/gcc/i686-apple- 
darwin8/4.4.2/../../../libstdc++.a(functexcept.o) malformed object,  
illegal reference for -dynamic code (reference to a coalesced section  
(__TEXT,__textcoal_nt) from section (__TEXT,__text) relocation entry  
(77))

If I pass the functexcept.o to the linker, it will compile.

I don't really deal much with libraries, so I tried putting  
functexcept.o in its own library with an ar command, and deleted  
functexcept.o out of the libsdc++.a library.

I get the same exact error, except the error references the library  
that I made instead of libstdc++.a

Any help would be appreciated.

thanks,
Brett



More information about the Gcc-help mailing list