[SDL] Universal Binary Error while linking during cross-compilation...

E. Wing ewmailing at gmail.com
Sat Feb 23 17:03:31 PST 2008


On 2/22/08, Dominique Louis <dominique at savagesoftware.com.au> wrote:
> Hi all,
> I have 2 or so questions about building Universal binaries.
>
> 1. I'm trying to cross compile from an i386 MacBook Pro to support
> PowerPC I am getting the following error when linking to SDL...
>
> "warning /sw/lib//libSDLMain.a archive's cputype(7, architecture i386)
> does not match (18) for specified -arch flag:ppc(can't load from it)"
>
> Any ideas?

/sw/lib, is that Fink? I don't think Fink installs Universal Binaries,
just native binaries. So you can't cross-compile against it if this is
true.

>
> 2. How do i386 and PowerPC binaries co-exist in the same application
> bundle? Do they sit in separate directories? How does the OS know which
> binary to run?
>

It is a single file containing all the different architectures. This
is called a "fat" binary. OS X inherits this feature from NeXTSTEP.
It's been around, but has just been dormant for a long time.

Mach-O is the component that is responsible for picking/dealing with
the correct parts.

Look up "fat binary" on Wikipedia, and search the Xcode documentation
for "Universal Binary" for more information.

-Eric



More information about the SDL mailing list