[SDL] Cross-compiling SDL app from Linux to Mac OS

Dominik Dagiel dominik at dagiel.pl
Sat Feb 9 13:02:26 PST 2008


Hi.

I am trying to build my Linux SDL application to Mac OS. I downloaded 
odcctools (based on gcc cross-compiler and some Mac develop tools), all 
SDL*.dmg, and Xcode. Then I made some changes in my Makefile and after 
compilation I received binary file working on Mac (anyway I have to resign 
SDL_image, because it crushes on ppc).

Unfortunatelly I don't have Mac and my program is tested by friend who live 
400 km away from me. I have a problem: my program can be run only by console 
(./Prehistory) . I don't know what to do, to run it by clicking. I read many 
pages about Mac programs and I store program in directories:

Prehistory.app
->Contents
->->Frameworks - here I put SDL frameworks
->->Info.plist - I copied contents from SDL package for Xcode Info.plist 
template and changed some fields
->->MacOS
->->Resources - here is whole program. Program works on Mac only when binary 
Prehistory is in this directory.

When application is run it looks for SDL* libs with path "../Frameworks/SDL*". 
The only way to run program is to go to Resources directory by console and 
run it by typing. When I put Prehistory binary to dir MacOS it doesn't see 
files from Resources. When directory Prehistory.app is clicked nothing 
happens. 

My Makefile starts with (I suppose some texts are not correct, but output 
binary works..) :
-------------
CC=powerpc-apple-darwin8-g++
CFLAGS= -D_REENTRANT -DGAMERELEASE -DKOMPILUJMAC -arch i386 -arch 
ppc -I/home/dedek/Library/Frameworks/SDL.framework/Headers -I/home/dedek/Library/Frameworks/SDL_image.framework/Headers -I/home/dedek/Library/Frameworks/SDL_mixer.framework/Headers -I/home/dedek/Library/Frameworks/SDL_ttf.framework/Headers

LIBS= -framework Cocoa -framework 
SDL /home/dedek/Library/Frameworks/SDL.framework/Headers/SDLMain.m -F/home/dedek/Library/Frameworks -framework 
SDL_mixer -framework SDL_image -framework SDL_ttf  -arch i386 -arch ppc 
....
------------

I suppose I shouldn't load files with absolute paths, but I thought SDLMain.m 
resolves it. Binary created by i586-mingw32msvc-g++ works on Windows 
correctly (with cflag -Dmain=SDL_main and -lSDLmain added to libs). Is the 
problem because of the wrong Info.plist contents? Do you know what could I do 
to create SDL Mac application on Linux which can be run by clicking?


-- 
Regards
D


More information about the SDL mailing list