Error on static linking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I have a problem. I can dynamic linking a project, but when I try to
static linking the same, there are an error. The problem is with a
library named ode. This library is installed in /usr/local/lib/ and
there are the static and dynamic version, libode.a and libode.so.

The dynamic link command is this:
[...]
/bin/bash ../libtool --tag=CXX --mode=link g++ -DOGRE_GUI_GLX
-DOGRE_CONFIG_LITTLE_ENDIAN -I/usr/local/include
-I/usr/local/include/OGRE    -g -O2   -o ogrebots  -lOgreOde_Core
-lOgreOde_Prefab -lOgreOde_Loader -lOIS -L/usr/lib -laudiere
ogrebots.o Combat.o Mission.o verilogNetlistLexer.o
verilogNetlistParser.o verilogModel.o circuitSimulator.o
textRenderer.o robot.o sensor.o actuator.o vehicle.o engine.o wheel.o
prefabObject.o basicGates.o -L/usr/local/lib -lOgreMain

g++ -DOGRE_GUI_GLX -DOGRE_CONFIG_LITTLE_ENDIAN -I/usr/local/include
-I/usr/local/include/OGRE -g -O2 -o ogrebots ogrebots.o Combat.o
Mission.o verilogNetlistLexer.o verilogNetlistParser.o verilogModel.o
circuitSimulator.o textRenderer.o robot.o sensor.o actuator.o
vehicle.o engine.o wheel.o prefabObject.o basicGates.o
/usr/local/lib/libOgreOde_Core.so /usr/local/lib/libOgreOde_Prefab.so
/usr/local/lib/libOgreOde_Loader.so /usr/local/lib/libOIS.so
-L/usr/lib /usr/lib/libaudiere.so -L/usr/local/lib
/usr/local/lib/libOgreMain.so -L/home/DescIns/ogreode_v2/src -lode
-L/usr/X11R6/lib -lrt -ldumb -lX11 -lXaw -lXt -lSM -lICE -lCg
-lfreeimage -lpthread -lz -ldl -Wl,--rpath -Wl,/usr/local/lib
-Wl,--rpath -Wl,/usr/local/lib

Then I can execute correctly the executable, and I can watch that all
the dependencies are OK with the "ldd" command. Output ldd:

    linux-gate.so.1 =>  (0xffffe000)
    libOgreOde_Core.so.0 => /usr/local/lib/libOgreOde_Core.so.0 (0xb7f10000)
    libOgreOde_Prefab.so.0 => /usr/local/lib/libOgreOde_Prefab.so.0 (0xb7ee5000)
    libOgreOde_Loader.so.0 => /usr/local/lib/libOgreOde_Loader.so.0 (0xb7ecc000)
    libOIS-1.0.0.so => /usr/local/lib/libOIS-1.0.0.so (0xb7eb0000)
    libaudiere-1.9.4.so => /usr/lib/libaudiere-1.9.4.so (0xb7e5a000)
    libOgreMain-1.4.3.so => /usr/local/lib/libOgreMain-1.4.3.so (0xb7a28000)
    libode.so => /usr/local/lib/libode.so (0xb795f000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7956000)
    libdumb.so.1 => /usr/lib/libdumb.so.1 (0xb790d000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0xb7844000)
    libXaw.so.7 => /usr/lib/libXaw.so.7 (0xb77ed000)
    libXt.so.6 => /usr/lib/libXt.so.6 (0xb779f000)
    libSM.so.6 => /usr/lib/libSM.so.6 (0xb7796000)
    libICE.so.6 => /usr/lib/libICE.so.6 (0xb777e000)
    libCg.so => /usr/lib/libCg.so (0xb746f000)
    libfreeimage.so.3 => /usr/lib/libfreeimage.so.3 (0xb7310000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb72fd000)
    libz.so.1 => /usr/lib/libz.so.1 (0xb72e9000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb72e5000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7206000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb71df000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb71d4000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb70a0000)
    libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0xb7099000)
    libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb7071000)
    libogg.so.0 => /usr/lib/libogg.so.0 (0xb706b000)
    libcdaudio.so.1 => /usr/lib/libcdaudio.so.1 (0xb705a000)
    libFLAC.so.7 => /usr/lib/libFLAC.so.7 (0xb701a000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb6fb0000)
    libzzip-0.so.13 => /usr/local/lib/libzzip-0.so.13 (0xb6faa000)
    /lib/ld-linux.so.2 (0xb7f78000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0xb6fa6000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6fa1000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0xb6f94000)
    libXmu.so.6 => /usr/lib/libXmu.so.6 (0xb6f7f000)
    libXpm.so.4 => /usr/lib/libXpm.so.4 (0xb6f6f000)



Now, I show us what happens when I compile with the option -static:
[...]
/bin/bash ../libtool --tag=CXX --mode=link g++ -DOGRE_GUI_GLX
-DOGRE_CONFIG_LITTLE_ENDIAN -I/usr/local/include
-I/usr/local/include/OGRE    -g -O2   -o ogrebots -static
-lOgreOde_Core -lOgreOde_Prefab -lOgreOde_Loader -lOIS -L/usr/lib
-laudiere  ogrebots.o Combat.o Mission.o verilogNetlistLexer.o
verilogNetlistParser.o verilogModel.o circuitSimulator.o
textRenderer.o robot.o sensor.o actuator.o vehicle.o engine.o wheel.o
prefabObject.o basicGates.o -L/usr/local/lib -lOgreMain

g++ -DOGRE_GUI_GLX -DOGRE_CONFIG_LITTLE_ENDIAN -I/usr/local/include
-I/usr/local/include/OGRE -g -O2 -o ogrebots ogrebots.o Combat.o
Mission.o verilogNetlistLexer.o verilogNetlistParser.o verilogModel.o
circuitSimulator.o textRenderer.o robot.o sensor.o actuator.o
vehicle.o engine.o wheel.o prefabObject.o basicGates.o
-L/usr/local/lib /usr/local/lib/libOgreOde_Prefab.a
-L/home/DescIns/ogreode_v2/src /usr/local/lib/libOgreOde_Loader.a
/usr/local/lib/libOgreOde_Core.a -lode /usr/local/lib/libOIS.a
-L/usr/X11R6/lib -L/usr/lib /usr/lib/libaudiere.a
/usr/lib/libvorbisfile.a /usr/lib/libvorbis.a /usr/lib/libogg.a -lrt
/usr/lib/libcdaudio.a -ldumb /usr/lib/libFLAC.a
/usr/local/lib/libOgreMain.a /usr/lib/libfreetype.a
/usr/local/lib/libzzip.a -lX11 -lXaw -lXt -lSM -lICE -lCg -lfreeimage
-lpthread -lz -ldl


Then, I try to execute the executable and I get this:
 error while loading shared libraries: libode.so: cannot open shared
object file: No such file or directory

And the output of ldd says this:
        linux-gate.so.1 =>  (0xffffe000)
        libode.so => not found
        librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7f05000)
        libdumb.so.1 => /usr/lib/libdumb.so.1 (0xb7ebc000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb7df3000)
        libXaw.so.7 => /usr/lib/libXaw.so.7 (0xb7d9c000)
        libXt.so.6 => /usr/lib/libXt.so.6 (0xb7d4e000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0xb7d45000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0xb7d2d000)
        libCg.so => /usr/lib/libCg.so (0xb7a1e000)
        libfreeimage.so.3 => /usr/lib/libfreeimage.so.3 (0xb78bf000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb78ac000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7898000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7894000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb77b5000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb778e000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7783000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb764f000)
        /lib/ld-linux.so.2 (0xb7f1e000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb764c000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7647000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0xb763a000)
        libXmu.so.6 => /usr/lib/libXmu.so.6 (0xb7624000)
        libXpm.so.4 => /usr/lib/libXpm.so.4 (0xb7614000)


Could you help me please?
Thanks,
Ivan, Barcelona.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux