Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#160 cannot use -static-libgcc on Solaris

open
Curt Arnold
cpptasks (103)
5
2005-10-15
2005-10-15
Anonymous
No

If I add this to my linker definition on Solaris:

<linkerarg value="-static-libgcc">

I get the following error when running my build:

gcc -Wl,-static-libgcc -fPIC -shared -lstdc++ -shared
-o libopsrespo nsegen.so
../../../../obj/opsresponsegen/ResponseGenerator.o
../../../../obj/ops responsegen/opsresponsegen.o
-L/net/dolphin/home/csteres/p4work/flexnet/opsrespo
nsegen/main/native/lib/sun4_u7 -lresponsegen
[cc]
/export/home/local_mnt/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.2/../
../../../sparc-sun-solaris2.9/bin/ld: unrecognized -a
option `tic-libgcc'

The problem is that ant is converting -static-libgcc to
'Wl,-static-libgcc", as if -static-libgcc was an
arguement to the ld command. But it's not. The proper
command should be:

gcc -static-libgcc -fPIC....etc

I can't find a libgcc.a anywhere on any of the Solaris
machines I have, and have found no sign of it on the
net, to use as a workaround.

For reference, here is the ant fragment where I define
my compiler and linker arguments on Solaris.

<compiler id="jni-cpp" name="g++" if="use-solaris" >
<compilerarg location="start" value="-fPIC" />
<includepath location="${java.dir}/include" />
<includepath location="${java.dir}/include/solaris" />
</compiler>
<linker id="jni-ld" name="gcc" if="use-solaris">
<linkerarg value="-static-libgcc" location="start" />
<linkerarg value="-fPIC" location="start" />
<linkerarg value="-shared" location="start" />
<linkerarg value="-L${jni.lib.dir}" location="end" />
<linkerarg value="-lstdc++" location="start" />
<linkerarg value="-lresponsegen" location="end"/>
</linker>

Discussion