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.


#160 cannot use -static-libgcc on Solaris

Curt Arnold
cpptasks (103)

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
../../../../obj/ops responsegen/opsresponsegen.o
nsegen/main/native/lib/sun4_u7 -lresponsegen
../../../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" />
<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"/>