Universal Binaries with GCC

I wanted to post a screenshot of the successful Mac build, but it was on Gophur’s Mac. +Delegation/-Screenshottery.

Took me a little while figuring out how to build lua 5.1 and tolua++ as universal binaries. On the mac, gcc will accept multiple “-arch” options.

What you have to watch out for is existing, single-arch entries and then you add the following flags to CFLAGS/CCFLAGS/LDFLAGS:

-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOS10.4u.sdk -arch i386 -arch ppc

You might also need to add “-force_cpusubtype_ALL” but I don’t quite get why.

The last gotcha for me was that I’d already gotten architecture-specific versions of the libraries installed which leads to some weird symptoms while trying to build new versions, and the lua5.1 sources appear to be missing the “doc” folder.

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: