[Tutorial] Getting started on Mac OS X

A forum to store posts deemed exceptionally wise and useful
osxus3r
Posts: 2
Joined: Sun Jun 25, 2006 11:03 pm
Contact:

[Tutorial] Getting started on Mac OS X

Post 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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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?
osxus3r
Posts: 2
Joined: Sun Jun 25, 2006 11:03 pm
Contact:

Post 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?
zathras
Posts: 4
Joined: Sat Sep 23, 2006 5:34 pm
Contact:

Post 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
dogbrain
Posts: 6
Joined: Tue Sep 19, 2006 9:42 am

Post 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... :(
A computer program will always do what you tell it to do, but rarely what you want to do.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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).
itistoday
Posts: 2
Joined: Thu Sep 28, 2006 4:12 am
Contact:

Post 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
kittycar275
Posts: 1
Joined: Thu Nov 16, 2006 2:17 am

libMacOSX.a

Post 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
garrittg
Posts: 117
Joined: Wed Apr 20, 2005 6:17 pm
Location: Iowa, USA
Contact:

Post 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
jasonroyle
Posts: 1
Joined: Sun Feb 25, 2007 8:46 am

Post 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...
garrittg
Posts: 117
Joined: Wed Apr 20, 2005 6:17 pm
Location: Iowa, USA
Contact:

Post 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
andyvn22
Posts: 2
Joined: Sat Apr 14, 2007 3:06 am
Location: Red Hook, NY
Contact:

Post 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.
phlogios
Posts: 13
Joined: Fri Aug 03, 2007 9:23 pm
Location: Lund, Sweden

Post 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
hAlp!?
phlogios
Posts: 13
Joined: Fri Aug 03, 2007 9:23 pm
Location: Lund, Sweden

Post 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
hAlp!?
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post 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.
Post Reply