Please help with Makefile problem

mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Please help with Makefile problem

Post by mohican »

Hello there!
I integrated the Bullet Engine into our application by writing a wrapper file (bullet.cpp).
I had no issue compiling the application in VS2005, but in Linux I cant get our makefile to work.

Since on the other hand I was able to build the bullet linux libs by following the instructions that came in the manual, I am convinced it is just something not right with the makefile.... but I cant put my finger on exactly what.
I get bunch of errors in the style of:

./Core/bullet.o: In function `Bullet_CreateDynamicObject(int)':
bullet.cpp:(.text+0x1fc3): undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
bullet.cpp:(.text+0x24ee): undefined reference to `vtable for btRigidBody'
bullet.cpp:(.text+0x254b): undefined reference to `btCollisionObject::~btCollisionObject()'
bullet.cpp:(.text+0x25c4): undefined reference to `btAlignedFreeInternal(void*)'
bullet.cpp:(.text+0x25d3): undefined reference to `btCollisionObject::~btCollisionObject()'


The makefile worked well before, and the only lines I added were (based on looking at the demos makefile):

CORE_LDADD=-L./libs/Bullet -lbulletdynamics -lbulletcollision -lbulletmath
CORE_CXXFLAGS=-I./libs/Bullet $(CXXFLAGS)

DEDICATED_CORE_LDADD=-L./libs/Bullet -lbulletdynamics -lbulletcollision -lbulletmath
DEDICATED_CORE_CXXFLAGS=-I./libs/Bullet $(CXXFLAGS)


I have attached the makefile, and build log.
The applications that reference the bullet engine are CORE and DEDICATED_CORE

Could anyone kindly take a look and let me know what is wrong? Many thanks
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Please help with Makefile problem

Post by Erwin Coumans »

mohican wrote: CORE_LDADD=-L./libs/Bullet -lbulletdynamics -lbulletcollision -lbulletmath
You need to add this 'CORE_LDADD' to your existing linker flags, right now the Bullet libraries are not in the final linking stage:

Code: Select all

g++ -m32 `pkg-config --libs glib-2.0 libpng` -lm `sdl-config --libs` -lz -ljpeg `freetype-config --libs` `curl-config --libs` -L./libs -Wl,-rpath,./libs -lfmodex -lGL -lGLU -lGLEW -Wl,-s,-O3 ./Core/allocator.o ./Core/bans.o ./Core/bink_unix.o ./Core/bitmap.o ./Core/bsp.o ./Core/buddies.o ./Core/bullet.o ./Core/camerautils.o ./Core/client_le.o ./Core/clipboard.o ./Core/cmd.o ./Core/colorutils.o ./Core/console.o ./Core/cookie.o ./Core/cvar.o ./Core/cvar_container.o ./Core/drawutils.o ./Core/euler.o ./Core/eval.o ./Core/file.o ./Core/font.o ./Core/geom.o ./Core/gl_console.o ./Core/gl_extensionslinux.o ./Core/gl_main.o ./Core/gl_model.o ./Core/gl_scene.o ./Core/gl_scene_builder.o ./Core/gl_sdl.o ./Core/gl_terrain.o ./Core/gl_water.o ./Core/glsl.o ./Core/gui.o ./Core/gui_drawutils.o ./Core/gui_panel.o ./Core/hash.o ./Core/heap.o ./Core/host.o ./Core/host_getcoreapi.o ./Core/http.o ./Core/input.o ./Core/input_sdl.o ./Core/intersection.o ./Core/jpeg.o ./Core/keyclient.o ./Core/main_sdl.o ./Core/main_linux.o ./Core/mem.o ./Core/misc_cmds.o ./Core/navmesh.o ./Core/navpoly.o ./Core/navrep.o ./Core/net.o ./Core/net_bsdsock.o ./Core/net_deltastructs.o ./Core/net_irc.o ./Core/net_server.o ./Core/net_tcp.o ./Core/net_unix.o ./Core/packet.o ./Core/parsestats.o ./Core/quadtree.o ./Core/res.o ./Core/savage_common.o ./Core/savage_mathlib.o ./Core/scene.o ./Core/server_le.o ./Core/serverlist.o ./Core/set.o ./Core/sound_fmod.o ./Core/stringtable.o ./Core/theora_win32.o ./Core/timeofday.o ./Core/ts_terrain.o ./Core/unzip.o ./Core/vid.o ./Core/vid_sdl.o ./Core/world.o ./Core/world_lights.o ./Core/world_objectgrid.o ./Core/world_objects.o ./Core/world_tree2.o ./Core/zip.o ./Core/redblack_tree_xr.o ./keyserver/ssl-utils.o ./Core/trigger/CAABoxTrigger.o ./Core/trigger/CAABoxTriggerFactory.o ./Core/trigger/CAAPlaneTrigger.o ./Core/trigger/CAAPlaneTriggerFactory.o ./Core/trigger/CIntervalTrigger.o ./Core/trigger/CIntervalTriggerFactory.o ./Core/trigger/CPSphereTrigger.o ./Core/trigger/CPSphereTriggerFactory.o ./Core/trigger/CSilverbackFileReader.o ./Core/trigger/CTriggerManager.o ./Core/trigger/ITriggerFactoryMethod.o ./Core/trigger/triggers.o -o silverback.bin
You could try to add them the linker flags like this (just before the line 'default: debug'):

Code: Select all

GAME_LFLAGS += CORE_LDADD
DEDICATED_CORE_LDADD += DEDICATED_CORE_LDADD
Hope this helps,
Erwin
mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Re: Please help with Makefile problem

Post by mohican »

Thx for the quick reply!

I modified the makefile and got the libs into the g++ command:

Code: Select all

g++ -m32 `pkg-config --libs glib-2.0 libpng` -lm `sdl-config --libs` -lz -ljpeg `freetype-config --libs` `curl-config --libs` -L./libs -Wl,-rpath,./libs -lfmodex -lGL -lGLU -lGLEW -L./libs/Bullet -Wl,-rpath,./libs/Bullet -lbulletdynamics -lbulletcollision -lbulletmath -Wl,-s,-O3 ./Core/allocator.o ./Core/bans.o ./Core/bink_unix.o ./Core/bitmap.o ./Core/bsp.o ./Core/buddies.o ./Core/bullet.o ./Core/camerautils.o ./Core/client_le.o ./Core/clipboard.o ./Core/cmd.o ./Core/colorutils.o ./Core/console.o ./Core/cookie.o ./Core/cvar.o ./Core/cvar_container.o ./Core/drawutils.o ./Core/euler.o ./Core/eval.o ./Core/file.o ./Core/font.o ./Core/geom.o ./Core/gl_console.o ./Core/gl_extensionslinux.o ./Core/gl_main.o ./Core/gl_model.o ./Core/gl_scene.o ./Core/gl_scene_builder.o ./Core/gl_sdl.o ./Core/gl_terrain.o ./Core/gl_water.o ./Core/glsl.o ./Core/gui.o ./Core/gui_drawutils.o ./Core/gui_panel.o ./Core/hash.o ./Core/heap.o ./Core/host.o ./Core/host_getcoreapi.o ./Core/http.o ./Core/input.o ./Core/input_sdl.o ./Core/intersection.o ./Core/jpeg.o ./Core/keyclient.o ./Core/main_sdl.o ./Core/main_linux.o ./Core/mem.o ./Core/misc_cmds.o ./Core/navmesh.o ./Core/navpoly.o ./Core/navrep.o ./Core/net.o ./Core/net_bsdsock.o ./Core/net_deltastructs.o ./Core/net_irc.o ./Core/net_server.o ./Core/net_tcp.o ./Core/net_unix.o ./Core/packet.o ./Core/parsestats.o ./Core/quadtree.o ./Core/res.o ./Core/savage_common.o ./Core/savage_mathlib.o ./Core/scene.o ./Core/server_le.o ./Core/serverlist.o ./Core/set.o ./Core/sound_fmod.o ./Core/stringtable.o ./Core/theora_win32.o ./Core/timeofday.o ./Core/ts_terrain.o ./Core/unzip.o ./Core/vid.o ./Core/vid_sdl.o ./Core/world.o ./Core/world_lights.o ./Core/world_objectgrid.o ./Core/world_objects.o ./Core/world_tree2.o ./Core/zip.o ./Core/redblack_tree_xr.o ./keyserver/ssl-utils.o ./Core/trigger/CAABoxTrigger.o ./Core/trigger/CAABoxTriggerFactory.o ./Core/trigger/CAAPlaneTrigger.o ./Core/trigger/CAAPlaneTriggerFactory.o ./Core/trigger/CIntervalTrigger.o ./Core/trigger/CIntervalTriggerFactory.o ./Core/trigger/CPSphereTrigger.o ./Core/trigger/CPSphereTriggerFactory.o ./Core/trigger/CSilverbackFileReader.o ./Core/trigger/CTriggerManager.o ./Core/trigger/ITriggerFactoryMethod.o ./Core/trigger/triggers.o -o silverback.bin
However, it still errors out with the same undefined reference messages.
I have attached the latest makefile and log.
P.S: I have tried with and without the line < -Wl,-rpath,./libs/Bullet > The result was the same.
You do not have the required permissions to view the files attached to this post.
mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Re: Please help with Makefile problem

Post by mohican »

Erwin, I still cant compile my program.
Would you mind checking the log and makefile I posted in my previous reply?
mohican
Posts: 17
Joined: Mon Aug 25, 2008 5:12 pm

Re: Please help with Makefile problem

Post by mohican »

I finally found the solution to my problem, after reading this thread!

Basically, the Bullet libs need to be specified AFTER the *.o files.