Page 1 of 1

Crashes on Mac OSX

Posted: Sat Nov 12, 2011 11:15 am
by MolokoTheMole
Hi,
I just compiled my game for Mac OSX using Irrlicht 1.7.2.
Many people report crashes and can't start the game. It works fine for me on an old Macbook. Tested it on a Macbook Air, doesn't work.
Here are the typical crash reports they are getting:

Model: Macmini2,1, BootROM MM21.009A.B00, 2 processors, Intel Core 2 Duo, 2 GHz, 2 GB, SMC 1.19f2
Graphics: Intel GMA 950, GMA 950, Built-In, spdisplays_integrated_vram
OS Version: Mac OS X 10.6.8 (10K549)
[0] Initializing new video device...
[0] Irrlicht Engine version 1.7.2
[0] Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386
dyld: lazy symbol binding failed: Symbol not found: _CGLSetCurrentContext
Referenced from: /Applications/KAG.app/Contents/MacOS/Base/Juxta.dylib
Expected in: /usr/X11/lib/libGL.1.dylib

dyld: Symbol not found: _CGLSetCurrentContext
Referenced from: /Applications/KAG.app/Contents/MacOS/Base/Juxta.dylib
Expected in: /usr/X11/lib/libGL.1.dylib

Re: Crashes on Mac OSX

Posted: Sat Nov 12, 2011 5:55 pm
by hybrid
I don't have a newer OSX system, so I cannot test those cases. But it seems that some OpenGL libs are simply missing here.

Re: Crashes on Mac OSX

Posted: Sun Nov 13, 2011 3:54 am
by Ricket
I believe you are missing the Cocoa framework, or maybe Carbon. You'll also need the IOKit framework for part of Irrlicht, but given that you're doing lazy linking (which is new to me, actually), you may not run into that requirement unless you support joysticks. Those are the three required frameworks for Irrlicht that I've found (via experimentation).

Re: Crashes on Mac OSX

Posted: Thu Nov 17, 2011 9:17 am
by MolokoTheMole
Here is what I'm linking against:

-lGL -lXxf86vm -lobjc -framework cocoa -framework carbon -framework opengl -framework IOKit

I do support joysticks, is that a problem?

Re: Crashes on Mac OSX

Posted: Thu Nov 17, 2011 2:39 pm
by Ricket
Are they actually case-insensitive like that? I would think the lowercase "cocoa", "carbon" and "opengl" could mess up at least most systems. IOKit is capitalized correctly, as is objc. And no, I don't believe it's a problem, I was simply saying that (I think) IOKit is only necessary for joystick stuff; so in your case, it's crucial that you do link with it.

If capitalizing fixes it, I dunno; I'm using CMake so it kinda happens magically, which I like.

Re: Crashes on Mac OSX

Posted: Thu Nov 17, 2011 3:50 pm
by MolokoTheMole
So what case should it be? Would you mind pasting me the CMake lines where the linking is done?

Re: Crashes on Mac OSX

Posted: Fri Nov 18, 2011 12:29 am
by Ricket
CMake is complicated and I'm rather new at it, but I think this is the relevant linking bit that you need:

Code: Select all

-lIrrlicht -framework AGL -framework OpenGL -framework Carbon -framework Cocoa -framework IOKit
Here is my main CMakeLists.txt file, in case you or someone else reading this wants to use CMake. It seems to work well.

Code: Select all

cmake_minimum_required(VERSION 2.8)
PROJECT(ArcaneTrinity)
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
 
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(Irrlicht)
FIND_PACKAGE(MsgPack)
 
IF (APPLE)
        FIND_LIBRARY(CARBON_LIBRARY Carbon)
        FIND_LIBRARY(COCOA_LIBRARY Cocoa)
        FIND_LIBRARY(IOKIT_LIBRARY IOKit)
        SET(OSX_LIBRARIES ${CARBON_LIBRARY} ${COCOA_LIBRARY} ${IOKIT_LIBRARY})
        
        SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
ENDIF (APPLE)
 
INCLUDE_DIRECTORIES(${IRRLICHT_INCLUDE_DIR} ${MSGPACK_INCLUDE_DIR}
        ${OPENGL_INCLUDE_DIR})
 
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
 
ADD_SUBDIRECTORY(src)

Re: Crashes on Mac OSX

Posted: Sat Nov 19, 2011 3:50 am
by oeginc
I can NOT for the life of me seem to get cmake to work with Irrlicht on OSX.... Complains about missing frameworks, etc.. Does anyone have a sample tar.gz (HelloWorld for example) that works that I can expand on? Thanks!

P.S. A Cmake config that compiles Irrlicht would be awesome too, but I'm not getting my hopes up. ;)

P.S.S. I'm new to Cmake as well, but it seems as though your example above is missing something. You are finding the libraries, but I don't see where you are using them - or am I missing something?

Re: Crashes on Mac OSX

Posted: Sat Nov 19, 2011 8:38 pm
by Ricket
Hi oeginc, let's not hijack this thread. Hopefully the arguments I provided earlier will help MolokoTheMole; as for CMake, since you're interested, read this thread. I just made a Github project that should help you.