FS#6864 - problem with ld linker with dynamic libs and no_archive option
Attached to Project:
Arch Linux
Opened by Valerio Mariani (valmar) - Tuesday, 10 April 2007, 09:56 GMT
Last edited by Jan de Groot (JGC) - Sunday, 22 April 2007, 21:03 GMT
Opened by Valerio Mariani (valmar) - Tuesday, 10 April 2007, 09:56 GMT
Last edited by Jan de Groot (JGC) - Sunday, 22 April 2007, 21:03 GMT
|
Details
Good morning.
I am trying to compile this very simple test program: #include "xercesc/util/XMLString.hpp" int main() { XERCES_CPP_NAMESPACE_USE; XMLCh* c= XMLString::transcode("xml"); return 0; } I compile it with: g++ -o test.o -c -O2 -g -Wall -DLINUX -Istage/include -Iextra/include -I/usr/local/include test.c All goes fine. If I try to link it with: ld -no_archive -L/data/Work/Software/iplt/stage/lib -L/usr/local/lib -lxerces-c test.o I get: ld: cannot find -lxerces-c But: ls -l /usr/lib/libxerces-c* Gives:lrwxrwxrwx 1 root root 19 2007-04-10 11:10 /usr/lib/libxerces-c.so -> libxerces-c.so.27.0 lrwxrwxrwx 1 root root 19 2007-04-10 11:10 /usr/lib/libxerces-c.so.27 -> libxerces-c.so.27.0 -rwxr-xr-x 1 root root 5292307 2007-02-27 10:58 /usr/lib/libxerces-c.so.27.0 So the dynamic library is there. Notice there is no static library (.a). Now if I link with: ld -L/data/Work/Software/iplt/stage/lib -L/usr/local/lib -lxerces-c test.o (no no_archive option) It links fine. As far as I know, the no_archive option force the linker to use the dynamic libraries and not the static ones. However, the successful linking cannot be a fallback to the static library because the static library is not available. Anyone knows the reason for this behaviour? Thanks for your help Valerio PS: If it is useful, this is my ld.so.conf # # /etc/ld.so.conf # /usr/X11R6/lib /opt/kde/lib /opt/qt/lib /opt/intel/fce/9.1.036/lib/ /opt/intel/cce/9.1.042/lib/ /opt/lib32/lib /opt/lib32/usr/lib # End of file |
This task depends upon
After seeing your message I went back and investigated.
I am using scons to compile my code. I have both gcc and the intel compiler on my machine.
For some reason, even if in the config files I am specifying to use gcc, scons picks up the intel compiler and
automatically chooses the parameters for the linker. If I remove the intel compiler-related directories from the
environment variables (path,libraries, etc.) then scons picks up the correct parameters and works fine.
At this point I guess this is a bug in scons (or something that I am doing wrong in the configuration).
I will investigate the matter further and eventually open another ticket).
Thank you for your help!!!
Valerio