lib names in Linux

rogerdv

04-05-2010 15:25:51

Im trying to compile the demos in Linux via scons, but I have found a problem: no matter what I do I get an error about library not found. this is my scons config:

env.Append(CPPFLAGS='-Llib')
env.Append(CPPPATH = ['../include', '../../include','../../../Dynamics/include', '../../../Collisions/include', '/home/roger/projects/ogre/Samples/Common/include/'])
env.Append(LIBS = ['OgreBulletDyn', 'OgreBulletCol'])


I have copied the libs to all possible places, including the demo directory, but the error persists. Any idea about whats happening here?

dermont

11-05-2010 10:30:44

You probably need to specify some additional variables for SCons such as:

env.Append ( LIBPATH=...
env.Append(RPATH=...

http://www.scons.org/doc/0.93/HTML/scons-user/x275.html

rogerdv

11-05-2010 20:10:15

No, that didnt solved the problem.

dermont

12-05-2010 11:10:04

No, that didnt solved the problem.
Without seeing your SConstruct file I wouldn't know what your problem is.

It's been some time since I built the demo but you could try updating the autotools build (see attached for an example may or may not still work).

Also I have some CMake build files (unfinished) for Linux/cross-compiling with Mingw I'll try and dig out if you want to go that route.

Fish

12-05-2010 12:39:04

If someone can pull together a working linux build system I'll make sure it gets into SVN.

-Fish

rogerdv

12-05-2010 12:44:10

Sorry, here is it:

env = Environment()
env.Append(CPPFLAGS='-Llib')
env.Append(CPPPATH = ['../include', '../../include','../../../Dynamics/include', '../../../Collisions/include', '/home/roger/projects/ogre/Samples/Common/include/'])
env.Append(LIBPATH=['lib'])
env.Append(RPATH=['lib'])
env.Append(LIBS = ['OgreBulletDyn', 'OgreBulletCol'])

def CheckPKGConfig(context, version):
context.Message( 'Checking for pkg-config... ' )
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
context.Result( ret )
return ret

def CheckPKG(context, name):
context.Message( 'Checking for %s... ' % name )
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
context.Result( ret )
return ret

conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
'CheckPKG' : CheckPKG })

if not conf.CheckPKGConfig('0.15.0'):
print 'pkg-config >= 0.15.0 not found.'
Exit(1)

if not conf.CheckPKG('OGRE >= 1.4.0'):
print 'Ogre3d >= 1.4.0 not found.'
Exit(1)

if not conf.CheckPKG('OIS >= 1.0'):
print 'OIS >= 1.0 not found.'
Exit(1)

if not conf.CheckPKG('bullet'):
print 'Bullet physics library not found.'
Exit(1)

env = conf.Finish()
env.ParseConfig('pkg-config --cflags --libs OGRE')
env.ParseConfig('pkg-config --cflags --libs OIS')
env.ParseConfig('pkg-config --cflags --libs bullet')

env.Program('demos',Split('''main.cpp Constraints_Demo.cpp Primitives_Demo.cpp
Ragdoll_Demo.cpp Terrain_Demo.cpp TriMesh_Demo.cpp Vehicle_Demo.cpp ../../src/OgreBulletListener.cpp
../../src/OgreBulletInputListener.cpp ../../src/OgreBulletGuiListener.cpp ../../src/OgreBulletApplication.cpp ../../src/BetaGUI.cpp'''))


I placed it in Demos/Dynamics_Demos/src

rogerdv

12-05-2010 13:03:39

Tested the patch (applied with patch >demobuild.oath, dont know it was the wrong way) and besides a couple of errors:
patching file configure.ac
patching file Makefile.am
patching file Makefile.am
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej
patching file autogen.sh
patching file Makefile.am
Hunk #1 FAILED at 33.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej


just says that needs a Makefile.in in Demos. And Im pretty sure that it will require a lot of Makefile.in, one for each directory.

dermont

12-05-2010 14:20:01

Don't know why the patch failed, maybe I screwed up or something changed in OgreBullet since the last time I updated. I'll try a fresh check out later and create a new patch.

Regarding your SCons problem, where have you installed the OgreBullet libraries? If you are building the demo from your build dir the libraries are in '../../../Dynamics/src/.libs' and '../../../Collisions/src/.libs'. You probably need to update your SConstruct file with something like:


env.Append(LIBPATH=['../../../Dynamics/src/.libs','../../../Collisions/src/.libs'])

###env.Append(RPATH=['/media/sda7/Libraries/OGRE/ogre-svn/sdk/v1-7/lib','../../../Dynamics/src/.libs','../../../Collisions/src/.libs'])

## relative path http://www.scons.org/wiki/UsingOrigin
env.Append( RPATH = [ '/media/sda7/Libraries/OGRE/ogre-svn/sdk/v1-7/lib',
env.Literal('\\$$ORIGIN/../../../Dynamics/src/.libs'),
env.Literal('\\$$ORIGIN/../../../Collisions/src/.libs') ] )

rogerdv

12-05-2010 14:52:59

Hmm, that was the problem, wrong path. It solved the missing lib but got a new error:

/home/roger/projects/ogrebullet/Collisions/src/.libs/libOgreBulletCol.so: undefined reference to `ConvexBuilder::~ConvexBuilder()'
/home/roger/projects/ogrebullet/Collisions/src/.libs/libOgreBulletCol.so: undefined reference to `ConvexBuilder::process(ConvexDecomposition::DecompDesc const&)'
/home/roger/projects/ogrebullet/Collisions/src/.libs/libOgreBulletCol.so: undefined reference to `ConvexBuilder::ConvexBuilder(ConvexDecomposition::ConvexDecompInterface*)'
collect2: ld returned 1 exit status

dermont

12-05-2010 15:43:55

You need to link against libConvexDecomposition.

- From the CMake gui for bullet enable BUILD_EXTRAS and build.
- Manually copy across bullet-2.76/Extras/ConvexDecomposition/libConvexDecomposition.so(or .a) to where you have installed the bullet libs.
- run sudo ldconfig (if installed stadard location)
- For the OgreBulletCol lib link against libConvexDecomposition (see above patch) and point to the headers path, e.g:

CXXFLAGS='-I/media/sda7/Libraries/Physics/bullet-2.76/Extras/ConvexDecomposition' ./configure ......

- and link your demo against libConvexDecomposition (-lConvexDecomposition)

rogerdv

21-06-2010 19:50:32

Again the same missing lib problem. this time is convexDecomposition:

g++ -o demos -pthread main.o Constraints_Demo.o Primitives_Demo.o Ragdoll_Demo.o Terrain_Demo.o TriMesh_Demo.o Vehicle_Demo.o /home/roger/projects/ogrebullet/Demos/src/OgreBulletListener.o /home/roger/projects/ogrebullet/Demos/src/OgreBulletInputListener.o /home/roger/projects/ogrebullet/Demos/src/OgreBulletGuiListener.o /home/roger/projects/ogrebullet/Demos/src/OgreBulletApplication.o /home/roger/projects/ogrebullet/Demos/src/BetaGUI.o -L/home/roger/projects/ogrebullet/Dynamics/src/.libs -L/home/roger/projects/ogrebullet/Collisions/src/.libs -L/usr/lib -lOgreBulletDyn -lOgreBulletCol -lConvexDecomposition -lOgreMain -lpthread -lOIS -lBulletDynamics -lBulletCollision -lLinearMath -lBulletSoftBody
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lConvexDecomposition

Fish

22-06-2010 00:42:39

ConvexDecomposition is part of the Bullet distribution. I don't believe it is built by default. The source is located in Bullet/Extras/ConvexDecomposition. If you use cmake to generate your Bullet build files you need to check the "BUILD_EXTRAS" option.

- Fish

rogerdv

22-06-2010 13:23:24

Yes, I compiled it and copied Extras/libconvexdecomposition.a to /usr/lib, the ran ldconfig. But anyway, it doesnt works.