Weird Problems with GCC 5 and Irrlicht

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Weird Problems with GCC 5 and Irrlicht

Post by Sinsemilla »

Hello,

I am having a very weird problem, which is probably related to irrlicht and GCC 5.3.1:
My Application is only crashing on the first line of code when it is built with GCC 5.3.1 and uses both Irrlicht 1.8.3 and bullet 2.83.7 which themselves are also built with this compiler. It works flawlessly when just one of both libraries is used.

If my application links to Irrlicht 1.8.3 without Bullet, everything seem to work fine. One can take the Hello world example and compile and link it flawlessly to an Irrlicht 1.8.3
library. The same applies vice versa, one can take the Bullet Hello world example and compile and link it flawlessly to the current Bullet library whith GCC 5.3.1.

The Problem occurs when the application which is built links to both libraries and includes the irrlicht.h header. It then dies on the first line with a segfault and the output window shows a low level message.

The code i am testing this with is the Hello world example from Bullet.

Code: Select all

 
#include <iostream>
 
#include <irrlicht.h> 
#include <btBulletDynamicsCommon.h>
 
int main (void)
{
 
        btBroadphaseInterface* broadphase = new btDbvtBroadphase();
 
        btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
        btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
 
        btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
 
        btDiscreteDynamicsWorld* dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
 
        dynamicsWorld->setGravity(btVector3(0, -10, 0));
 
 
        btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0, 1, 0), 1);
 
        btCollisionShape* fallShape = new btSphereShape(1);
 
 
        btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, -1, 0)));
        btRigidBody::btRigidBodyConstructionInfo
                groundRigidBodyCI(0, groundMotionState, groundShape, btVector3(0, 0, 0));
        btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
        dynamicsWorld->addRigidBody(groundRigidBody);
 
 
        btDefaultMotionState* fallMotionState =
                new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, 50, 0)));
        btScalar mass = 1;
        btVector3 fallInertia(0, 0, 0);
        fallShape->calculateLocalInertia(mass, fallInertia);
        btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass, fallMotionState, fallShape, fallInertia);
        btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
        dynamicsWorld->addRigidBody(fallRigidBody);
 
 
        for (int i = 0; i < 300; i++) {
                dynamicsWorld->stepSimulation(1 / 60.f, 10);
 
                btTransform trans;
                fallRigidBody->getMotionState()->getWorldTransform(trans);
 
                std::cout << "sphere height: " << trans.getOrigin().getY() << std::endl;
        }
 
        dynamicsWorld->removeRigidBody(fallRigidBody);
        delete fallRigidBody->getMotionState();
        delete fallRigidBody;
 
        dynamicsWorld->removeRigidBody(groundRigidBody);
        delete groundRigidBody->getMotionState();
        delete groundRigidBody;
 
 
        delete fallShape;
 
        delete groundShape;
 
 
        delete dynamicsWorld;
        delete solver;
        delete collisionConfiguration;
        delete dispatcher;
        delete broadphase;
 
        return 0;
}
 
The Error message i receive when it crashes is the following:
malloc.c:2395: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Post Reply