HaneTV HaneTV - 1 year ago 158
Objective-C Question

xcode >= 8 cannot compile my objective-c library

I'm trying to compile my objective-c library with Xcode (or xcodebuild) but it seems that Xcode is only taking the last two numbers of my "Base SDK" (10.1 in my case) build setting :

xcodebuild -scheme mylib -workspace mylib_objc.xcworkspace -sdk "iphonesimulator10.1" build

output error :

/bin/sh -c /Users/user/Library/Developer/Xcode/DerivedData/mylib_objc-dcainaehwbdhdeeyoykilqflodnx/Build/Intermediates/mylib.build/Debug-iphonesimulator/mylib.build/Script-AEDFEE9B1B25C0FD00756827.sh
XCode has selected SDK: iphonesimulator with version: 0.1 (although back-targetting: 7.0)
...therefore, OTHER_SDK_TO_BUILD = iphoneos0.1
RECURSION: I am the root ... recursing all missing build targets NOW...
RECURSION: ...about to invoke: xcodebuild -configuration "Debug" -project "mylib.xcodeproj" -target "mylib" -sdk "iphoneos0.1" build RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="/Users/user/Library/Developer/Xcode/DerivedData/mylib_objc-dcainaehwbdhdeeyoykilqflodnx/Build/Products" BUILD_ROOT="/Users/user/Library/Developer/Xcode/DerivedData/mylib_objc-dcainaehwbdhdeeyoykilqflodnx/Build/Products" SYMROOT="/Users/user/Library/Developer/Xcode/DerivedData/mylib_objc-dcainaehwbdhdeeyoykilqflodnx/Build/Products"
xcodebuild: error: SDK "iphoneos0.1" cannot be located.
Command /bin/sh failed with exit code 64

I then tried with a coworker who has xCode 8 (and therefore base sdk=10.0), the error was
xcodebuild: error: SDK "iphoneos0.0" cannot be located.

Any idea how to force the compilation ?

ben ben
Answer Source

You are buiding your library with an old build script. Checkout my answer here

Build fat static library (device + simulator) using Xcode and SDK 4+

and update your script then you should be fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download