Compiling ToME under Mac OSX

Everything about ToME 4.x.x. No spoilers, please

Moderator: Moderator

Message
Author
asthmatic_thematic
Higher
Posts: 79
Joined: Tue Aug 19, 2008 7:15 pm

Re: Compiling ToME under Mac OSX

#31 Post by asthmatic_thematic »

So I spent a day playing around with brogue (a really beautiful game--about as pretty as you can get in plain, ascii, i think), messing with its c code, etc. And then I came back to the ToME SDL compiler errors I was having earlier. I solved the problem by telling xcode explicitly where to look; and since xcode defaults to not recursively searching certain directories, I had to be pretty explicit. If any other mac users are interested, let me know. It's probably better to find some other solution though; with my search path xcode is probably finding like ten SDL.h files, and that's a bit unkempt.

But I now have two final errors during linking.

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

Any ideas about these two problems? I think md5 may be the checksum stuff. But I have no idea what fov is. And more importantly I don't know how to get xcode's ld linker to find 'em. What's my next step?

Hope these two lua errors are obvious for some one! Thanks.

kazak
Thalore
Posts: 174
Joined: Fri Mar 04, 2005 8:04 pm
Location: colorado

Re: Compiling ToME under Mac OSX

#32 Post by kazak »

Yeah, I get the same two errors with beta16. Actually, the fov files already show up in the sources list, but I still get the error. If I try to add the files manually (fov or md5) to the sources list, I then get well over a hundred errors on compile. When that happened, I just gave up.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Compiling ToME under Mac OSX

#33 Post by darkgod »

You probably need to add the c files in src/luamd5/ it should then work
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Morth
Wayist
Posts: 17
Joined: Sat Dec 25, 2010 11:43 pm

Re: Compiling ToME under Mac OSX

#34 Post by Morth »

I don't think Xcode will find "SDL.h" in the SDL framework by default. The path has to be "SDL/SDL.h" for that to work. The workaround is to add the SDL Headers folder to the project:

1: Select Frameworks in the left bar
2: Use project => add to project
3: Navigate to /Library/Frameworks/SDL.framework
4: Select the Headers folder, click add and then click through the next dialog box.

Now you should be able to build, except for the other files not yet added from the t-engine src folder.

Morth
Wayist
Posts: 17
Joined: Sat Dec 25, 2010 11:43 pm

Re: Compiling ToME under Mac OSX

#35 Post by Morth »

I uploaded a bit updated project settings here:
http://bazaar.launchpad.net/~pelle-mort ... ision/2155

Realised afterwards that it was a 100M+ upload so I hope they'll let it stay. :)
Anyway, it's an update of the general build settings, using current mac os for debug, and 10.5 for release build (10.4 would not compile).
I also turned off stripping, since that doesn't make much sense for an opensource project.
Finally I went against my own suggestion above and simply added /Library/Frameworks/SDL.framework/Headers to the header search path.

The diff is against b16 sources.

coffee
Higher
Posts: 52
Joined: Tue Jan 04, 2011 11:10 am

Re: Compiling ToME under Mac OSX

#36 Post by coffee »

Morth wrote:I don't think Xcode will find "SDL.h" in the SDL framework by default. The path has to be "SDL/SDL.h" for that to work. The workaround is to add the SDL Headers folder to the project:

1: Select Frameworks in the left bar
2: Use project => add to project
3: Navigate to /Library/Frameworks/SDL.framework
4: Select the Headers folder, click add and then click through the next dialog box.

Now you should be able to build, except for the other files not yet added from the t-engine src folder.
This is my first post here. Thx Yufra, Morth and the others who helped me (and other Mac users) compiling this great game. This was too my first XCODE compilation on Mac. From now I will avoid all that days of waiting for a new OSX version. I did Yufra to-do list and added the SDL headers to project as Morth suggested. All worked.

THIS SHOULD BE STICKY! :)

PS I compiled b18, 16 non-used variables in code warning.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Compiling ToME under Mac OSX

#37 Post by yufra »

I noticed the warning list too, not sure what DG has planned for them. I will update the first post to include Morth's correction. Oh, and if you are compiling from SVN and someone reports the revision incorrectly then you will get the bad version problem you reported elsewhere.
<DarkGod> lets say it's intended

coffee
Higher
Posts: 52
Joined: Tue Jan 04, 2011 11:10 am

Re: Compiling ToME under Mac OSX

#38 Post by coffee »

yufra wrote:I noticed the warning list too, not sure what DG has planned for them. I will update the first post to include Morth's correction. Oh, and if you are compiling from SVN and someone reports the revision incorrectly then you will get the bad version problem you reported elsewhere.
By the name of the variables (I think one was simple "j") I believe that is probably the kind of vars used for temp/loop assignment. Not problematic, or are future vars as you said or now just orphan declared vars, probably darkgod win compile environment don't issue warnings about that orphan vars and got lost.

You probably saw my other post. That SVN revision tip could be useful here. :)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Compiling ToME under Mac OSX

#39 Post by yufra »

Yup, editing the first post now. :D
<DarkGod> lets say it's intended

Shigerello
Yeek
Posts: 14
Joined: Mon Jan 25, 2010 12:39 pm

Re: Compiling ToME under Mac OSX

#40 Post by Shigerello »

The current Xcode project file (rev 2192) can't compile the project, as already explained in the previous posts, because #include directives for SDL-related frameworks do not work (e.g. "SDL.h" should be "SDL/SDL.h").

To get around this problem, patch "project.pbxproj" a diff below (to be exact, patch "repos/t-engine4/mac/T-Engine/T-Engine.xcodeproj/project.pbxproj"
).
It adds header search path information to the project file.

Code: Select all

1079a1080,1085
> 				HEADER_SEARCH_PATHS = (
> 					/Library/Frameworks/SDL_image.framework/Headers,
> 					/Library/Frameworks/SDL_mixer.framework/Headers,
> 					/Library/Frameworks/SDL_ttf.framework/Headers,
> 					/Library/Frameworks/SDL.framework/Headers,
> 				);
P.S.
I'm wondering why Mac OS X binary distribution of T-Engine (at least beta 18) supports only i386. I confirmed that the project can be build also in ppc and x86_64.
...BTW, I can provide a "Universal binary build" patch (apply changes to "info.plist" and "project.pbxproj"). The patch adds options "Open in 32-bit mode" and "Open using Rosetta" to Finder's Info of T-Engine.

P.P.S.
Hey, it got lengty for a P.S. Sorry :P

Dougiegee
Halfling
Posts: 111
Joined: Sun Jun 20, 2010 9:24 pm

Re: Compiling ToME under Mac OSX

#41 Post by Dougiegee »

Hi!
I have no experience of compiling let alone on a mac but the only computer I have access to just now is my girlfriends laptop which is on the older os 10.58. Someone said they got it working earlier in this thread but wasn't sure how. It would be ace if someone could tell me what to do other than the main instructions so I don't have to load windows just to run the game.
Thanks, Doug

Shigerello
Yeek
Posts: 14
Joined: Mon Jan 25, 2010 12:39 pm

Re: Compiling ToME under Mac OSX

#42 Post by Shigerello »

Hi Dougiegee.

Hm, I guess you are using a PowerPC Mac laptop. If it's an Intel Mac, you don't have to compile T-Engine4 unless you wanna try a bleeding-edge version of T-Engine4 (see http://te4.org/download).


Anyway, here is instructions:
  • You need Xcode. If you don't have it, install it from OS install DVD or download it from Apple Developer Connection.
  • Install SDL-related frameworks.
  • Run Xcode, open "Xcode"->"Preferences..." from menu and choose "SCM" tab.
  • Configure a Subversion (SVN) repository of T-Engine (image below showing example).
    Image
  • Open "SCM"->"Repositories" from menu. "Check out" the repository somewhere appropriate: the directory created by "check out" is the workspace for programming T-Engine.
  • Open a Xcode project file in the checked-out directory: "mac/T-Engine/T-Engine.xcodeproj".
  • The Xcode project file is not configured for SCM yet I guess: open "SCM"->"Configure SCM For This Project..." from menu. Now you should see Project "T-Engine" Info window. Click "Configure Roots & SCM..." button.
  • Choose SVN for SCM, and the repository you configured earlier for its repository. Also, don't forget to set the root directory (image below showing example).
    Image
  • Just stick to Project "T-Engine" Info window a little more. Choose "Build" tab, and scroll down to "Header Search Paths" setting row. Set "Configuration" as "All Configurations": subsequent changes are reflected to all configurations including "Release" and "Debug".
  • Fill the value with

    Code: Select all

    /Library/Frameworks/SDL_image.framework/Headers
    /Library/Frameworks/SDL_mixer.framework/Headers
    /Library/Frameworks/SDL_ttf.framework/Headers
    /Library/Frameworks/SDL.framework/Headers
  • Back to the default project window. From toolbar, if "Overview" item does not show you an appropriate architecture, choose one (ppc for PowerPC Mac). Then, click "Build and Run" item.
  • That's it! Now you should be able to play T-Engine!
Last edited by Shigerello on Fri Jan 28, 2011 1:23 pm, edited 1 time in total.

Dougiegee
Halfling
Posts: 111
Joined: Sun Jun 20, 2010 9:24 pm

Re: Compiling ToME under Mac OSX

#43 Post by Dougiegee »

Thanks for your help. I tried all that after difficulty even finding Xcode for Leopard. When I build I get Build failed (106 errors). I'm not on a power pc, it's a MacBook2,1 but the builds on the download page don't work with Leopard. I may have followed the instructions wrong as I had no idea what I was doing! I'll try again...

Dougiegee
Halfling
Posts: 111
Joined: Sun Jun 20, 2010 9:24 pm

Re: Compiling ToME under Mac OSX

#44 Post by Dougiegee »

All good! Finally got it to work. Thanks for your help. It runs so much faster than in fake windows!

Shigerello
Yeek
Posts: 14
Joined: Mon Jan 25, 2010 12:39 pm

Re: Compiling ToME under Mac OSX

#45 Post by Shigerello »

You're welcome :D

P.S
I updated the last post: 1) the Xcode project file can now work with the T-Engine SVN repository, and 2) SDL-related header files are correctly searched in all configurations.

Post Reply