Mac Universal Binary

What’s the state of SDL and SDL_Image vis-a-vis Mac Universal Binaries? If I
want to compile my game as a universal binary, do I need new binaries for the
SDL frameworks? If so, are there some available, and/or is it a painless thing
for me to re-compile them myself? Or would it be ugly and best avoided for now?

Thanks,
Phil

What’s the state of SDL and SDL_Image vis-a-vis Mac Universal Binaries? If I
want to compile my game as a universal binary, do I need new binaries for the
SDL frameworks? If so, are there some available, and/or is it a painless thing
for me to re-compile them myself? Or would it be ugly and best avoided for now?

I’m building them seperately the Unix Way (using gcc 3.3 for ppc and gcc
4 for x86), and then using the “lipo” command line utility to merge them
into one Universal binary.

Works great, but it’s not really the clean, nice way to do it.

–ryan.

What’s the state of SDL and SDL_Image vis-a-vis Mac Universal Binaries? If
I
want to compile my game as a universal binary, do I need new binaries for
the
SDL frameworks? If so, are there some available, and/or is it a painless
thing
for me to re-compile them myself? Or would it be ugly and best avoided for
now?

Thanks,
Phil

Yes, you will need new SDL binaries otherwise your linking stage will
fail when you build the x86 side.

I’ve been working on updating all the SDL Xcode projects (SDL,
SDL_image, SDL_mixer, SDL_ttf). They are almost done with a few
caveats.

The primary problem is that we have been unable to get the MMX/SSE
code to compile/link on OS X. Unless somebody knows better, it looks
like all the assembly code will need to be rewritten to be position
independent. There are also secondary problems with limitations in
Xcode compiling architecture specific files with nasm while PPC must
also be built.

For everything else, you could compile these yourself, but the real
trick has not been the universal binary itself, but making a universal
binary that is still 10.2 compatible (per SDL requirements). There are
also the additional hoops of needing to recompile all the dependencies
as universal binaries with the same constraints, e.g, not only does
SDL_image need to be rebuilt, but libpng and libjpeg must also be
rebuilt. Same goes for SDL_mixer and SDL_ttf.

I’m trying to get all 4 projects done, so the last hold up at the
moment is SDL_mixer. There have been complaints that the SDL_mixer
framework can’t play MP3s. I think it’s because we currently are not
activating the compile flag to use SMPEG. I’m not sure how/why this
changed, but I’m also not sure how we linked to SMPEG before on OS X
as there seems to be no pre-existing infrastructure for building with
SMPEG. So I’m looking into fixing this, but that means getting SMPEG
up-to-date with Universal Binaries as well. I seem to be running into
MMX problems there too, but of a different nature. (Errors like:
Unknown pseudo-op: .type (or .size). Maybe somebody out there knows
how to fix this?)

Anyway, I hope to push out all the changes, documentation, and new
binaries to Sam within the next few days.

-Eric> From: Phil Steinmeyer

Subject: [SDL] Mac Universal Binary

I’m trying to get all 4 projects done, so the last hold up at the
moment is SDL_mixer. There have been complaints that the SDL_mixer
framework can’t play MP3s. I think it’s because we currently are not
activating the compile flag to use SMPEG.

By the way, the binary packages I build never include SMPEG support,
simply to avoid external dependencies.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

By the way, the binary packages I build never include SMPEG support,
simply to avoid external dependencies.

Okay, I can build smpeg statically and setup a static linkage like we
do with ogg/vorbis. However, because smpeg is C++ based, I have to
force C++ linkage using -lstdc++. I presume this may open up a whole
can of worms doing this though. Is this something we want to pursue?
(I’ve already setup the build system so you can pick with or without
smpeg easily, but should decide what we will ship/support.)

Also, there may be another problem. When I actually tried this against
the playmus test program, I keep getting errors with all the MP3’s
I’ve tried:
Warning: incorrect audio format
mpegtoraw.cpp:487: failed assertion audio->rawdatawriteoffset > len

I doubt this has anything to do with the static linking though. Maybe
there is a problem in smpeg?

Thanks,
Eric

I doubt this has anything to do with the static linking though. Maybe
there is a problem in smpeg?

Very likely.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment