Build problems

stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Build problems

Post by stenyak »

I'm using Bullet from svn (head), and i'm having troubles at link time.

Code: Select all

g++ -o motorsport-sim -g -O0 -ggdb3 -Wall -Wno-deprecated -ansi -pedantic --coverage -fprofile-arcs -ftest-coverage -isystem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -fmessage-length=0 -fexceptions -fident -isystem usr/include/OGRE usr/share/motorsport-sim/main.o -Lusr/lib -Lusr/lib -Lusr/lib/motorsport -Lusr/lib/motorsport-sim -Lusr/lib -Lusr/lib -Lusr/lib -lboost_thread-gcc41-mt-1_35 -lboost_filesystem-gcc41-mt-1_35 -lboost_system-gcc41-mt-1_35 -lmotorsport -lmotorsport-sim -lOgreMain -lbulletcollision -lbulletdynamics -lbulletsoftbody -lbulletmath -lBulletColladaConverter -lcolladadom -lOIS -lOgreCollada -lFCollada -lLibXML
usr/lib/motorsport/libmotorsport.so: undefined reference to `btConvexTriangleMeshShape::btConvexTriangleMeshShape(btStridingMeshInterface*)'
I've tried to locate the mentioned symbol with this:

Code: Select all

$ for i in *; do objdump -t "$i" |grep btConvexTriangleMeshShape && echo "^______$i"; done
00000000         *UND*  00000000 _ZN25btConvexTriangleMeshShapeC1EP23btStridingMeshInterface
^______libBulletColladaConverter.a
btConvexTriangleMeshShape.o:     file format elf32-i386
00000000 l    df *ABS*  00000000 btConvexTriangleMeshShape.cpp
00000000 l    d  .text._ZNK25btConvexTriangleMeshShape12getShapeTypeEv  00000000 .text._ZNK25btConvexTriangleMeshShape12getShapeTypeEv
00000000 l    d  .text._ZNK25btConvexTriangleMeshShape7getNameEv        00000000 .text._ZNK25btConvexTriangleMeshShape7getNameEv
00000100 l     O .rodata        00000052 _ZZNK25btConvexTriangleMeshShape8isInsideERK9btVector3fE19__PRETTY_FUNCTION__
00000160 l     O .rodata        00000053 _ZZNK25btConvexTriangleMeshShape8getPlaneER9btVector3S1_iE19__PRETTY_FUNCTION__
000001c0 l     O .rodata        00000048 _ZZNK25btConvexTriangleMeshShape9getVertexEiR9btVector3E19__PRETTY_FUNCTION__
00000220 l     O .rodata        00000051 _ZZNK25btConvexTriangleMeshShape7getEdgeEiR9btVector3S1_E19__PRETTY_FUNCTION__
00000000 l    d  .text._ZN25btConvexTriangleMeshShapeD0Ev       00000000 .text._ZN25btConvexTriangleMeshShapeD0Ev
00000000 l    d  .text._ZN25btConvexTriangleMeshShapeD1Ev       00000000 .text._ZN25btConvexTriangleMeshShapeD1Ev
00000000 l    d  .data.rel.ro._ZTV25btConvexTriangleMeshShape   00000000 .data.rel.ro._ZTV25btConvexTriangleMeshShape
00000000 l    d  .rodata._ZTS25btConvexTriangleMeshShape        00000000 .rodata._ZTS25btConvexTriangleMeshShape
00000000 l    d  .data.rel.ro._ZTI25btConvexTriangleMeshShape   00000000 .data.rel.ro._ZTI25btConvexTriangleMeshShape
00000000 l    d  _ZNK25btConvexTriangleMeshShape12getShapeTypeEv        00000000 .group
00000000 l    d  _ZNK25btConvexTriangleMeshShape7getNameEv      00000000 .group
00000000 l    d  _ZN25btConvexTriangleMeshShapeD0Ev     00000000 .group
00000000 l    d  _ZN25btConvexTriangleMeshShapeD1Ev     00000000 .group
00000000 l    d  _ZTV25btConvexTriangleMeshShape        00000000 .group
00000000 l    d  _ZTS25btConvexTriangleMeshShape        00000000 .group
00000000 l    d  _ZTI25btConvexTriangleMeshShape        00000000 .group
00000000  w    F .text._ZNK25btConvexTriangleMeshShape12getShapeTypeEv  0000000a _ZNK25btConvexTriangleMeshShape12getShapeTypeEv
00000000  w    F .text._ZNK25btConvexTriangleMeshShape7getNameEv        00000016 _ZNK25btConvexTriangleMeshShape7getNameEv
00000000 g     F .text  0000000a _ZNK25btConvexTriangleMeshShape14getNumVerticesEv
0000000a g     F .text  0000000a _ZNK25btConvexTriangleMeshShape11getNumEdgesEv
00000014 g     F .text  0000000a _ZNK25btConvexTriangleMeshShape12getNumPlanesEv
0000001e g     F .text  00000026 _ZNK25btConvexTriangleMeshShape15getLocalScalingEv
00000044 g     F .text  0000003c _ZNK25btConvexTriangleMeshShape8isInsideERK9btVector3f
00000080 g     F .text  0000003c _ZNK25btConvexTriangleMeshShape8getPlaneER9btVector3S1_i
000000bc g     F .text  0000003c _ZNK25btConvexTriangleMeshShape9getVertexEiR9btVector3
000000f8 g     F .text  0000003c _ZNK25btConvexTriangleMeshShape7getEdgeEiR9btVector3S1_
00000000  w    F .text._ZN25btConvexTriangleMeshShapeD0Ev       00000045 _ZN25btConvexTriangleMeshShapeD0Ev
00000000  w    O .data.rel.ro._ZTV25btConvexTriangleMeshShape   0000006c _ZTV25btConvexTriangleMeshShape
00000000  w    F .text._ZN25btConvexTriangleMeshShapeD1Ev       00000045 _ZN25btConvexTriangleMeshShapeD1Ev
00000134 g     F .text  00000038 _ZN25btConvexTriangleMeshShape15setLocalScalingERK9btVector3
0000016c g     F .text  00000123 _ZNK25btConvexTriangleMeshShape24localGetSupportingVertexERK9btVector3
00000290 g     F .text  0000013e _ZNK25btConvexTriangleMeshShape49batchedUnitVectorGetSupportingVertexWithoutMarginEPK9btVector3PS0_i
000003ce g     F .text  000001db _ZNK25btConvexTriangleMeshShape37localGetSupportingVertexWithoutMarginERK9btVector3
000005aa g     F .text  00000051 _ZN25btConvexTriangleMeshShapeC1EP23btStridingMeshInterfaceb
000005fc g     F .text  00000051 _ZN25btConvexTriangleMeshShapeC2EP23btStridingMeshInterfaceb
00000000  w    O .data.rel.ro._ZTI25btConvexTriangleMeshShape   0000000c _ZTI25btConvexTriangleMeshShape
00000000  w    O .rodata._ZTS25btConvexTriangleMeshShape        0000001c _ZTS25btConvexTriangleMeshShape
^______libbulletcollision.a
00000000 l    d  .text._ZN25btConvexTriangleMeshShape16getMeshInterfaceEv       00000000 .text._ZN25btConvexTriangleMeshShape16getMeshInterfaceEv
00000000 l    d  _ZN25btConvexTriangleMeshShape16getMeshInterfaceEv     00000000 .group
00000000  w    F .text._ZN25btConvexTriangleMeshShape16getMeshInterfaceEv       0000000b _ZN25btConvexTriangleMeshShape16getMeshInterfaceEv
^______libbulletdynamics.a
But i'm already linking to those libs, except the "btConvexTriangleMeshShape.o" which i can't find, i guess it's inside one of the static .a files. I don't know what else to do... any ideas? Thanks in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build problems

Post by Erwin Coumans »

The constructor of btConvexTriangleMeshShape recently got a new second argument, with default value:

Code: Select all

btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb = true);
Can you make sure to clean all your projects and rebuild all files and libraries?
Thanks,
Erwin
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: Build problems

Post by stenyak »

After removing my custom $prefix/lib/*, and rebuilding and reinstalling bullet, now the BulletColladaConverter lib does not exist?
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lBulletColladaConverter


For the record, i am using (or trying) the collada loader.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Build problems

Post by sparkprime »

I'm not 100% sure but i think the order of libraries still matters if you use the -l form, so you might have better luck generallly if you list them in order of dependency. Erwin's suggestion seems more likely given the source of the error but it's something that stuck out at me.

Also, nm -C is possibly more useful than objdump in these situations, really useful tool actually :)
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: Build problems

Post by stenyak »

Using -l parameters, as i just mentioned, outputs this:
$ g++ -o motorsport-sim -g -O0 -ggdb3 -Wall -Wno-deprecated -ansi -pedantic --coverage -fprofile-arcs -ftest-coverage -isystem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -fmessage-length=0 -fexceptions -fident -isystem usr/include/OGRE usr/share/motorsport-sim/main.o -Lusr/lib -Lusr/lib -Lusr/lib/motorsport -Lusr/lib/motorsport-sim -Lusr/lib -Lusr/lib -Lusr/lib -lboost_thread-gcc41-mt-1_35 -lboost_filesystem-gcc41-mt-1_35 -lboost_system-gcc41-mt-1_35 -lmotorsport -lmotorsport-sim -lOgreMain -lbulletcollision -lbulletdynamics -lbulletsoftbody -lbulletmath -lBulletColladaConverter -lcolladadom -lOIS -lOgreCollada -lFCollada -lLibXML
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lBulletColladaConverter
Using the .a files directly, i get the initial error:
$ g++ -o motorsport-sim -g -O0 -ggdb3 -Wall -Wno-deprecated -ansi -pedantic --coverage -fprofile-arcs -ftest-coverage -isys
tem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -isystem usr/include/boost-1_35 -fmessage-length=0 -fexceptions -fident -isystem usr/include/OGRE usr/share/motorsport-sim/main.o -Lusr/lib -Lusr/lib -Lusr/lib/motorsport -Lusr/lib/motorsport-sim -Lusr/lib -Lusr/lib -Lusr/lib -lboost_thread-gcc41-mt-1_35 -lboost_filesystem-gcc41-mt-1_35 -lboost_system-gcc41-mt-1_35 -lmotorsport -lmotorsport-sim -lOgreMain usr/lib/*bullet*.a -lOIS -lOgreCollada -lFCollada -lLibXML
usr/lib/motorsport/libmotorsport.so: undefined reference to `btConvexTriangleMeshShape::btConvexTriangleMeshShape(btStridingMeshInterface*)'
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build problems

Post by Erwin Coumans »

It tries to link an obsolete constructor.

Code: Select all

btConvexTriangleMeshShape::btConvexTriangleMeshShape(btStridingMeshInterface*)
Please try to manually edit Bullet/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h, and remove the 'true' from the constructor in line 17, so it will look like:

Code: Select all

	btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb);
Recompile your code, and you should get a compile error. Change your code so it constructs 'btConvexTriangleMeshShape' using a second argument 'false' and recompile/link. By the way, in general it is better to use btConvexHullShape instead of btConvexTriangleMeshShape.

Hope this helps,
Erwin
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: Build problems

Post by stenyak »

Erwin Coumans wrote:It tries to link an obsolete constructor.

Code: Select all

btConvexTriangleMeshShape::btConvexTriangleMeshShape(btStridingMeshInterface*)
Please try to manually edit Bullet/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h, and remove the 'true' from the constructor in line 17, so it will look like:

Code: Select all

	btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb);
Recompile your code, and you should get a compile error.
I've changed that header and recompiled bullet from scratch, and there's no compile error.

You mention that my code should break, but none of my code is using that function, AFAIK. My current code is just a mix of helloWorld + the bare minium to get a collada load function working.
Specifically, this is all the bullet code i'm using from my app. Note that it's almost copy-pasted from the examples:
http://www.motorsport-sim.org/hg/trunk/ ... hysics.cpp
http://www.motorsport-sim.org/hg/trunk/ ... /Physics.h




Anyway, my main problem now, is that there's no BulletColladaConverter, which used to be there... so i either get
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lBulletColladaConverter
Or i get:
usr/lib/motorsport/libmotorsport.so: undefined reference to `ColladaConverter::load(char const*)'
usr/lib/motorsport/libmotorsport.so: undefined reference to `ColladaConverter::ColladaConverter(btDynamicsWorld*)'

I suspect the ColladaConverter is the lib that used to use the convex thingy methods?

Any ideas? Thanks in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build problems

Post by Erwin Coumans »

Which build system to you use to build Bullet and its external libraries?

Can you build the demos that come with Bullet?

Thanks,
Erwin
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: Build problems

Post by stenyak »

I use simple bash for building bullet:

Code: Select all

function bullet
{
    mkcd deps
        echo "==== Installing Bullet ===="
        echo " - Grabbing from svn..."
        svn checkout http://bullet.googlecode.com/svn/trunk bullet
        echo " - Building..."
        cd bullet
            ./configure --prefix=$PWD/../../usr --enable-debug
            jam -j $cpus
            echo " - Copying files..."
            jam install
            find -iname '*.a' |xargs cp -t ../../usr/lib/   #in some previous svn rev, not all libs were being copied, so i did it manually...
        cd ..
        echo "==== Bullet installed ===="
    cd ..
}
And i use scons for my project, but i do nothing special, it amounts in part to the command lines i paste in some of these posts.

The Bullet demos build correctly, but i cannot find any Collada demo, which i recall used to be there. This is the output of running "jam" again after building bullet:

Code: Select all

...patience...
...patience...
...found 2496 target(s)...
...updating 7 target(s)...
C++ ./out/linuxx86/debug/Extras/BulletColladaConverter/ColladaConverter.o 

    g++ -c -o ./out/linuxx86/debug/Extras/BulletColladaConverter/ColladaConverter.o -I. -I./src -I. -pipe -Wall -Wno-unknown-pragmas -fno-exceptions -g3 -fPIC -I./Extras/BulletColladaConverter -I./Extras/COLLADA_DOM/include -I./Extras/COLLADA_DOM/include/1.4 -I./Extras/LibXML -I./Extras/LibXML/include -I./Extras/ConvexHull  Extras/BulletColladaConverter/ColladaConverter.cpp

...failed C++ ./out/linuxx86/debug/Extras/BulletColladaConverter/ColladaConverter.o ...
...skipped libBulletColladaConverter.a for lack of libBulletColladaConverter.a(ColladaConverter.o)...
C++ ./out/linuxx86/debug/Demos/AllBulletDemos/../ConvexDecompositionDemo/ConvexDecompositionDemo.o 

    g++ -c -o ./out/linuxx86/debug/Demos/AllBulletDemos/../ConvexDecompositionDemo/ConvexDecompositionDemo.o -I. -I./src -I. -pipe -Wall -Wno-unknown-pragmas -fno-exceptions -g3 -I./Extras -I./Demos/OpenGL -I./Extras/ConvexDecomposition -I./Extras/ConvexHull -I./Extras/GIMPACT/include -I./Extras/GIMPACTUtils  Demos/AllBulletDemos/../ConvexDecompositionDemo/ConvexDecompositionDemo.cpp

...failed C++ ./out/linuxx86/debug/Demos/AllBulletDemos/../ConvexDecompositionDemo/ConvexDecompositionDemo.o ...
...skipped AllBulletDemos for lack of <Demos!AllBulletDemos!>../ConvexDecompositionDemo/ConvexDecompositionDemo.o...
C++ ./out/linuxx86/debug/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.o 

    g++ -c -o ./out/linuxx86/debug/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.o -I. -I./src -I. -pipe -Wall -Wno-unknown-pragmas -fno-exceptions -g3 -I./Demos/OpenGL -I./Extras/ConvexDecomposition -I./Extras/ConvexHull  Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp

...failed C++ ./out/linuxx86/debug/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.o ...
...skipped ConvexDecompositionDemo for lack of <Demos!ConvexDecompositionDemo!>ConvexDecompositionDemo.o...
...skipped ColladaDemo for lack of libBulletColladaConverter.a...
...failed updating 3 target(s)...
...skipped 4 target(s)...
stenyak
Posts: 29
Joined: Fri Aug 12, 2005 4:59 pm

Re: Build problems

Post by stenyak »

Today, after an svn update, bullet has built correctly from scratch :-)

I've reviewed the changelog, but haven't found the reason it now compiles :?