MantisBT - opensim
View Issue Details
0006545opensim[REGION] Physics Enginespublic2013-02-15 16:272014-06-30 02:30
jak.daniels 
Robert Adams 
normalminoralways
assignedopen 
master (dev code) 
 
Grid (Multiple Regions per Sim)
BulletSim
Mono / Linux64
2.10
0006545: BULLETSIM: ldd reports libBulletSim.so as not a dynamic executable
OpenSim will not start with bulletsim enabled:

...
22:39:44 - [BULLETS SCENE]: Selected bullet engine bulletunmanaged -> BulletUnmanaged/
22:39:44 - [APPLICATION]:
APPLICATION EXCEPTION DETECTED: System.UnhandledExceptionEventArgs

Exception: System.DllNotFoundException: lib64/libBulletSim.so
  at (wrapper managed-to-native) OpenSim.Region.Physics.BulletSPlugin.BSAPIUnman/BSAPICPP:Initialize2 (OpenMetaverse.Vector3,intptr,int,intptr,int,intptr,OpenSim.Region.Physics.BulletSPlugin.BSAPIUnman/BSAPICPP/DebugLogCallback)
...

On further investigation both lib32/libBulletSim.so and lib64/libBulletSim.so are reported as 'not a dynamic executable' by ldd.

I've tested this on two servers, both running centos 5 x86_64 with mono 2.10.2, one is an openvz VM the other a VMware VM, and get the same result. Other .so files work ok with ldd and ODE physics works fine.
No tags attached.
Issue History
2013-02-15 16:27jak.danielsNew Issue
2013-02-16 11:17jak.danielsNote Added: 0023576
2013-02-16 11:24nebadonAssigned To => Robert Adams
2013-02-16 11:24nebadonStatusnew => assigned
2013-02-17 11:14Robert AdamsNote Added: 0023578
2013-03-01 12:31jak.danielsNote Added: 0023616
2013-03-01 15:12Robert AdamsNote Added: 0023617
2013-03-07 12:27jak.danielsNote Added: 0023645
2014-06-30 02:30Jak DanielsNote Added: 0026414

Notes
(0023576)
jak.daniels   
2013-02-16 11:17   
ldd libBulletSim.so works on RHEL/Centos 6, producing the output

ldd libBulletSim.so
        linux-vdso.so.1 => (0x00007fff44dff000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f943dbee000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f943d96a000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f943d753000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f943d3d4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f943e216000)

so I got to wondering if there were differences in the way shared objects can be optimised by the compiler depending on the platform and whether this might have compatibility issues. My search turned up this from the LDP: http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html [^]

"Use -fPIC or -fpic to generate code. Whether to use -fPIC or -fpic to generate code is target-dependent. The -fPIC choice always works, but may produce larger code than -fpic (mnenomic to remember this is that PIC is in a larger case, so it may produce larger amounts of code). Using -fpic option usually generates smaller and faster code, but will have platform-dependent limitations, such as the number of globally visible symbols or the size of the code. The linker will tell you whether it fits when you create the shared library. When in doubt, I choose -fPIC, because it always works."

I don't know which flag was given to gcc when compiling libBulletSim.so, and I know this is probably a long shot, but it might possibly be the problem?
(0023578)
Robert Adams   
2013-02-17 11:14   
Sadly, BulletSim is already being built with "-fPIC". I will have to keep looking.
(0023616)
jak.daniels   
2013-03-01 12:31   
What version of gcc is used to compile it and on what platform?
Is Bulletsim available as source so I can try compiling it with the gcc from RHEL5?
thanks :-)
(0023617)
Robert Adams   
2013-03-01 15:12   
BulletSim sources are in the OpenSimulator 'libs' repository:
"git clone git://opensimulator.org/git/opensim-libs". [^] In the subdirectory "trunk/unmanaged/BulletSim" you will find a BUILD.TXT with the instructions for building Bullet itself and then building and linking BulletSim.
(0023645)
jak.daniels   
2013-03-07 12:27   
Ok, have compiled on Centos 5 and the libBulletSim.so works just fine! If you could tell me what distro and tool-chain version you used to compile, then I could set up a VM like that and experiment with the build flags to see if I can make the build process compatible with Cenos/RHEL5. Its still a popular distro on VPS's ;-)
(0026414)
Jak Daniels   
2014-06-30 02:30   
bin/lib64/libBulletSim.so is compiled/linked with a newer gcc and the shared object library has a platform type set in its header which makes centos 5 not able to recognise it as a valid shared object.

in your opensim directory try typing:
ldd ./bin/lib64/libBulletSim.so
to see if it is recognised as a valid shared object library

for me on centos 5 it returns: not a dynamic executable

there is a very hacky fix you can do which is to change a byte in the header of the .so file so that the platform type is one that is recognised by centos 5 ldd

cp ./bin/lib64/libBulletSim.so ./bin/lib64/libBulletSim.so.old
printf "\x00" | dd of=libBulletSim.so.1 bs=1 seek=7 count=1 conv=notrunc

then ldd should recognise the shared library!