Error on statically link in Ubuntu with libode

minpla

13-10-2007 09:53:52

I can perfectly compile dynamically my application, but I need to compile it statically, for the students don't worry to install all the libraries dependencies.

Well, my problem is that in the linking process the compiler doesn't link the libode.so.
This is the linking command:

/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


At this moment I haven't got any error, but then I watch the executable dependencies (ldd myexecutable), says this:

linux-gate.so.1 => (0xffffe000)
libode.so => not found
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7fb2000)
libdumb.so.1 => /usr/lib/libdumb.so.1 (0xb7f69000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7ea0000)
libXaw.so.7 => /usr/lib/libXaw.so.7 (0xb7e49000)
libXt.so.6 => /usr/lib/libXt.so.6 (0xb7dfb000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb7df2000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb7dda000)
libCg.so => /usr/lib/libCg.so (0xb7acb000)
libfreeimage.so.3 => /usr/lib/libfreeimage.so.3 (0xb796c000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7959000)
libz.so.1 => /usr/lib/libz.so.1 (0xb7945000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7941000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7862000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb783b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7830000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb76fc000)
/lib/ld-linux.so.2 (0xb7fcb000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb76f9000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb76f4000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb76e7000)
libXmu.so.6 => /usr/lib/libXmu.so.6 (0xb76d1000)
libXpm.so.4 => /usr/lib/libXpm.so.4 (0xb76c1000)


libode.so => not found. Why the normal compilation finds this library, that is installed in /usr/local/lib, but in static compilation not???

Perhaps there are a strange think in the second autogenerated linking command:
[...] -L/home/DescIns/ogreode_v2/src [...]
Why the linker knows where I have the unpacked the OgreOde package? And why does it need this if all the libraries are installed in /usr/local/lib?

Thanks,
Ivan.

minpla

15-10-2007 17:02:08

Well, I asked this question to gcc-help@gcc.gnu.org and answer me partially.
The ldd output doesn't find the libode.so because its not figured in my LD_LIBRARY_PATH:
[...] just type echo $LD_LIBRARY_PATH
if you lib dir is not listed you can added and try again [...]

Also say that in normal compilation/linking there are The linker option '--rpath /usr/local/lib' that puts the executable to search from '/usr/local/lib' at runtime... and when I am trying to compile/linking with -static option '--rpath /usr/local/lib' is missing!

So I edit the .bashrc file of my home dir and add export LD_LIBRARY_PATH=/usr/local/lib at the end.
Then, the executable and the ldd find the libode.so!!!


However, there are two problems:
1. Why not link static libode if exist the file libode.a in /usr/local/lib???

2. Now, I have a new error when I execute my application:
[...]
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library /usr/local/lib/OGRE/RenderSystem_GL.so
ogrebots: OgreRoot.cpp:100: static Ogre::Root& Ogre::Root::getSingleton(): Assertion `ms_Singleton' failed.
Cancelado (core dumped)
[...]

Why?

Thanks.

minpla

15-10-2007 17:21:36

Another thing.
Could somebody say me how contact with any contributor of ODE???I visit their web and wiki and I haven't seen any forum neither mail to write.

minpla

24-10-2007 20:07:46

Another question about this topic.
I think that the reason that I couldn't link the static libode.a is caused by OgreOde_Core.a. When I force the linker to put the libode.a instead the libode.so, the errors flood my shell like this:

/usr/local/lib/libOgreOde_Core.a(OgreOdeWorld.o): In function `OgreOde::World::setAutoSleep(bool)':
/home/DescIns/ogreode_v2/src/OgreOdeWorld.cpp:96: referencia a `dWorldSetAutoDisableFlag' sin definir


There are a rare thimk: In what moment the gcc obtains the path /home/DescIns/ogreode_v2/src/OgreOdeWorld.cpp and why??? At any moment I put this path at anywhere. I don't understand.