UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C++
  • » [g++ 3.3.3] linking causing error (putting absolute paths)

#1 2004-09-22 06:24 AM

angoyal
Member
Registered: 2003-05-23
Posts: 31

Re: [g++ 3.3.3] linking causing error (putting absolute paths)

Hey folks, I am trying to link a shared object and getting a weird error, for some reason g++/linker is putting the absolute paths into the *.so file. I know there is some linker option to control this but I am at my wit's end, can someone help me out?

g++ -shared -o jambuild/server/Utility/Generic/Portable/nqportable.so  
jambuild/server/Utility/Generic/Portable/SUPStdIncludes.o 
jambuild/server/Utility/Generic/Portable/SUPBaseStringUtil.o
thirdparty/lib/linux_x86_gcc/libstlport_gcc_debug.so 
thirdparty/lib/linux_x86_gcc/libxerces-c1_6_0.so -ldl


$ ldd jambuild/server/Utility/Generic/Portable/nqportable.so
        linux-gate.so.1 =>  (0xffffe000)
        thirdparty/lib/linux_x86_gcc/libstlport_gcc_debug.so => thirdparty/lib/linux_x86_gcc/libstlport_gcc_debug.so (0x4004b000)
        thirdparty/lib/linux_x86_gcc/libxerces-c1_6_0.so => thirdparty/lib/linux_x86_gcc/libxerces-c1_6_0.so (0x4010b000)
        libdl.so.2 => /lib/libdl.so.2 (0x40339000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4033c000)
        libm.so.6 => /lib/tls/libm.so.6 (0x403f8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4041a000)
        libc.so.6 => /lib/tls/libc.so.6 (0x40422000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40537000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

I want ldd to look like this (notice there are no paths):

$ ldd jambuild/server/Utility/Generic/Portable/nqportable.so
        linux-gate.so.1 =>  (0xffffe000)
        libstlport_gcc_debug.so => libstlport_gcc_debug.so (0x4004b000)
        libxerces-c1_6_0.so => libxerces-c1_6_0.so (0x4010b000)
        libdl.so.2 => /lib/libdl.so.2 (0x40339000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4033c000)
        libm.so.6 => /lib/tls/libm.so.6 (0x403f8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4041a000)
        libc.so.6 => /lib/tls/libc.so.6 (0x40422000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40537000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Offline

#2 2004-09-22 01:16 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: [g++ 3.3.3] linking causing error (putting absolute paths)

How about instead of passing in the full path to the shared libs on
the command line, you instead just specify the directory they are
located in as a "-L" path, and then just link them in with normal
"-l<name>" with no path...

Offline

#3 2004-09-22 09:43 PM

angoyal
Member
Registered: 2003-05-23
Posts: 31

Re: [g++ 3.3.3] linking causing error (putting absolute paths)

I am trying that, but some of the libraries that we build do not have the "lib" prefix, so it is complicating matters (at least from our build tool perspective).

Offline

#4 2004-09-22 10:16 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: [g++ 3.3.3] linking causing error (putting absolute paths)

If you build a library that is intended to be linked to at compile time, then it must start with "lib". Otherwise it can be only dynamically linked at runtime with dlopen(). So either rename it, fix the name, or make a symlink.

Offline

  • Index
  • » C++
  • » [g++ 3.3.3] linking causing error (putting absolute paths)

Board footer

Powered by FluxBB