Page 1 of 6

[Tutorial] Getting started on Mac OS X

Posted: Mon Jun 26, 2006 11:36 pm
by osxus3r
I figured my problem in my prev. post so I thought I should share the solution. then I thought its easier to explain eveything from the beginning. So here we go.

Getting started on Xcode

You will need Xcode 2 which can only be installed on Mac OS 10.4 (aka Tiger).

1. Create empty project: File->New Project and select Empty Project at the top. Then click next. Give it any name you want and Click Finish

2. Now add some Frameworks. On the left hand side you should see a column with your project name at the top (blue icon). Select it, then right click and choose Add->Existing Framworks. You will need to add 4 Framworks, AppKit, Carbon, Cocoa and of course OpenGL. They should reside in /System/Library/Framworks. Select them and click Add. Then click Add Again.


3. Now add the libMacOSX.a file. The same way you added the frameworks, Add->Exsisting Files. Make sure you have selected "Recursively create groups for any added folders". And check "Copy items into destination group's folder (if needed)"

4. Adjust the project, go to Project -> Edit project settings, go to build tab and set SDK path to wherever you have MacOSX10.4u.sdk, i.e.
/Developer/SDKs/MacOSX10.4u.sdk. Then set Header Search Paths to
/irrlicht-1.0/include or wherever you have include folder from Irrlicht.

5. Add a new target. Project -> New Target. Select Carbon/Application (not Cocoa!). Give it a name. Click triangles under Targets till you see Link Binary with Libraries. Select all the frameworks you've added and also libMacOSX.a and drag it underneath.

6. Now right click on your project icon add choose Add->New Files. Then select BSD/C++ File. Uncheck 'Also create " .h" ' as we dont need it at this stage. Name main.cpp or something and click Finish. Copy and paste code from 1st Tutorial, but also add #include <OpenGL/OpenGL.h> at the top. And change quotes in #pragma comment.. to double quotes, i.e #pragma comment(lib, "libMacOSX.a").

7. Make sure you have "Release" selected as active build configuration. Now go to Build->Build and Run.

Posted: Mon Jun 26, 2006 11:39 pm
by hybrid
This post should obviously go to the FAQ forum, I guess some admin will move it.
Does anyone know if the XCode requirement is mandatory, i.e. is there some vital API which is used, or is it mainly due to coding style or simple the XCode project?

Posted: Tue Jun 27, 2006 12:40 am
by osxus3r
hybrid wrote:..
Does anyone know if the XCode requirement is mandatory, i.e. is there some vital API which is used, or is it mainly due to coding style or simple the XCode project?
no its not mandatory, all Xcode does is invokes gcc with a bunch of parameters and g++ does the rest. But you need to include those Frameworks/APIs and you need to somehow create a .app (application) file. Are you thinking about cross-compiling it outside of Mac OS?

Posted: Sat Sep 23, 2006 5:42 pm
by zathras
Hi all,

I went through this tutorial -- thanks for posting it. I rewrote it in an idiot-proof ;-) way and added some screenshots.

Irrlicht + XCode idiot-proof beginner's tutorial

If you have comments, updates or corrections, just tell me!

zathras

Posted: Mon Sep 25, 2006 4:52 pm
by dogbrain
Anyone got 1.1 to compile properly. Would be really happy if someone could upload a working binary of the lib or explain how to do it with 1.1. The examples included in the project doesnt work for me.

I have almost given up... thinking of looking after a new 3d engine... :(

Posted: Mon Sep 25, 2006 6:36 pm
by hybrid
1.1 did not work properly. Use Irrlicht SVN which should work (not the most recent versions, but try around 230 - newer versions require some more files to be added to the XCode project).

Posted: Thu Sep 28, 2006 6:52 am
by itistoday
dogbrain wrote:Anyone got 1.1 to compile properly. Would be really happy if someone could upload a working binary of the lib or explain how to do it with 1.1. The examples included in the project doesnt work for me.

I have almost given up... thinking of looking after a new 3d engine... :(
Hi, I just got it working: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15920

libMacOSX.a

Posted: Thu Nov 16, 2006 2:20 am
by kittycar275
Hey, I dont have a libMacOSX.a file in my folder, could some one please tell me how can I build it myself? Thanks

Posted: Thu Dec 28, 2006 2:49 pm
by garrittg
here is a link to a compiled OSX version for Irrlicht v1.2. i will try to keep this updated for future versions since im already providing a precompiled GCC+DX version. Jonas compiles this for me for use with the BlitzMax mod. (again a big thank you to Jonas!).

http://www.gprogs.com/irrlicht.mod/libI ... c_v1_2.zip

Posted: Sun Feb 25, 2007 8:58 am
by jasonroyle
could someone please post a link to the libMacOSX.a for version 1 of irrlicht because I'm trying to run through this tutorial with the v1.2 lib and v1.2 irrlicht but it doesn't seem to be working. It builds it and then it runs it but it just comes up with a blank window ¬.¬ I'm probably doing something really stupid 'cos I'm completly new to irrlicht and even C++ but I'd like to get it working...

I'm trying to get the Hello Word example to work (that comes with irrlicht1.2) (irrlicht-1.2/examples/01.HelloWorld/) and I just copy the code in the main.cpp within that folder and do what it says in this tutorial...

Posted: Thu Apr 12, 2007 1:03 am
by garrittg
here is a link to a compiled OSX version for Irrlicht v1.3. (a big thank you to Jonas!).

http://www.gprogs.com/irrlicht.mod/libI ... c_v1_3.zip

Posted: Sat Apr 14, 2007 3:25 am
by andyvn22
Using the precompiled libIrrlichtMac.a to make a test app, I get "Undefined symbols: ___dso_handle" Any ideas?

I'd compile it myself, but when I tried that, I got "(jcapimin.o) has local relocation entries in non-writable section (__TEXT,__text)" After a bit of googling, I turned off -mdynamic-no-pic when compiling the library. This fixed that problem, but then I got about a billion irrlicht-related undefined symbols when compiling my test app.

Also at some point while using -both- of these methods I ended up with a "table of contents for archive: libIrrlicthMac.a is out of date" error and had to run ranlib to get it to go away.

I'm really out of my element with all of this stuff, I'd like to get things working so I can deal with code-related errors! I'm amazed at the number of different problems that can be encountered when just downloading and trying to use a library.

Oh, furthermore (or possibly this is the cause of these issues), a ton of the files in the Xcode project were missing, most of which had either been renamed or moved; I had to find all of those. A few I deleted because no equivalent appeared to exist, but I think it was OK, since as far as I can tell, no reference to these files or their subjects was made anywhere else in the project: CZBuffer2.cpp, ITriangleRenderer2.h, and IZBuffer2.h.

Also, does anyone have an explanation for how such huge numbers of problems occur? It's not specific to Irrlicht, I tried Ogre when all this happened, and that had similar issues... how can there be so many problems and people still get it working? And why aren't there more solutions to these problems? Do they only happen to me? I don't understand how I can encounter all these issues when everyone else seems to have it running fine. I've followed several different step-by-step tutorials, and NONE of them have worked.

Posted: Fri Aug 03, 2007 9:27 pm
by phlogios
When I compile the tutorial 1 program, all I get is a blank window with the correct title. The console (in xcode) says that it cant load the mesh called sydney.md2. What did I do wrong? I'm guessing that I have to change some directory of something. The model is in /Users/gustavpihl/Desktop/irrlicht-1.0/media

Posted: Fri Aug 03, 2007 9:52 pm
by phlogios
I managed to load the mesh and the texture (according to Run Log) but the window is still blank. No error message.

[Session started at 2007-08-03 23:50:53 +0200.]
Irrlicht Engine version 1.0
Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386
Loaded texture: #DefaultFont
Loaded mesh: ../../media/sydney.md2
Loaded texture: ../../media/sydney.bmp

Posted: Fri Aug 03, 2007 9:54 pm
by ssexton
phlogios wrote:When I compile the tutorial 1 program, all I get is a blank window with the correct title. The console (in xcode) says that it cant load the mesh called sydney.md2. What did I do wrong? I'm guessing that I have to change some directory of something. The model is in /Users/gustavpihl/Desktop/irrlicht-1.0/media
Hm. I remember getting the blank window when I first started out, but I don't remember any errors loading the models. Two possibilities for the blank window:

1. Make sure the MainMenu.cpp code looks like this (I didn't check SVN), as the Burning's driver isn't available on Mac OS X:

#ifdef MACOSX
device = createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(512, 384), 16, false, false, false, this);
#else
device = createDevice( video::EDT_BURNINGSVIDEO,
core::dimension2d<s32>(512, 384), 16, false, false, false, this);
#endif

2. Make sure you are running it from the app bundle (double-click in Finder) not from the terminal. I don't think it'll work from terminal.

After that, in the main menu screen (assuming you can see it) when you start the demo, be sure you select OpenGL driver. Again, because that is the only one Mac OS X has.

Also, I see you have 1.0 in your path. Don't use the 1.0 SDK on the website (aside: someone should really take it down). It is old, old, old and broke, broke, broke. Build (or download from off-site, I saw some links in this thread) something newer, 1.2 or better will work much better for you.