Posted by: Morten Nobel-Jørgensen | August 30, 2012

Compiling Irrlicht SDK 1.7.3 in OS/X Mountain Lion / XCode 4.4


Compiling cross platform code can sometimes be tricky since the code often has to be modified slightly to satisfy different compilers. I’ll here describe the steps to compile the Irrlicht game engine for OS/X 10.8 Mountain Lion.

(Modified version of http://irrlicht3d.org/wiki/index.php?n=Main.InstallingIrrlicht )

Prerequisites: XCode 4.4 (or 4.5) installed. Install command line tools (Open XCode and goto preferences, choose the tab ‘Downloads’ and install next to the install line tools).

  1. Download the Irrlicht SDK 1.7.3 LINK
  2. Build the library (With Native Windowing Frameworks)
    1. Expand the archive, and navigate to ~/Downloads/irrlicht-1.7.3/source/Irrlicht/MacOSX
    2. Open MacOSX.xcodeproj with Xcode
    3. Select the build settings for the current project
    4. Change the following build settings (you may need to change from Basic to All in the line under build settings):
      1. Change Base SDK to Current OS X
      2. Change Architectures to Standard (32/64 bit Intel)
      3. Change Compiler for C/C++/Objective-C to LLVM GCC 4.2
    5. Do following changes in source code :
      1. CIrrDeviceMacOSX.mm:634 change to:
        GLint order = -1; // below window
      2. COpenGLSLMaterialRenderer.cpp:137-149 change to code block below
    6. Build all (this should create irrlicht/source/Irrlicht/MacOSX/build/Release/libIrrlicht.a )
  3. Install the library and headers:
    1. Open the Terminal and type: sudo cp ~/Downloads/irrlicht-1.7.3/source/Irrlicht/MacOSX/build/Release/libIrrlicht.a /usr/local/lib/
    2. Type: sudo cp -r ~/Downloads/irrlicht-1.7.3/include /usr/local/include/irrlicht

___

COpenGLSLMaterialRenderer.cpp:137-149:

#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4)
long long pLong =reinterpret_cast<long long>(Program);
GLuint p = (GLuint)pLong;
Driver->extGlProgramParameteri(p, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
Driver->extGlProgramParameteri(p, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
if (verticesOut==0)
Driver->extGlProgramParameteri(p, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut);
else
Driver->extGlProgramParameteri(p, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
#elif defined(GL_NV_geometry_program4)
if (verticesOut==0)
Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, Driver->MaxGeometryVerticesOut);
else
Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
#endif
Advertisements

Responses

  1. Hi! Thanks a lot for the guide, i’m running into a problem though… On mountain lion i’m trying to compile the code and when i start building it gives me the following error in MacOS_Prefix.pch:

    /Users/shaun/Documents/irrlicht-1.7.3/source/Irrlicht/MacOSX/MacOSX_Prefix.pch:5: Architecture/byte_order.h: No such file or directory

    It’s the first time i try to use irrlicht so i don’t even know where to create this file…

    It would be great it you could give me hand. Thanks

  2. ok sorry! Hadn’t downloaded the command line interface for xcode!

    • Hi Shaun. Good to hear that you have have solved the problem. And thanks for the feedback – I have updated the blog-post, so other people can avoid problems.

  3. I am getting 3 issues:
    Redefinition of ‘NSWindow’ as different kind of symbol
    Redefinition of ‘NSOpenGLContext’ as different kind of symbol
    Redefinition of ‘NSBitmapImageRep’ as different kind of symbol

  4. I have 3 errors, and I only have the LLVM 5.0 compiler. Errors:
    Redefinition of ‘NSWindow’ as different kind of symbol
    Redefinition of ‘NSOpenGLContext’ as different kind of symbol
    Redefinition of ‘NSBitmapImage’ as different kind of symbol

    • By the way, this is in CIrrDeviceMacOSX.h

      Line 21-23

      Code:
      class NSWindow;
      class NSOpenGLContext;
      class NSBitmapImageRep;

  5. I have a problem too: I compiled and built irrlicht, but when I try to compile examples with “make” it gaves me

    ld: library not found for -llibIrrlicht

    I put libIrrlicht.a on /usr/local/lib. I tried to put it on project directory or in parent folder, but I had same problem.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: