Project

General

Profile

Compiling for Mac OS X multiple architectures

Added by Charles Myers over 12 years ago

Can you build on the mac for multiple architectures?

I've very new to mac so do tell me if I'm doing something really stupid.

I want a static library that I'll be using in another project. I've tried using:
./configure --enable-static --disable-shared CXXFLAGS="-DSUPPRESS_WARNINGS -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" --prefix=$PWD/../../

but when I try to run make I get:
g++-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags


Replies (6)

RE: Compiling for Mac OS X multiple architectures - Added by Robin Mills over 12 years ago

Charles

Good News. You're not doing anything stupid. I've also had difficulty with this. I have succeeded - however you won't like the solution: http://clanmills.com/articles/gpsexiftags/macos.shtml

I haven't been able to persuade my iMac (Intel) to build and link the PPC version (nor the Universal) - however it builds the i386 version just fine. And I can only persuade my elderly PowerbookPro (PPC) to build the PPC version. So I get the two machines to build and I create the universal with lipo. Yuck. I told you wouldn't like the solution. So, to sum it up - the build machinery always builds native targets and stumbles when cross compiling.

Apple's TechNote says: "the problem arises because the configure environment was not envisioned with a universal binary-like situation in mind" http://developer.apple.com/technotes/tn2005/tn2137.html

When 0.18.1 was published, I investigated this and thought about reporting a bug (and having it fixed for 0.19). However I didn't want to put pressure on myself to fix it!

You might be able to persuade me to revisit this. Can you say something about what you're doing and your use case please? Do you really need a universal build?

Robin

RE: Compiling for Mac OS X multiple architectures - Added by Charles Myers over 12 years ago

Cheers Robin,

I'm building an app that checks a list of images to verify that they all conform to a set criteria in terms of image types, resolutions, metadata, etc.

The end users could be using a variety of machines. Windows, different types of Mac, etc. So I need this to run on as many different architectures as possible.

charlie

RE: Compiling for Mac OS X multiple architectures - Added by Robin Mills over 12 years ago

Hi Charlie

OK. I'm going to look again at this. When I looked before, I seem to recall the difficulty was caused by issues with recursive building of dependent libraries and I was messing about down inside the generated makefiles! So I decided to give up. Time for another visit. If I can't figure out how to fix the build machinery, I can use my ppc-laptop/intel-desktop machines to build it for you. Of course it's much better that you can build your own - however publishing the library pre-built is better than nothing.

I think the need for ppc/intel universal builds is legacy stuff as the PPC slips into history. However universal 32/64 bit builds might be the challenge of the future.

Robin

RE: Compiling for Mac OS X multiple architectures - Added by Charles Myers over 12 years ago

Cheers Robin, appriciate the help

charlie

RE: Compiling for Mac OS X multiple architectures - Added by Charles Myers over 12 years ago

Using your suggestions I've managed to created a working universal binary version of libexiv2.a

Thanks again Robin

RE: Compiling for Mac OS X multiple architectures - Added by Robin Mills over 12 years ago

Ah, good. I'm glad to be off the hook. Best Wishes with your project.

    (1-6/6)