[SVN] Linking errors with AppConvexDecompositionDemo

elLolo
Posts: 14
Joined: Thu Dec 11, 2008 2:18 pm

[SVN] Linking errors with AppConvexDecompositionDemo

Post by elLolo »

Hello,

I tried to build Bullet from SVN revision 1908 but it fails with the following error on Fedora 12 - 64 bits:

Code: Select all

Linking CXX executable AppConvexDecompositionDemo
cd /local/laguerre/Bullet/Demos/ConvexDecompositionDemo && /usr/bin/cmake -E cmake_link_script CMakeFiles/AppConvexDecompositionDemo.dir/link.txt --verbose=1
/usr/bin/c++   -fPIC -O3 -DNDEBUG  -fPIC CMakeFiles/AppConvexDecompositionDemo.dir/main.o CMakeFiles/AppConvexDecompositionDemo.dir/ConvexDecompositionDemo.o  -o AppConvexDecompositionDemo -rdynamic ../OpenGL/libOpenGLSupport.a ../../src/BulletDynamics/libBulletDynamics.a ../../src/BulletCollision/libBulletCollision.a ../../src/LinearMath/libLinearMath.a ../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a ../../Extras/ConvexDecomposition/libConvexDecomposition.a -lglut -lGL -lGLU 
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFileLoader.o): In function `btBulletFileLoader::createCylinderShapeY(float, float)':
btBulletFileLoader.cpp:(.text+0xda): undefined reference to `btCylinderShape::btCylinderShape(btVector3 const&)'
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFileLoader.o): In function `btBulletFileLoader::createCapsuleShape(float, float)':
btBulletFileLoader.cpp:(.text+0x141): undefined reference to `btCapsuleShape::btCapsuleShape(float, float)'
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFileLoader.o): In function `btBulletFileLoader::loadFileFromMemory(bParse::btBulletFile*)':
btBulletFileLoader.cpp:(.text+0xd51): undefined reference to `btMultiSphereShape::btMultiSphereShape(btVector3 const*, float const*, int)'
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFile.o): In function `bParse::btBulletFile::btBulletFile()':
btBulletFile.cpp:(.text+0xa21): undefined reference to `sBulletDNAlen'
btBulletFile.cpp:(.text+0xa28): undefined reference to `sBulletDNAstr'
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [Demos/ConvexDecompositionDemo/AppConvexDecompositionDemo] Erreur 1
It seems that the CMakeList.txt file in Extras/Serialize/BulletFileLoader does not try to link BulletFileLoader with anything. So I added the following lines right after the ADD_LIBRARY macro to get it fixed:

Code: Select all

TARGET_LINK_LIBRARIES(
	BulletFileLoader
	BulletDynamics
	BulletCollision
	LinearMath
)
Now, I can build Bullet.

Please note also that the link_libraries macro is deprecated and that target_link_libraries should be used instead. In addition, the target_link_libraries macro is supposed to be added after add_executable. For instance, the CMakeLists.txt file from Demos/ConvexDecompositionDemo/ would contain:

Code: Select all

IF (USE_GLUT)

	ADD_EXECUTABLE(AppConvexDecompositionDemo
		main.cpp
		ConvexDecompositionDemo.cpp 
		ConvexDecompositionDemo.h
	)

	TARGET_LINK_LIBRARIES(AppConvexDecompositionDemo
		OpenGLSupport  BulletDynamics  BulletCollision LinearMath  BulletFileLoader ConvexDecomposition ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
	)
ELSE (USE_GLUT)

	ADD_EXECUTABLE(AppConvexDecompositionDemo
		WIN32
		../OpenGL/Win32AppMain.cpp
		ConvexDecompositionDemo.cpp 
		ConvexDecompositionDemo.h
		Win32ConvexDecompositionDemo.cpp
	)

	TARGET_LINK_LIBRARIES(AppConvexDecompositionDemo
		OpenGLSupport  BulletDynamics  BulletCollision LinearMath BulletFileLoader  ConvexDecomposition ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
	)
	
ENDIF (USE_GLUT)
Regards,
Laurent.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: [SVN] Linking errors with AppConvexDecompositionDemo

Post by Erwin Coumans »

The link order was likely wrong. BulletFileLoader depends on BulletDynamics, BulletCollision and LinearMath at the moment, so it has to appear first in the list.
(we look into TARGET_LINK_LIBRARIES in Bullet 3.x, and also break up the BulletFileLoader library for fewer dependencies)

Could you please try out latest trunk?
Thanks a lot,
Erwin
elLolo
Posts: 14
Joined: Thu Dec 11, 2008 2:18 pm

Re: [SVN] Linking errors with AppConvexDecompositionDemo

Post by elLolo »

Not enough :-)

Code: Select all

make[2]: Entering directory `/local/laguerre/Bullet'
Linking CXX executable AppSerializeDemo
cd /local/laguerre/Bullet/Demos/SerializeDemo && /usr/bin/cmake -E cmake_link_script CMakeFiles/AppSerializeDemo.dir/link.txt --verbose=1
/usr/bin/c++   -fPIC -O3 -DNDEBUG  -fPIC CMakeFiles/AppSerializeDemo.dir/main.o CMakeFiles/AppSerializeDemo.dir/SerializeDemo.o  -o AppSerializeDemo -rdynamic ../OpenGL/libOpenGLSupport.a ../../src/BulletDynamics/libBulletDynamics.a ../../src/BulletCollision/libBulletCollision.a ../../src/LinearMath/libLinearMath.a ../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a -lglut -lGL -lGLU 
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFileLoader.o): In function `btBulletFileLoader::createCylinderShapeY(float, float)':
btBulletFileLoader.cpp:(.text+0xda): undefined reference to `btCylinderShape::btCylinderShape(btVector3 const&)'
../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a(btBulletFileLoader.o): In function `btBulletFileLoader::loadFileFromMemory(bParse::btBulletFile*)':
btBulletFileLoader.cpp:(.text+0x5e8): undefined reference to `vtable for btTriangleIndexVertexArray'
btBulletFileLoader.cpp:(.text+0xd51): undefined reference to `btMultiSphereShape::btMultiSphereShape(btVector3 const*, float const*, int)'
btBulletFileLoader.cpp:(.text+0xe92): undefined reference to `btConvexHullShape::btConvexHullShape(float const*, int, int)'
collect2: ld returned 1 exit status
make[2]: *** [Demos/SerializeDemo/AppSerializeDemo] Error 1
make[2]: Leaving directory `/local/laguerre/Bullet'
make[1]: *** [Demos/SerializeDemo/CMakeFiles/AppSerializeDemo.dir/all] Error 2
make[1]: Leaving directory `/local/laguerre/Bullet'
BTW, you may also want to fix these warnings:

Code: Select all

[ 82%] Building CXX object Extras/Serialize/BulletFileLoader/CMakeFiles/BulletFileLoader.dir/bFile.o
/local/laguerre/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp: In member function ‘void bParse::bFile::resolvePointersStructRecursive(char*, int, bool, int)’:
/local/laguerre/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp:833: attention : deprecated conversion from string constant to ‘char*’
/local/laguerre/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp:854: attention : deprecated conversion from string constant to ‘char*’
and

Code: Select all

[ 94%] Building CXX object Demos/ConvexDecompositionDemo/CMakeFiles/AppConvexDecompositionDemo.dir/ConvexDecompositionDemo.o
/local/laguerre/Bullet/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp: In member function ‘void ConvexDecompositionDemo::initPhysics(const char*)’:
/local/laguerre/Bullet/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp:506: attention : deprecated conversion from string constant to ‘char*’
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: [SVN] Linking errors with AppConvexDecompositionDemo

Post by Erwin Coumans »

Thanks for the report again, both issues should be sorted in latest trunk.

Thanks,
Erwin
elLolo
Posts: 14
Joined: Thu Dec 11, 2008 2:18 pm

Re: [SVN] Linking errors with AppConvexDecompositionDemo

Post by elLolo »

Everything is fine, now. Thanks you!

Still a warning:

Code: Select all

[ 33%] Building CXX object Extras/Serialize/BulletFileLoader/CMakeFiles/BulletFileLoader.dir/bFile.o
/local/laguerre/OpenMASK4/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp: In member function ‘void bParse::bFile::resolvePointersStructRecursive(char*, int, bool, int)’:
/local/laguerre/OpenMASK4/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp:833: attention : deprecated conversion from string constant to ‘char*’
/local/laguerre/OpenMASK4/Bullet/Extras/Serialize/BulletFileLoader/bFile.cpp:854: attention : deprecated conversion from string constant to ‘char*’
Laurent.