How to compile universal libraries on Mac OS X?

前端 未结 3 1340
暗喜
暗喜 2020-12-25 15:22

This may be a very silly question, but I\'m new to developing on Macs and am having a hard time with the universal binaries.

I\'ve got an application that I\'m compi

相关标签:
3条回答
  • 2020-12-25 15:55

    Finally got it working.

    In order to control the architecture of the target, I manually went in and edited the Makefiles.

    For one of them, I added to the end of the line that starts with CFLAGS: -arch i386 -arch x86_64 -arch ppc This produced a universal binary.

    For the other, when I did the same thing, the compile would error out. I had to cycle through and only put one arch at a time, and then after I produced all three, I called lipo on them with the -create flag to create a universal binary.

    0 讨论(0)
  • 2020-12-25 16:06

    I can't answer the main part of your question, because I always use Xcode rather than make. But as for that last part, if you support OS versions earlier than 10.6, you may need to compile for PowerPC (arch. code "ppc") as well.

    0 讨论(0)
  • 2020-12-25 16:07

    for ./configure, you can use this:

    ./configure CFLAGS="-arch i386 -arch x86_64" CXXFLAGS="-arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" --disable-dependency-tracking

    --disable-dependency-tracking is important or gcc/g++ will refuse to compile code.

    0 讨论(0)
提交回复
热议问题