Page 1 of 6

Compiling ToME under Mac OSX

Posted: Tue Sep 21, 2010 2:29 am
by yufra
WARNING: This is an early version of instructions, so please report problems/discrepancies at any step to help those that follow behind.

These instructions are for setting up ToME to compile on your Mac OSX computer. Note that you cannot use the source distributions downloaded from the website, since the mac folder and Xcode project file is missing.

Initial setup
  1. Xcode (free download, but it requires registering... http://developer.apple.com/technologies/xcode.html)
    Run the installer.
  2. Download the SDL Runtime library (http://www.libsdl.org/release/SDL-1.2.14.dmg).
    Drag the "SDL.Framework" folder to "/Library/Frameworks".
  3. Download the SDL image library (http://www.libsdl.org/projects/SDL_imag ... 1.2.10.dmg).
    Drag the "SDL_image.Framework" folder to "/Library/Frameworks".
  4. Download the SDL mixer library (http://www.libsdl.org/projects/SDL_mixe ... 1.2.11.dmg).
    Drag the "SDL_mixer.Framework" folder to "/Library/Frameworks".
  5. Download the SDL ttf library (http://www.libsdl.org/projects/SDL_ttf/ ... 2.0.10.dmg).
    Drag the "SDL_ttf.Framework" folder to "/Library/Frameworks".
    - I believe that libfreetype.dylib is already distributed with Xcode, but let me know if this is wrong.
  6. Open the terminal and change directory to the directory you want to download ToME into (default is your home directory which is fine).
  7. Execute the following command in the terminal (this may take a while).

    Code: Select all

    svn co --username guest --password guestor http://svn.net-core.org/repos/t-engine4 t-engine4
    
  8. Open the "t-engine4/mac/T-Engine" folder in Finder
  9. Open the "T-Engine.xcodeproj", which should open Xcode.
  10. Click on the Action button (top bar, looks like a gear to me) and select Add -> Existing Frameworks...
  11. Scroll down and look for the four SDL frameworks. Select all four by click on the first and shift-clicking on the last SDL framework. If they do not show up click "Add Other" and select the Headers folder inside of each SDL folder in /Library/Frameworks.
  12. Go to the Build menu and select the Build option (or press apple-b).
    Especially in the first few iterations of this instruction this stage may cause problems. Please report them here and I can update the instructions.
  13. Return to the "t-engine4/mac/T-Engine" folder in Finder. There should now be a "build/Debug/" folder with T-Engine.app. Run it!
    Alternatively you can run the application from within Xcode to help catch any problems, particularly useful if you are experiencing issues and wish to give a better bug report to ToME developers.
Updating to a new version
Or alternatively, how do you go to an official release since the online profile is currently disabled otherwise.
  1. Open Terminal and navigate to the t-engine4 directory.
  2. Run this command if you want to have the most recent SVN revision:

    Code: Select all

    svn update --username guest --password guestor
    
    ... and this one if you want a specific SVN revision. You can find what number (####) to use by looking at this thread or looking in the official announcements.

    Code: Select all

    svn update --username guest --password guestor -r ####
    
  3. Open the "T-Engine.xcodeproj" project.
  4. Select Build -> Clean. This should ensure that no files from your previous ToME version exist afterwards.
  5. Go to the Build menu and select the Build option (or press apple-b).
    Especially in the first few iterations of this instruction this stage may cause problems. Please report them here and I can update the instructions.
  6. Return to the "t-engine4/mac/T-Engine" folder in Finder. There should now be a "build/Debug/" folder with T-Engine.app. Run it!
    Alternatively you can run the application from within Xcode to help catch any problems, particularly useful if you are experiencing issues and wish to give a better bug report to ToME developers.

Re: Compiling ToME under Mac OSX

Posted: Tue Sep 21, 2010 2:49 am
by Zaive
The whole registering thing is really confusing... "Register as an Apple developer" sounds like they'll expect me to start making stuff for them or something. :shock:

Re: Compiling ToME under Mac OSX

Posted: Tue Sep 21, 2010 9:58 am
by Repton
yufra wrote: [*]Execute the following command in the terminal (this may take a while).

Code: Select all

svn co --username http://svn.net-core.org/repos/t-engine4 t-engine4
This isn't quite right -- you need to actually specify the username, and then give a password.

I know that the username and password are available in the forum, so I could do this ... but I'm not sure what darkgod thinks about making svn available to all? Is the same data available in the tarball on http://tome.te4.org/download ?
[*]Open the "T-Engine.xcodeproj", which should open Xcode.
Hmm, first time I clicked on it it just opened as a normal folder. I used spotlight to search for Xcode, and that seemed to remind OSX about the association :-)
[*]Go to the Build menu and select the Build option (or press apple-b).
Especially in the first few iterations of this instruction this stage may cause problems. Please report them here and I can update the instructions.
This step failed with numerous include errors, starting with SDL.h. After googling around, I found this page which suggested adding the SDL path to the includes explicitly. This appears to have worked :-)

Re: Compiling ToME under Mac OSX

Posted: Tue Sep 21, 2010 4:00 pm
by yufra
Repton wrote: This isn't quite right -- you need to actually specify the username, and then give a password.

I know that the username and password are available in the forum, so I could do this ... but I'm not sure what darkgod thinks about making svn available to all? Is the same data available in the tarball on http://tome.te4.org/download ?
Thanks, I have updated the command to include the username. In regards to the password and read-only SVN access, I decided to leave the password off until talking to DG. The source tarballs on the download page are direct snapshots of the SVN repository as far as I can tell.

EDIT: Actually, the source tarballs do not contain the mac folder and you must use the SVN repository for now.
Hmm, first time I clicked on it it just opened as a normal folder. I used spotlight to search for Xcode, and that seemed to remind OSX about the association :-)
That is odd! If others see this to let me know and I will add another step to the instructions.
This step failed with numerous include errors, starting with SDL.h. After googling around, I found this page which suggested adding the SDL path to the includes explicitly. This appears to have worked :-)
I remembered having to do something weird to get SDL working right, but couldn't remember exactly what. Thanks for finding that link Repton! Have you tested if the compiled app works?

Re: Compiling ToME under Mac OSX

Posted: Tue Sep 21, 2010 10:49 pm
by Repton
yufra wrote:I remembered having to do something weird to get SDL working right, but couldn't remember exactly what. Thanks for finding that link Repton! Have you tested if the compiled app works?
By the time I got it to build, it was bed time for me :-) But I started it up and got to the main screen, with playing music, and a successful login to my online profile. So I figure it was working.

Re: Compiling ToME under Mac OSX

Posted: Wed Sep 29, 2010 11:41 am
by Wombat
I'm trying to build it, and I get the following error:

Code: Select all

Ld build/Debug/T-Engine.app/Contents/MacOS/T-Engine normal i386
cd /Users/george/te4/t-engine4/mac/T-Engine
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/george/te4/t-engine4/mac/T-Engine/build/Debug -F/Users/george/te4/t-engine4/mac/T-Engine/build/Debug -filelist /Users/george/te4/t-engine4/mac/T-Engine/build/T-Engine.build/Debug/T-Engine.build/Objects-normal/i386/T-Engine.LinkFileList -mmacosx-version-min=10.6 -framework Cocoa -framework SDL_image -framework SDL_mixer -framework SDL_ttf -framework SDL -framework OpenGL -framework IOKit -o /Users/george/te4/t-engine4/mac/T-Engine/build/Debug/T-Engine.app/Contents/MacOS/T-Engine

Undefined symbols:
  "_luaopen_lxp", referenced from:
      _libs in tools.o
      _boot_lua in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Has anyone seen this before? I'm building on a 2008 imac under 10.6.4
thanks!

Re: Compiling ToME under Mac OSX

Posted: Wed Sep 29, 2010 2:25 pm
by yufra
Hey Wombat, the latest SVN versions need to have the Xcode project updated to include some new third-party code that DG recently added. I have managed to get it to compile on my machine and will try to get in touch with the official Mac builder and DG to get the update into the SVN repository. I'll post here when the SVN is updated.

Did you find the instructions to install the SDL frameworks straight forward?

Re: Compiling ToME under Mac OSX

Posted: Wed Sep 29, 2010 10:09 pm
by Wombat
Yes, it was relatively simple to make the change. Thanks for the info

Re: Compiling ToME under Mac OSX

Posted: Tue Oct 05, 2010 6:45 pm
by yufra
Neil, the official Mac builder, has updated the Xcode projects in the SVN repository so everyone should be able to build from SVN again. It is a good thing I didn't release my Xcode patches since they apparently were... poor. :wink:

Three cheers for Neil!

Re: Compiling ToME under Mac OSX

Posted: Tue Oct 05, 2010 6:46 pm
by Wombat
Yay! I'll try it when I get home.

Re: Compiling ToME under Mac OSX

Posted: Wed Oct 06, 2010 12:41 am
by Wombat
I'm happy to say that compiling works great now :D

Re: Compiling ToME under Mac OSX

Posted: Fri Oct 08, 2010 12:42 am
by yufra
Can I get a fellow Mac user to compile one of the latest revisions and check this bug. DG doesn't see it on his machine, but he isn't using OSX. Thanks!

EDIT: Nevermind... a reboot fixed it. What do you know! :D

Re: Compiling ToME under Mac OSX

Posted: Wed Nov 03, 2010 10:55 pm
by Wombat
Is there a new framework or something I need, I now get link errors when building:

Code: Select all

Ld build/Release/T-Engine.app/Contents/MacOS/T-Engine normal i386
cd /Users/wombat/te4/t-engine4/mac/T-Engine
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/wombat/te4/t-engine4/mac/T-Engine/build/Release -F/Users/wombat/te4/t-engine4/mac/T-Engine/build/Release -filelist /Users/wombat/te4/t-engine4/mac/T-Engine/build/T-Engine.build/Release/T-Engine.build/Objects-normal/i386/T-Engine.LinkFileList -mmacosx-version-min=10.6 -framework Cocoa -framework SDL_image -framework SDL_mixer -framework SDL_ttf -framework SDL -framework OpenGL -framework IOKit -o /Users/wombat/te4/t-engine4/mac/T-Engine/build/Release/T-Engine.app/Contents/MacOS/T-Engine

Undefined symbols:
  "_luaopen_gas", referenced from:
      _boot_lua in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


Re: Compiling ToME under Mac OSX

Posted: Thu Nov 04, 2010 2:24 am
by yufra
Two files need to be added to the Xcode project: particles_gas.c and particles_gas.h. You can do this by opening the Xcode project, right-clicking on the Sources folder under T-Engine in the Groups & Files window and select Add -> Existing Files. Then browse to t-engine/src directory and select the particles_gas files. An updated Xcode project needs to be committed to the SVN repository... Neil/DarkGod?

Re: Compiling ToME under Mac OSX

Posted: Fri Nov 05, 2010 5:21 am
by Encyclopath
I haven't seen anyone one else complain about it, but I've been able to successfully build for my non 10.6 macbook (10.58), by fiddling with the xcode settings. So far, it's run flawlessly. Is there a reason to compile it for >=10.6? If not, could the master project settings be updated for 10.4 or 10.5?

Also, are the missing gas files used by anything yet? I couldn't find one of them, and only found it referenced once in boot.lua when it was defined, so I just removed the reference, and haven't had an issue. Other than that, I didn't get any errors or warnings.

BTW, I'm a mac newb, and a compiling newb, so I'm not sure how I got stuff to work exactly, sorry.