General Question building bullet in Windows

Ben
Posts: 2
Joined: Wed Apr 02, 2008 10:52 am

General Question building bullet in Windows

Post by Ben »

Hello,

I'm using a 3D-engine for several weeks now and now I want to add collision/dynamics etc. As I was always happy in the past if a program comes with an installer, compiling/building of a new software package is quite new to me.

So now for my problem:
I downloaded and installed (happy... ;-)) cmake.
I ran cmake setup and I think it worked fine with the mingw version which is delivered with CodeBlocks.
As I understand the way it should go, the next step would be to run mingw32-make to build the bullet library.

But the make-process ends with a lot of "undefined reference to..." errors.

I can build and run the main VC-projects (libbulletcollision.vcproj, libbulletdynamics.vcproj, libbulletmath.vcproj) by importing them into CodeBlocks - but when I try the same with a Demo-project like e.g. appCcdPhysicsDemo it ends also with "undefined reference to DemoApplication::DemoApplication", just to mention the first error of unbelievably many.

This results in my general questions:
- Can someone here give me a step-by-step description of the way how bullet is meant to be built, so that I at least would be able to see, at which step I make a mistake?
And how should the final result look like?
Will there be a "C:\BulletPhysics" folder? Or is the engine also placed in "C:\.....\bullet-2.67-new" like the source before the build process?
- Is it right that mingw32-make has to be applied after cmake or does cmake do the whole job on its own?

As you see - I'm lost!

Thanks for your help in advance!
chunky
Posts: 145
Joined: Tue Oct 30, 2007 9:23 pm

Re: General Question building bullet in Windows

Post by chunky »

OK, Well, I'm not a windows guy but I have projects that build on windows.

I'll answer some of the easy ones, and end with how I'm currently building bullet:
- Is it right that mingw32-make has to be applied after cmake or does cmake do the whole job on its own?
That is correct. CMake does *not* build your project, it's a fancy cross-platform way of spitting out files so that something else can be used to build your project. eg, it can spit out unix makefiles, xcode projects, visual whatever projects.
- Can someone here give me a step-by-step description of the way how bullet is meant to be built, so that I at least would be able to see, at which step I make a mistake?
Run cmake. Choose your bullet project stuff, choose your build process ["MinGW Makefiles", for example]. Clicky "configure" a couple times. Clicky "generate". Run your build process. Enjoy.
I cannot strongly enough suggest downloading a recent nightly version of cmake for windows - the version you probably have, 2.4.8, suffers a whole host of issues on windows that have impacted me [not with bullet, mind...], and doesn't come with the new & massively improved GUI bit. Available here: http://www.cmake.org/files/vCVS/
And how should the final result look like?
I suspect you're getting confused. The final output of "bullet" should be a .dll or a .lib on windows. There's nothing to "run", it's a library you link your main project with.
The final output of bullet's demos is a .exe that links with the .dll or .lib. I have never personally built the .exe on windows, but I don't imagine it's that different.
Will there be a "C:\BulletPhysics" folder? Or is the engine also placed in "C:\.....\bullet-2.67-new" like the source before the build process?
It'll all get dropped into your bullet-2.67-new folder. Where in there will depend on what cmake feels like doing, and what you've explicitly told cmake to do.

Regarding your specific linking problems, you're pretty much just asking for pain using vcproj files. Stick with getting cmake to work for you with mingw32


And finally, *my* project. All the libraries I'm using that are of appropriate size and appropriate license [which bullet is very good for!], I have dropped into a libs/ subdir in my project, and using cmake I explicitly build just the library then linky it with the rest of my project, all managed by cmake. My whole cmake files are pretty complicated, so excerpts are here:

Code: Select all

# libs/bullet/CMakeLists.txt
SET(BULLET_SRCS
  # Every C++ src file in bullet is listed here
  #  If you have nonbraindamaged find command [eg mSyS], it's the output of:
  #  find . -name \*.cpp
  # example lines:
LinearMath/btGeometryUtil.cpp
LinearMath/btQuickprof.cpp
)

ADD_LIBRARY(twbullet ${BULLET_SRCS})

Code: Select all

# Top level CMakeLists.txt
INCLUDE_DIRECTORIES(
  # Every dir in bullet is listed here
  #  If you have nonbraindamaged find command [eg mSyS], it's the output of:
  #  find libs/bullet/ -type d
  # example lines:
libs/bullet/BulletDynamics/Vehicle/
libs/bullet/LinearMath/
)

# This line comes under the above INCLUDE_DIRECTORIES
SUBDIRS(libs/bullet/)

SET(TW_LIBRARIES
    twbullet
    all_my_other_libraries)

TARGET_LINK_LIBRARIES(TuxWars ${TW_LIBRARIES})
Hope that helps a bit,
Gary (-;
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: General Question building bullet in Windows

Post by Erwin Coumans »

Ben wrote:I can build and run the main VC-projects (libbulletcollision.vcproj, libbulletdynamics.vcproj, libbulletmath.vcproj) by importing them into CodeBlocks - but when I try the same with a Demo-project like e.g. appCcdPhysicsDemo it ends also with "undefined reference to DemoApplication::DemoApplication", just to mention the first error of unbelievably many.
If you want to build the demos, you need to include a few additional libraries (depends on each demo).

At least you need to include libbulletopenglsupport and glut, apart from the 3 core bullet libraries.
If there is still linking errors, make sure they are in the right order (openglsupport, dynamics,collision,math). Just open up the visual studio solution (msvc/8/wksbullet.sln and check out the project _dependencies_) to see what each demo needs).

Hope this helps,
Erwin
Ben
Posts: 2
Joined: Wed Apr 02, 2008 10:52 am

Re: General Question building bullet in Windows

Post by Ben »

First of all: thank you for your immediate and detailed answer -
to respond to your last hopings: yes, it does!

The best hint, at first, was the cmake\CVS thing. I had already read about some 2.6 version which could additionally produce CodeBlocks-projects besides e.g. MinGW-makefiles, but I just couldn't find these newer versions - so thanks for that.

And this is also my main success in the meanwhile: because I was able now to get the whole bullet into a CodeBlocks structure, I can build different targets like demos seperately now. This seems to be important, because the "all"-target leads to the same errors as before. And still, so does the mingw32-make command, too. (Perhaps this has to do with the order of the built libs, as Erwin mentioned?)
chunky: I suspect you're getting confused. The final output of "bullet" should be a .dll or a .lib on windows. There's nothing to "run", it's a library you link your main project with.
The final output of bullet's demos is a .exe that links with the .dll or .lib. I have never personally built the .exe on windows, but I don't imagine it's that different.
What I expected was a rather "structured" and clean (without sources e.g.) "BulletEngine-Folder", where only the needed headers and librarys live. I had this thought probably because I saw a parameter in CMake called target/destination or something like that, which had the value "C:\Programme\BulletPhysics".
So I thought I'm wrong with my attempts until exactly this folder appears. :-)

To be honest: The cmakelists hints are still a bit complex to me - I'll keep in mind that they're here, just for the case...
As the demos run nearly all as I expected them to do, I'd rather get into understanding of some first selfmade examples.

And exactly this is my next problem: I think I have the same issues like other's already had - the demos are confusing to me, as they spread over a lot of cpp-files and headers.

I still have no idea, what the elementary, "helloworld"-like bullet-app would look like and what it has to contain.
But this doesn't really fit to the topic anymore so again:
thanks a lot - this was a really nice welcome for me in this forum!

Ben
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: General Question building bullet in Windows

Post by Erwin Coumans »

And exactly this is my next problem: I think I have the same issues like other's already had - the demos are confusing to me, as they spread over a lot of cpp-files and headers.

I still have no idea, what the elementary, "helloworld"-like bullet-app would look like and what it has to contain.
But this doesn't really fit to the topic anymore so again:
thanks a lot - this was a really nice welcome for me in this forum!
Please start with the Bullet_User_Manual.pdf (included in Bullet source zipfile). It has some explanation for most demos.

Then check out all demos (AllBulletDemos is a good start), and in particular
Bullet\Demos\HelloWorld\HelloWorld.cpp, a very minimal demo without graphics
Bullet\Demos\HelloWorld\BasicDemo.cpp, a minimal demo just simulating some boxes


Hope this helps,
Erwin
Midnight
Posts: 1
Joined: Fri Jun 27, 2008 3:32 pm

Re: General Question building bullet in Windows

Post by Midnight »

this is what I did to compile the basic bullet static libs in codeblocks with mingw.

The bullet SDK comes supplied with visual C++/studio project files using these project files you can import them into codeblocks and most of them seem to compile just fine. the visual c++ 6 project files report errors about something depricated so I wouldn't suggest using those without being slightly concerned about the reported errors.

hopefully this saves someone the frustration I had of wasting an entire day to discover this very simple process. good luck and god speed!

8)

EDIT: this is creating segfaults in my application.. idk if it's the code I'm using or the codeblocks build but I might try to compare it against a home made cb project.. can anyone conferm this problem also?

UPDATE: I've have one confirmation about importing these project files causing the segfault.. so use them to figure out how to make you own projects and you should be ok.