MacOSX universal SDL libs for makefile-based project

Hi,

I’m trying to build a universal MacOSX binary for my program (tuxmath) on a
new Intel iMac running Leopard (10.5). The program builds and installs
properly with “./configure; make; sudo make install” and runs fine.

When I try to do the ppc crossbuild, the ppc *.o files get generated OK, but
the linking fails (of course) because my SDL and other needed libs are
i386-only (I build SDL and friends on my machine using Fink).

So, I would like to get universal binary libs in place for SDL, SDL_image,
SDL_mixer, and SDL_ttf (also gettext, but that’s another story).

  1. grabbing the SDL-1.2.13 dmg file and copying the framework
    into /Library/Frameworks didn’t work, I assume because my program is
    makefile-based rather than using XCode.

  2. Using the SDL-1.2.13 source, I tried the ‘fatbuild.sh’ script, which I
    think is supposed to be what I need, but it fails:

janis-lehtinens-imac:SDL-1.2.13 dbruce$ sudo sh build-scripts/fatbuild.sh
Password:
checking build system type… i386-apple-darwin
checking host system type… powerpc-apple-darwin
checking for powerpc-apple-darwin-gcc… gcc-4.0 -arch ppc
checking for C compiler default output file name… rm: a.out.dSYM: is a
directory
a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… yes
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc-4.0 -arch ppc accepts -g… yes
checking for gcc-4.0 -arch ppc option to accept ISO C89… unsupported
checking how to run the C preprocessor… /lib/cpp
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details.

fwiw, no ‘config.log’ is written.

  1. I’ve also tried ./configure and make using CFLAGS="-O -g -arch i386 -arch
    ppc" and LDFLAGS="-arch i386 -arch ppc", which fails at the linking stage
    with:

ld: warning in build/.libs/mmx_main.o, file is not of required architecture
ld: warning in build/.libs/mmxp2_32.o, file is not of required architecture
ld: warning in build/.libs/x86_main.o, file is not of required architecture
ld: warning in build/.libs/x86p_16.o, file is not of required architecture
ld: warning in build/.libs/x86p_32.o, file is not of required architecture
Undefined symbols:
"_ConvertX86p32_24BGR888", referenced from:
_normal_blit_4 in SDL_blit_N.o
"_ConvertMMXpII32_16BGR555", referenced from:
_normal_blit_4 in SDL_blit_N.o
"_ConvertMMXpII32_16BGR565", referenced from:
_normal_blit_4 in SDL_blit_N.o
(and about twenty more “_ConvertMMX*” and “_ConvertX86*” undefined symbols).

Is there any established way to get universal binary versions of the SDL libs
onto a system for use in a makefile-based project?

Thanks,–
David Bruce

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

Is there any established way to get universal binary versions of the SDL
libs
onto a system for use in a makefile-based project?

Use CMake instead?

-Eric

Hi,On Saturday 09 February 2008 08:16:41 pm E. Wing wrote:

Is there any established way to get universal binary versions of the SDL
libs onto MacOSX?

It looks like MacPorts (http://www.macports.org), does exactly what I need,
although the universal build of smpeg (and thus SDL_mixer) is broken at the
moment.

Cheers,


David Bruce