Compiling BP with GCC 4.8.1 and O2 or greater crashes GCC

SuperVGA
Posts: 5
Joined: Sun Dec 22, 2013 11:52 am

Compiling BP with GCC 4.8.1 and O2 or greater crashes GCC

Post by SuperVGA »

Hi guys,

I don't really know if this is the right place to go with this. It's not a question, and I'm not telling anyone in particular to fix something.
I have a project with which I've compiled an optimized, static BP before, using GCC 4.6 and BP 2.81.
I messed it up somewhere, likely causing a static initialization fiasco. Long story short, I installed a both new compiler, GCC 4-8-1,
a new IDE (Netbeans 7.4) and fetched the latest BP (2.82 r2704 at the time)

I tried to compile a new static lib but cc1plus.exe crashes. (Disabling optimizations or using only -O1 solves this)
My project however, segfaults when I initialize my instances of
btDbvtBroadphase
btDefaultCollisionConfiguration
btCollisionDispatcher
btSequentialImpulseConstraintSolver
btDiscreteDynamicsWorld
(in that order, in the ctor for the only class that uses BP)

I should've learned this before (but I became too confident):
Don't, or at least rarely, upgrade your compiler. Chances are one is doing something else wrong, which needs to be fixed.
But it looks like this could genuinely be a fault with the new GCC. My log is as follows:

Code: Select all

g++    -c -O2 -Isrc -MMD -MP -MF "build\Release\MinGW-Windows\src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.o.d" -o build\Release\MinGW-Windows\src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.o src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.cpp
src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.cpp: In member function 'virtual void btConnectivityProcessor::processTriangle(btVector3*, int, int)':
src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.cpp:310:2: internal compiler error: Segmentation fault
  }
  ^

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.cpp:310:2: internal compiler error: Aborted

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
g++.exe: internal compiler error: Aborted (program cc1plus)
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http:\\gcc.gnu.org\bugs.html> for instructions.
make.exe[2]: *** [build\Release\MinGW-Windows\src\BulletCollision\CollisionDispatch\btInternalEdgeUtility.o] Error 4
make.exe[2]: Leaving directory '\c\Users\User\Documents\NetBeansProjects\Bullet Physics'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory '\c\Users\User\Documents\NetBeansProjects\Bullet Physics'
make: *** [.build-impl] Error 2
(I had a few issues pasting this here, but replacing '/' with '\' made it work.)
SuperVGA
Posts: 5
Joined: Sun Dec 22, 2013 11:52 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by SuperVGA »

Bump! Would any of you guys know where to go with this? Should I take it to GCC?

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

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Erwin Coumans »

Yes, is seems your GCC version is broken, report it to the GCC developers. Or try a better compiler such as LLVM :-)

Thanks,
Erwin
SuperVGA
Posts: 5
Joined: Sun Dec 22, 2013 11:52 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by SuperVGA »

Erwin Coumans wrote:Yes, is seems your GCC version is broken, report it to the GCC developers. Or try a better compiler such as LLVM :-)

Thanks,
Erwin
Hi Erwin, thanks for responding. I found this: http://sourceforge.net/p/mingw/bugs/2143/ ticket that had been in the MinGW issue tracker since December 1st, so somebody beat me to it. :)

Also thanks for pointing me to LLVM. Had you not told me about it, I would never have found that it wasn't an interpreter or a VM meant for the execution of user programs (I don't know how to word it, but I thought it was like JVM)

So I'll give it a shot! (Although MinGW is going to be tough to get over! :))

Happy New Year,
/D
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Marcell »

I have the same problem. I'm unable to compile either Bullet 2.82 or 2.81 on Win 7 with MinGW 4.8.1, because the compiler segfaults on the way. After downgrading to MinGW 4.4.0, both BP version compile nicely.
SuperVGA
Posts: 5
Joined: Sun Dec 22, 2013 11:52 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by SuperVGA »

Marcell wrote:I have the same problem. I'm unable to compile either Bullet 2.82 or 2.81 on Win 7 with MinGW 4.8.1, because the compiler segfaults on the way. After downgrading to MinGW 4.4.0, both BP version compile nicely.
Hi Marcell,

May I ask where you got the 4.4 MinGW bins? (Unless you built it yourself)
I've had trouble finding old, official builds...

Happy New Year
/D
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Marcell »

Hello!

I'm using the MinGW package that comes with the Qt SDK. Even if you don't want to use Qt, you can download it from here http://qt-project.org/downloads and just use MinGW to compile, at the cost of having to install Qt Creator too. Specifically, I'm using Qt version 4.7, that slipped into the "archive" by now, but it's still accessible from that download page. Qt version 4.8 is still on that page and may suit your needs too. The latest Qt version 5.2 comes with MingGW 4.8.1 which segfaults when compiling Bullet.

Perhaps you can help me with some trouble too. I just set up a new PC with Win7 64 bit and I'm trying to get a Qt/Bullet project to run, but I keep getting a linker error that I don't understand and don't know how to solve. The linker error looks like this:
./release\Joint.o:Joint.cpp:(.text+0x22e7): undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
This is with code that has compiled and run without problems on a different PC with a 32 bit Win7. The lines that this is referring to must be these:

Code: Select all

tempRigidBody(1.0, &ms, &collisionShape, inertia);
rigidBody = new btRigidBody(mass, &motionState, collisionShape, inertia);

In the first case I pass a hard coded 1.0 as mass and in the second case a btScalar mass. I don't know why the linker says it doesn't know about btRigidBody(float, ...). I know the first argument is btScalar, but first of all I thought float and btScalar are interchangable and second of all 1.0 is a double and in the second case I do use an explicite btScalar. I just don't understand what's going on, but I suspect that the problem is not the source, since it compiles elsewhere with the same MinGW 4.4 compiler.
SuperVGA
Posts: 5
Joined: Sun Dec 22, 2013 11:52 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by SuperVGA »

Marcell wrote:Hello!
Perhaps you can help me with some trouble too. I just set up a new PC with Win7 64 bit and I'm trying to get a Qt/Bullet project to run, but I keep getting a linker error that I don't understand and don't know how to solve. The linker error looks like this:
./release\Joint.o:Joint.cpp:(.text+0x22e7): undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
This is with code that has compiled and run without problems on a different PC with a 32 bit Win7. The lines that this is referring to must be these:

Code: Select all

tempRigidBody(1.0, &ms, &collisionShape, inertia);
rigidBody = new btRigidBody(mass, &motionState, collisionShape, inertia);
I'm not really sure about this, Marcell. The only thing that seems obvious to me is if the implementation of the btRigidBody(float... ctor is actually missing, and you need to typedef mass yourself. other than that, perhaps (mass)(1.0)

It really should interpret 1.0 as double, not a float, which is also weird.
Did you manage to solve this on you own? My project was halted since christmas, as I also did some vacationing, but I intend on digging an old, trustworthy MingW up now.

(I think I need a complete newbie's guide to LLVM to set it up properly)
Olivier
Posts: 2
Joined: Mon Jan 20, 2014 8:02 pm

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Olivier »

Hi there,

You will find in attachment my patch to make Bullet 2.82 build with MinGW 4.8.1.
It's definitely a workaround but it works fine. The .zip contains only source files, just replace the original ones.

I heard the GCC crash has been fixed in the 4.8.2 version but MinGW is not up to date right now, we'll have to wait.

Enjoy ;)
You do not have the required permissions to view the files attached to this post.
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Marcell »

Thank you for your effort, this is a wonderful patch!
Olivier
Posts: 2
Joined: Mon Jan 20, 2014 8:02 pm

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by Olivier »

You're welcome
golgepapaz
Posts: 1
Joined: Fri Jan 24, 2014 7:09 pm

Re: Compiling BP with GCC 4.8.1 and O2 or greater crashes GC

Post by golgepapaz »

I can confirm that the crash is fixed with GCC 4.8.2 Succesfully compiled and run the demos etc.(64 bit)
you can get the compiler from mingw64 site.