Build bullet with fPIC?

Post Reply
Excizetd
Posts: 5
Joined: Sat Jun 12, 2010 9:01 pm

Build bullet with fPIC?

Post by Excizetd »

Hello,

I'm having trouble linking the static Bullet libraries to my shared library project.
The issue is related to relocation - compiler suggests adding -fPIC.

I did add -fPIC to the CXX_FLAGS in CMake prior to building Bullet, but still this does not help - I'm not even sure if it actually does it.

Has anyone else linked Bullet to a dynamic library?
How do I ensure Bullet is being built PIC enabled?

Thank you :)
goldleaf
Posts: 19
Joined: Fri Nov 20, 2009 6:41 am

Re: Build bullet with fPIC?

Post by goldleaf »

I was able to build a static version of bullet in order to build a static version of the houdini bullet solver by using the following cmake command:

cmake . -G "Unix Makefiles" -DBUILD_SHARED_LIBS=off -DBUILD_DEMOS=off -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" -DINSTALL_LIBS=on

I don't know if my CXX and C flags are redundant, but I put them in just in case. Hope this helps!
Excizetd
Posts: 5
Joined: Sat Jun 12, 2010 9:01 pm

Re: Build bullet with fPIC?

Post by Excizetd »

goldleaf wrote:I was able to build a static version of bullet in order to build a static version of the houdini bullet solver by using the following cmake command:

cmake . -G "Unix Makefiles" -DBUILD_SHARED_LIBS=off -DBUILD_DEMOS=off -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" -DINSTALL_LIBS=on

I don't know if my CXX and C flags are redundant, but I put them in just in case. Hope this helps!
I tried it, and it is actually the same configuration as I used myself. But even with the fPIC flag, I still can't link those static libraries to my shared library?
absifreei
Posts: 6
Joined: Sat Oct 23, 2010 7:58 am

Re: Build bullet with fPIC?

Post by absifreei »

i have the same problem too,i am using ubuntu 9 64bit,and after two days of test and google searching i solved it,
here is my solution:
first,run cmake ,if everything is ok you will get some new files produced by cmake in your bullet code directory,then find the new text file named cmakecache.txt,open and
edit it ,find the line CMAKE_CXX_FLAGS=,add -fPIC at the end of line,i add -fPIC at line CMAKE_C_FLAGS= too in case
hope this can help ,good luck!
Post Reply