Google

Building OgreBullet with OgreSDK 1.8.1 on Windows.

Discussion about the Bullet binding layer, OgreBullet

Moderators: OGRE Team, OgreBullet Moderators

Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby Laubstein » Mon Jan 07, 2013 2:51 pm

Hi! It is gonna be a newbie tutorial for all the people lost which are trying to build OgreBullet.

This tutorial will use the following libraries on Windows.
[list=]OgreSDK 1.8.1
Bullet 2.8.1
OgreBullet from Trunk <- Since we are using the latest release, things can change in the future.[/list]

PS: I will assume you already has the OgreSDK in your system.

First of all we will need to access the trunk source of OgreBullet so I suggest you to download Tortoise at: http://tortoisesvn.net/downloads.html
Install it. Now you can access some tortoise's functions clicking with the mouse's right button on Internet Explorer window.

Create a folder named OgreBullet, inside the folder right click and choose "SVN checkout". In the field "URL repository" put: https://ogreaddons.svn.sourceforge.net/ ... ogrebullet and click "Ok". While downloading you can go to pee.

Now we will need to download the Bullet source at: http://code.google.com/p/bullet/downloa ... ev2613.zip
Extract it in a folder named Bullet :p

Now we will download a nice tool to help us set up Bullet to be build and its name is CMAKE. Download it at: http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe
Install it.

Now let's create an enviroment variables. What is an enviroment variable: http://www.itechtalk.com/thread3595.html

Name: BULLET_ROOT
Value: the path you extracted Bullet.

Now Let's launch CMAKE i guess the installer has created a shortcut in the desktop.

At the CMAKE window in "Where is the source code"
put: D:/Bullet/bullet-2.81-rev2613 <- It is the path where my Bullet's folder is, so change it to fit yours.
In the field "Where to build binaries"
put D:\Bullet\bullet-2.81-rev2613\build\cmakebuild <- change the path again. If the folder "cmakebuild" does not exists just create it.

Close all instances of Visual Studio and click on the "Configure" button. In the next window in "Specify the generator for this project" choose the version of your Visual Studio and click "Finish"
A lot of parameters will appears, search for "USE_MSVC_RUNTIME_LIBRARY_DLL and check it (it is very important).
Now click "Generate" and pray.
Now open the solution at D:\Bullet\bullet-2.81-rev2613\build\cmakebuild\BULLET_PHYSICS.sln
Build the release and debug: http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
Everything must build fine.

Now open the solution at D:\OgreBullet\OgreBullet_VC8.sln

Right click in the Dynamics_Demos
in Additional Include Directories leave as:
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
..\..\include
..\..\..\include
..\..\..\..\Collisions\include
..\..\..\..\Dynamics\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
$(OGRE_HOME)\include
$(OGRE_HOME)\include\OIS


In Linker -> Additional library directories leave as:

..\..\..\..\lib\$(Configuration)
$(OGRE_HOME)\lib\$(Configuration)
$(OGRE_HOME)\boost\lib
$(BULLET_ROOT)\lib


In Linker -> Input:

OgreMain.lib
ois.lib
OgreBulletCollisions.lib
OgreBulletDynamics.lib
BulletCollision.lib
BulletDynamics.lib
LinearMath.lib
ConvexDecomposition.lib


Ps: In debug mode change OgreMain.lib to OgreMain_d.lib, ois.lib to ois_d.lib and append _debug.lib in the remainder.

Apply the changes:

Now let's configure the OgreBulletCollisions. Additional Include Directories leave as:

..\..\include
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost


Now let's configure the OgreBulletDynamics. Additional Include Directories leave as:

..\..\include
..\..\..\Collisions\include
$(BULLET_ROOT)\src
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost

Apply the changes:

Now open the OgreBulletDynamicsWorld.cpp and change the line:

Code: Select all
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0()); // For older Bullet versions (original code)
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1()); // For older Bullet versions (original code)


to

Code: Select all
#if BT_BULLET_VERSION>=281
   btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());; // For newer Bullet versions
   btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1()); // For newer Bullet versions
#else
   btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0()); // For older Bullet versions (original code)
   btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1()); // For older Bullet versions (original code)
#endif


Now in OgreBulletCollisionsRay.cpp change the line:

Code: Select all
return mWorld->findObject(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject);


to:

Code: Select all
#if BT_BULLET_VERSION>=281
   return mWorld->findObject(const_cast<btCollisionObject*>(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject));
#else
   return mWorld->findObject(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject);
#endif


Now in OgreBulletCollisionsWorld.cpp change the line:

Code: Select all
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());


to:

Code: Select all
btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1());


Finally We are able to build in release and debug mode.

Now you are able to use the static libs to link into your projects. To test the OgreBulletDemo copy the "OgreBulletDynamicsDemo.exe" in
D:\OgreBullet\Demos to your OgreSDK/bin/release.

Open the resource.cfg and add the following lines:

[Bootstrap]
Zip=D:/OgreBullet/Demos/Media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
......
FileSystem=D:/OgreBullet/Demos/Media
FileSystem=D:/OgreBullet/Demos/Media/fonts
FileSystem=D:/OgreBullet/Demos/Media/materials/programs
FileSystem=D:/OgreBullet/Demos/Media/materials/scripts
FileSystem=D:/OgreBullet/Demos/Media/materials/textures
FileSystem=D:/OgreBullet/Demos/Media/models
FileSystem=D:/OgreBullet/Demos/Media/overlays
FileSystem=D:/OgreBullet/Demos/Media/particle
FileSystem=D:/OgreBullet/Demos/Media/gui

[Bullet]
FileSystem=D:/OgreBullet/Demos/Media/OgreBullet
FileSystem=D:/OgreBullet/Demos/Media/materials
FileSystem=D:/OgreBullet/Demos/Media/textures


PS: Remember to change the "D:/OgreBullet/Demos" path to fit yours.

Now click in OgreBulletDynamicsDemo.exe and it is done!

For this message the author Laubstein has received kudos
User avatar
Laubstein
Gnoblar
 
Posts: 8
Kudos: 2
Joined: 03 Jan 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby holocronweaver » Sat Feb 09, 2013 4:54 pm

Thanks for the great guide!

Would you mind submitting the OgreBullet patch to the SVN so that newcomers won't have to deal with modifying code when they want to use a newer version of Bullet?
holocronweaver
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 09 Feb 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby aj1nkya » Sun Feb 17, 2013 9:20 am

I have appened debug to
OgreBulletCollisions.lib
OgreBulletDynamics.lib
BulletCollision.lib
BulletDynamics.lib
LinearMath.lib
ConvexDecomposition.lib

but i get linker error. I checked $(BULLET_ROOT)\lib its empty. And so the OgreBullet/lib
There are no above lib files
aj1nkya
Gnoblar
 
Posts: 9
Kudos: 0
Joined: 17 Feb 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby MaskedTwilight » Wed May 15, 2013 11:46 pm

I don't understand the directories for this part

..\..\include
..\..\..\include
..\..\..\..\Collisions\include
..\..\..\..\Dynamics\include
MaskedTwilight
Gnoblar
 
Posts: 2
Kudos: 0
Joined: 15 May 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby AlexeyKnyshev » Thu May 16, 2013 12:09 pm

MaskedTwilight wrote:I don't understand the directories for this part

..\..\include
..\..\..\include
..\..\..\..\Collisions\include
..\..\..\..\Dynamics\include


Those are relative paths. Maybe you can try CMake building scripts for OgreBullet.
Voltage Engine - boost your ogre project with realtime physics and interactive scripting!
OgreBullet & CMake - easy to use bullet physics integration.
AlexeyKnyshev
OGRE Moderator
 
Posts: 81
Kudos: 5
Joined: 15 Feb 2013
Location: Russia

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby NotCamelCase » Thu Jun 27, 2013 10:53 am

Laubstein wrote:In Linker -> Input:

OgreMain.lib
ois.lib
OgreBulletCollisions.lib
OgreBulletDynamics.lib
BulletCollision.lib
BulletDynamics.lib
LinearMath.lib
ConvexDecomposition.lib


Ps: In debug mode change OgreMain.lib to OgreMain_d.lib, ois.lib to ois_d.lib and append _debug.lib in the remainder.


Thanks for the guide ! BTW I think I found a typo (or correction for current rel), the suffix "_Debug" must be appended to Bullet library names, like BulletDynamics_Debug, not _debug.
NotCamelCase
Gnoblar
 
Posts: 3
Kudos: 0
Joined: 27 Jun 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby RafetDurgut » Tue Jul 02, 2013 3:42 pm

Hi, I did all thing but;
LINK : fatal error LNK1104: cannot open file 'OgreBulletCollisions_d.lib'

I can't see these files at https://ogreaddons.svn.sourceforge.net/ ... lib/Debug/
RafetDurgut
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 02 Jul 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby petersvp » Tue Jul 02, 2013 6:14 pm

The tutorial have missing step, you have to COPY libs from /cmakebuild/lib to the bullet/lib, else linker will fail

FATAL:
I also get:

1> Creating library ..\..\..\Dynamics_Demos.lib and object ..\..\..\Dynamics_Demos.exp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>..\..\..\OgreBulletDynamicsDemo.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

If I add /NODEFAULTLIB:LIBCMT

1>------ Build started: Project: Dynamics_Demos, Configuration: Release Win32 ------
...
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base0::_Orphan_all(void)" (?_Orphan_all@_Container_base0@std@@QAEXXZ) already defined in ConvexDecomposition.lib(vlookup.obj)
1> Creating library ..\..\..\Dynamics_Demos.lib and object ..\..\..\Dynamics_Demos.exp
1>..\..\..\OgreBulletDynamicsDemo.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

NEVERMIND, it was /MD & /MDd issue, wrong settings, AS USUAL ;]
petersvp
Gnoblar
 
Posts: 2
Kudos: 0
Joined: 02 Jul 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby PoulpyBlast » Tue Jul 16, 2013 3:15 pm

petersvp wrote:1>------ Build started: Project: Dynamics_Demos, Configuration: Release Win32 ------
...
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base0::_Orphan_all(void)" (?_Orphan_all@_Container_base0@std@@QAEXXZ) already defined in ConvexDecomposition.lib(vlookup.obj)
1> Creating library ..\..\..\Dynamics_Demos.lib and object ..\..\..\Dynamics_Demos.exp
1>..\..\..\OgreBulletDynamicsDemo.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

NEVERMIND, it was /MD & /MDd issue, wrong settings, AS USUAL ;]


Hi everyone and thanks for this good explanation, I'm trying to build OgreBullet for almost one week and I was going slightly crazy !
But I still got this "Already defined" error... and I don't understand how you managed to correct it. :? Can someone explain it to me, please ?
PoulpyBlast
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 16 Jul 2013

Re: Building OgreBullet with OgreSDK 1.8.1 on Windows.

Postby AE86takumi » Tue Aug 06, 2013 10:41 am

Hi, I have the same issue as PoulpyBlast:

Code: Select all
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\zPRACTICUM\OgreBullet\Demos\Dynamics_Demos\scripts\VC8\..\..\..\Dynamics_Demos.exe) does not match the Linker's OutputFile property value (C:\zPRACTICUM\OgreBullet\Demos\OgreBulletDynamicsDemo_d.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(992,5): warning MSB8012: TargetName(Dynamics_Demos) does not match the Linker's OutputFile property value (OgreBulletDynamicsDemo_d). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
3>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in ConvexDecomposition_vs2010_debug.lib(vlookup.obj)
3>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in ConvexDecomposition_vs2010_debug.lib(vlookup.obj)
3>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in ConvexDecomposition_vs2010_debug.lib(vlookup.obj)
3>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: struct std::_Iterator_base12 * * __thiscall std::_Container_base12::_Getpfirst(void)const " (?_Getpfirst@_Container_base12@std@@QBEPAPAU_Iterator_base12@2@XZ) already defined in ConvexDecomposition_vs2010_debug.lib(vlookup.obj)
3>     Creating library ..\..\..\Dynamics_Demos.lib and object ..\..\..\Dynamics_Demos.exp
3>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
3>..\..\..\OgreBulletDynamicsDemo_d.exe : fatal error LNK1169: one or more multiply defined symbols found


Adding /NODEFAULTLIB:LIBCMT for release and /NODEFAULTLIB:LIBCMTD for debug in the Linker Command Line only gets rid of the LNK4098 warning. The LNK2005 errors remain.

If you're wondering why it's "ConvexDecomposition_vs2010_debug.lib", that's because I used the vs2010 .sln included with bullet 2.81. After building the project it outputs those lib files to \Bullet\lib.

I change the /MT and /MTd settings as suggested in another thread but that created other problems. Please go to the following link http://www.ogre3d.org/addonforums/viewtopic.php?f=12&t=29787&start=15#p101815 (not sure why there are 2 threads for the same guide).
Any help would be appreciated.
AE86takumi
Gnoblar
 
Posts: 13
Kudos: 0
Joined: 06 Aug 2013


Return to OgreBullet

Who is online

Users browsing this forum: No registered users and 2 guests