Strange problem linking object files, static and dynamic libs into a single shared library on x86_64 platform (Linux 2.6, AMD)
"Sören Gerlach"
soeren.gerlach@gmx.de
Sat Oct 23 00:20:00 GMT 2010
Hi all,
the almost final linking stage currently drives me nuts as I don't get it
working correctly...the goal is described in the subject: I need to create a shared object (used for Java through JNI, static lib is no option therefore), combining object files from c++ compiled code, some shared and some static libs. All of that I created before myself (lots of 3rd party libs built from the source), so I have almost full control over what is done there.
I made sure that really all objects files going into the supporting libs have been compiled with "-fPIC", was able to verify this from the build logs. The same applies to the object files that also should be linked directly into the final artefact. However, when I do the final step, the shrinked down example looks like this
/usr/bin/g++ -shared -o lib/libqle.so<<here is the list of my .o files>>
-L./3rdparty/alea/lib -Wl,-Bstatic -lenbw_gpfc<<now more static& dynamic libs
to come>>
I get the error message:
"relocation R_X86_64_32 against `a local symbol' can not/ /be used when
making a shared object; recompile with -fPIC"
This is annyoing (sort of ,-)) as I made sure that .o files in
"enbw_gpfc" have been compiled with -fPIC. Choosing another lib I get a
slightly changed error message:
"relocation R_X86_64_32S against..."
What is the difference with that "S" at the end...?
And finally choosing another static lib all works well. Any hint and/or direction where to look at and what to check would be really, really usefull, I spent now almost days for getting this build stuff up but the final stage is still not working as designed...sigh ,-)
Should be noted I use gcc 4.1.2.
Thanks in advance,
Soeren Gerlach
--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
More information about the Gcc-help
mailing list