linking against dylib built for MacOSX file '/usr/lib/libSystem.B.dylib' for architecture i386

前端 未结 2 453
半阙折子戏
半阙折子戏 2020-12-14 02:31

I recently switched my development MacBook from a classic MacBook (32 bit) to a MacBook Air (64 bit). I am trying to open a project that was made on my old MacBook (32 bit)

2条回答
  •  青春惊慌失措
    2020-12-14 03:03

    Xcode 5 asks you to build your libraries for the simulator (1) and for iOS (2). You can then merge (3) these into a fat binary which you then link to your main project. I use the same flags as Xcode is using to build your main project (as seen in your screendump).

    Expressed in common gnu toolchain variables I do:

    1. Building a library for the simulator

    CC=clang
    IPHONEOS_DEPLOYMENT_TARGET=7.0
    PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
    CFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -mios-simulator-version-min=7.0"
    

    2. Building a library for iOS

    CC=clang
    IPHONEOS_DEPLOYMENT_TARGET=7.0
    PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
    CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=7.0"
    

    3. Merging to a fat binary

    Choose either of .a or .dylib depending on what you use:

    lipo -create "your armv7 lib".a     "your simulator lib".a     -output "your lib".a
    lipo -create "your armv7 lib".dylib "your simulator lib".dylib -output "your lib".dylib
    

提交回复
热议问题