Topic: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

I am trying to compile and run Maratis from sources (Mac, 64 bit, Lion, Xcode 4.3.1 / 4.5).
I want to debug Publish Project with my scene to see what is wrong.
I can compile Maratis
When I run it from Xcode on my Mac, program crashes (EXC_BAD_ACCESS) at Maratis::start()

engine->getBehaviorManager()->addBehavior(MBLookAt::getStaticName(), M_OBJECT3D, MBLookAt::getNew);

in

m_behaviors.push_back(newBCreator);

I cannot understand where is a problem.
As I can see, newBCreator is a valid object, and m_behaviors is instance variable, so it must be initialized automatically while creating MBehaviorManager.
If I comment

engine->getBehaviorManager()->addBehavior(MBLookAt::getStaticName(), M_OBJECT3D, MBLookAt::getNew);

, program crashes again in

engine->getMeshLoader()->addLoader(M_loadBinMesh);

in

m_loaders.push_back( loadFunction );

.
I understand that it is a C++ question.
I want to solve this problem to achieve proper publishing of my big scene from editor, so I ask it here.
Can you help me with it?

Sometimes, during launch program crashes at

m_packageManager = new MPackageManagerNPK();

in Maratis::Maratis with message
Maratis(5116,0x7fff72cbe960) malloc: *** error for object 0x100e8fb38: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

If I Enable Guard Malloc for project, then project crashes in MLevel::MLevel  MDataManager::MDataManager  while constructing instance of
vector <MDataRef *> m_refs;

Last edited by Petr (2012-09-19 08:18:42)

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

In trunk/dev/Projects/XCode/

- compile first MCore.xcodeproj to compile MCore.dylib
- compile then MEngine.xcodeproj to compile MEngine.dylib
- then you can compile Maratis.xcodeproj or MaratisPlayer.xcodeproj

It needs to be compiled in this order because I didn't find how to embed xcodeproj dependency.

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

I compiled project successfully, but when I run the program, I've got crashes described above.

screen

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

I have old xcode 3.2.6 where it works fine, so I cannot reproduce the crash.
Can you try to compile in release to see if it's the same ?

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

It could be a problem with the external libs,
some pre-compiled osx lib are maybe not compatible with a more recent xcode or osx,
the pre-compiled libs are :

- zlib
- libsndfile
- libpng
- libjpg
- libfreetype
- libiL

I'll tell you if I think about something else

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

I switched  to Release, and project runs without errors.
Thank you for advice.
I will try to debug publishing of my scene now.

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

In my machine it works on debug, but the project setting is maybe a bit different than release, I honesty don't know what.
Just to be sure, when you compile editor in debug, was MCore and MEngine also compile in debug ? (it needs to be)

Otherwise, if you really need to be in debug mode, try to compare the debug and release project setting.

Re: Compile and run Maratis on OS X Lion, Xcode 4.3.1 / 4.5, crashes

Both MCore and Mengine  was compile in Debug.
I think I can use Release for now.
If I need to use the Debug later, I will try to configure debug settings.
Thank you.