Shihui Guo

Compiling Bullet project with command line

Follow the instructions on Bullet wikipage to compile and install the libraries

mkdir bullet-build
cd bullet-build
cmake ../path/to/bullet -G "Unix Makefiles"
make -j4
sudo make install

libBulletDynamics.a/libBulletCollision.a/libLinearMath.a/libBulletSoftBody should be installed in your local library path, which should be /usr/local/lib/

The headers, originally in src/, are now installed in local header path, which should be /usr/local/inc/

Choose one demo, and copy the original files (.cpp and .h) to a new dir, and first compile. Here we choose the RagdollDemo:

gcc -I/Path to Bullet/Demos/OpenGL -I/usr/local/include/bullet/ -c main.cpp
gcc -I/Path to Bullet/Demos/OpenGL -I/usr/local/include/bullet/ -c RagdollDemo.cpp

Then link:

gcc main.o RagdollDemo.o -o AppRagdollDemo -lOpenGLSupport -lBulletDynamics -lBulletCollision -lLinearMath -lstdc++ -lglut -lGL -lGLU -L/usr/local/lib/ -L/Path to bullet/Demos/OpenGL/ -L/Path to bullet/Glut (Please notice these two special folder which contain the libraries of glut/GL/GLU)

Then the executable file should be under this dir. Hope this helps.

Note: Bullet provide the Glut/GL/ folder, you may not want to add this to the compile process, because it might lead to conflict with your existing GL files.

The reason I want to do it in command line is that you are forced to specify every parameter, by this way you get a clear idea of what is needed in this process. The best way to learn.