building bullet on Solaris

Noehrgel
Posts: 10
Joined: Mon Aug 21, 2006 5:11 am

building bullet on Solaris

Post by Noehrgel »

I need bullet on solaris and building was some pain therefore I want to share my experiences (and hopefully get some feedback). I started with 2.20a and just applied the following actions to 2.24 with the same result (working bullet libs)

Using the usual configure approach didn't get me anywhere but cmake was some kind of help. The following is what I did:
  • remove Extras and Demos from bullet-2.4/CMakeLists.txt
  • added

    Code: Select all

    return false;
    to src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp in line 104 (got error: expected to return a value)
  • in src/LinearMath/btQuickprof.h I added

    Code: Select all

    #if defined (SUNOS) || defined (__SUNOS__)
            #include <stdio.h>
    #endif
    as sprintf was missing.
  • I added the following to the CMakeLists.txt files to get support for stlport and have the SUNOS define:

    Code: Select all

    src/BulletDynamics/CMakeLists.txt: SET_TARGET_PROPERTIES(LibBulletDynamics PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS")
    src/BulletCollision/CMakeLists.txt: SET_TARGET_PROPERTIES(LibBulletCollision PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS")
    src/LinearMath/CMakeLists.txt: SET_TARGET_PROPERTIES(LibLinearMath PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS")
  • set shell variable CC=cc and CXX=CC to use SunStudio compilers
  • call cmake . and make
  • have fun
Hope that helps. Maybe these two changes above (to btSimpleBroadphase.cpp and btQuickprof.h) could be taken to the source?

Thanks for paying attention,
Noehrgel

EDIT: to quote R.v.d.P. "always use -fast with SunStudio!" I forgot to do this in the above settings. Result was that my demo application spent most of the time in the collision detection. Using -fast this is approx. 1/4th of the overall time.
Last edited by Noehrgel on Fri Nov 10, 2006 10:21 am, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Thanks a lot, those fixes have already been committed into Subversion.

I haven't had the time to look deeper into CMake, I just created very basic CMakefile.txt files. Are you familiar with autoconf?
Ideally I would like 'configure' to both configure jam as well as usual Makefiles (apart from the CMake generated ones). Can we find someone with autoconf experience that can help with this?

Apart from that, is there a way to conditionally add your SUN specific changes to CMakefile.txt ?

Code: Select all

src/BulletDynamics/CMakeLists.txt: SET_TARGET_PROPERTIES(LibBulletDynamics PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS") 
src/BulletCollision/CMakeLists.txt: SET_TARGET_PROPERTIES(LibBulletCollision PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS") 
src/LinearMath/CMakeLists.txt: SET_TARGET_PROPERTIES(LibLinearMath PROPERTIES LINK_FLAGS "-library=stlport4" COMPILE_FLAGS "-library=stlport4 -DSUNOS")
Thanks a lot for your contribution!
Erwin
Noehrgel
Posts: 10
Joined: Mon Aug 21, 2006 5:11 am

Post by Noehrgel »

Erwin Coumans wrote: Apart from that, is there a way to conditionally add your SUN specific changes to CMakefile.txt ?
Just gave this a try and there seems to be a way (should work, but I haven't done extensive testing).

bullet-2.39/CMakeLists.txt

Code: Select all

SUBDIRS(src)
if (NOT CMAKE_SYSTEM_NAME MATCHES SunOS)
        SUBDIRS(Demos Extras)
endif (NOT CMAKE_SYSTEM_NAME MATCHES SunOS)
bullet-2.39/src/BulletCollision/CMakeLists.txt

Code: Select all

if (CMAKE_SYSTEM_NAME MATCHES SunOS)
        SET_TARGET_PROPERTIES(LibBulletCollision PROPERTIES LINK_FLAGS "-g0 -fast -library=stlport4")
        SET_TARGET_PROPERTIES(LibBulletCollision PROPERTIES COMPILE_FLAGS "-g0 -fast -library=stlport4 -DSUNOS")
endif (CMAKE_SYSTEM_NAME MATCHES SunOS)
bullet-2.39/src/BulletDynamics/CMakeLists.txt

Code: Select all

if (CMAKE_SYSTEM_NAME MATCHES SunOS)
        SET_TARGET_PROPERTIES(LibBulletDynamics PROPERTIES LINK_FLAGS "-g0 -fast -library=stlport4")
        SET_TARGET_PROPERTIES(LibBulletDynamics PROPERTIES COMPILE_FLAGS "-g0 -fast -library=stlport4 -DSUNOS")
endif (CMAKE_SYSTEM_NAME MATCHES SunOS)
bullet-2.39/src/LinearMath/CMakeLists.txt

Code: Select all

if (CMAKE_SYSTEM_NAME MATCHES SunOS)
        SET_TARGET_PROPERTIES(LibLinearMath PROPERTIES LINK_FLAGS "-g0 -fast -library=stlport4")
        SET_TARGET_PROPERTIES(LibLinearMath PROPERTIES COMPILE_FLAGS "-g0 -fast -library=stlport4 -DSUNOS")
endif (CMAKE_SYSTEM_NAME MATCHES SunOS)
You should've set the CC and CXX

Code: Select all

bash-2.05b$ export CXX='/opt/Studio10/SUNWspro/bin/CC'
bash-2.05b$ export CC='/opt/Studio10/SUNWspro/bin/cc'
The definite compiler options could be discussed (especially the stlport thing depends one your projects settings).

Hope that helps (and is commited into the reprositories),
Noehrgel
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Would it be possible to provide some patch against recent Bullet version 2.39? That will make sure I don't oversee something, or place it at the wrong line.

This influences only SunOS, isn't it? What kind of options do we need to discuss? Are the alternatives to stlport for SunOS? In the latest Bullet version I replaced some stl std::vector by a Bullet native 'btAlignedObjectArray' due to alignment issues in STL. But Bullet still uses stl indeed.

Thanks,
Erwin

Noehrgel wrote: The definite compiler options could be discussed (especially the stlport thing depends one your projects settings).

Hope that helps (and is commited into the reprositories),
Noehrgel
Noehrgel
Posts: 10
Joined: Mon Aug 21, 2006 5:11 am

Post by Noehrgel »

Erwin Coumans wrote:Would it be possible to provide some patch against recent Bullet version 2.39? That will make sure I don't oversee something, or place it at the wrong line.
It's on my todo list for tomorrow.
This influences only SunOS, isn't it? What kind of options do we need to discuss? Are the alternatives to stlport for SunOS? In the latest Bullet version I replaced some stl std::vector by a Bullet native 'btAlignedObjectArray' due to alignment issues in STL. But Bullet still uses stl indeed.
Well I'm not that familiar with the compiler options, therefore discussion. Stlport is a substitute for sun's stl implementation (as far as I got it) which is slightly faster. I need this options as we're using stlport.
I'd suggest to keep parameters like they are and start discussion if someone else shows up using solaris.

Noehrgel
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Post by Dragonlord »

Erwin Coumans wrote:Ideally I would like 'configure' to both configure jam as well as usual Makefiles (apart from the CMake generated ones). Can we find someone with autoconf experience that can help with this?
What exactly you want autoconf to do for you? Usually autoconf does all from compiling up to installing. I have worked at various places with automake tools so far so maybe I could have a look at it if I know what exactly you are after.
---
Pl?ss Roland
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Dragonlord wrote:
Erwin Coumans wrote:Ideally I would like 'configure' to both configure jam as well as usual Makefiles (apart from the CMake generated ones). Can we find someone with autoconf experience that can help with this?
What exactly you want autoconf to do for you? Usually autoconf does all from compiling up to installing. I have worked at various places with automake tools so far so maybe I could have a look at it if I know what exactly you are after.
---
Pl?ss Roland
Ah, thanks for offering help!

It is about the buildsystem: currently Bullet provides support for MSVC projectfiles, Cmake and jam. It doesn't support make/Makefiles yet.
'install' makes no sense for Bullet, because its not supposed to be a system-wide library. Each project (Blender, Bullet demos, other) has its own version of Bullet/src embedded. I choose this on purpose: different versions of Bullet physics will have (slightly) different simulation behaviour. And once a game or app is tuned, you don't want to upgrade the physics anymore, it would break everything.

Currently, when you run ./configure, it create a Jamfile from Jamfile.in, for your system. It would be nice to support 'make', so it create a Makefile.

Luckily, I got a contribution a few days ago that can configure both jam 'Jamfile' and make 'Makefile' at the same time.
If things don't work as we expected with this combo, perhaps you can help?
Erwin
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Post by Dragonlord »

Erwin Coumans wrote:
Dragonlord wrote:
Erwin Coumans wrote:Ideally I would like 'configure' to both configure jam as well as usual Makefiles (apart from the CMake generated ones). Can we find someone with autoconf experience that can help with this?
What exactly you want autoconf to do for you? Usually autoconf does all from compiling up to installing. I have worked at various places with automake tools so far so maybe I could have a look at it if I know what exactly you are after.
---
Pl?ss Roland
Ah, thanks for offering help!

It is about the buildsystem: currently Bullet provides support for MSVC projectfiles, Cmake and jam. It doesn't support make/Makefiles yet.
'install' makes no sense for Bullet, because its not supposed to be a system-wide library. Each project (Blender, Bullet demos, other) has its own version of Bullet/src embedded. I choose this on purpose: different versions of Bullet physics will have (slightly) different simulation behaviour. And once a game or app is tuned, you don't want to upgrade the physics anymore, it would break everything.

Currently, when you run ./configure, it create a Jamfile from Jamfile.in, for your system. It would be nice to support 'make', so it create a Makefile.

Luckily, I got a contribution a few days ago that can configure both jam 'Jamfile' and make 'Makefile' at the same time.
If things don't work as we expected with this combo, perhaps you can help?
Erwin
With autoconf you can turn this one into a distributed configuration. I never produced those so far as under Un*x systems such dependencies are avoided with the help of shared libraries ( hence the opposite of what you suggest to do ) but it is not difficult... at least not for Bullet. Whoever wants to include it has to do some more work though :D