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 ?
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.
Related
Using Xcode 13, I generated a framework to distribute via pod for integration, and it was successfully compiling for both device and simulator at the application side.
However, when I used the same xcodebuild command with xcode 14 to generate and distribute the framework, it threw a 'unsupported Swift architecture error' when tried to integrate the framework via pod to application.
The framework is generated using the xcodebuild command.
Command line invocation:/Applications/Xcode_14.0.1.app/Contents/Developer/usr/bin/xcodebuild build -workspace <workSpacePath> -configuration Release -sdk iphonesimulator -scheme <Scheme_name> -derivedDataPath <Derived_path> CODE_SIGNING_ALLOWED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode SKIP_INSTALL=NO
Build settings from command line:
BITCODE_GENERATION_MODE = bitcode
CODE_SIGNING_ALLOWED = NO
ENABLE_BITCODE = YES
SDKROOT = iphonesimulator16.0
SKIP_INSTALL = NO`
I try to update a existing pod, but when I did pod trunk push NAME.podspec, I got this error :
I try several solution from this post Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64_ but none worked(excluded architecture, only active arch).
There is no problem when I run the compilatiton on Xcode, my framework is well generated. The only problem is when I try to pod trunk, or pod lib lint
In my xcode project, In build phase, I run that script :
xcodebuild -target "${TARGET_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 -arch i386 ONLY_ACTIVE_ARCH=NO EXCLUDED_ARCHS="arm64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
If I put ONLY_ACTIVE_ARCH=TRUE, the error message is a bit different :
XCode Version: Version 7.2 (7C68)
Building for PhoneGAP IOS
Commands used:
xcodebuild -project HelloCordova.xcodeproj -scheme HelloCordova -configuration Release -sdk iphonesimulator IDENTIFIER=com.kony.SyncApp build
It used to work well before upgrading Xcode after upgrading to 7.2 , i am facing this issue. And same wokring form XCODE UI
Problem with command line build
Error Info:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
** BUILD FAILED **
The following build commands failed:
ProcessPCH /Users/konysync/Library/Developer/Xcode/DerivedData/HelloCordova-gyroiomjvclmgtfewwtckeoypgfd/Build/Intermediates/PrecompiledHeaders/CordovaLib_Prefix-almeazhzuslzcvewimbluxlrnwby/CordovaLib_Prefix.pch.pch CordovaLib_Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
ProcessPCH /Users/konysync/Library/Developer/Xcode/DerivedData/HelloCordova-gyroiomjvclmgtfewwtckeoypgfd/Build/Intermediates/PrecompiledHeaders/CordovaLib_Prefix-bvlrmrstkahcccfcihrhcdumeenk/CordovaLib_Prefix.pch.pch CordovaLib_Prefix.pch normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
found some links , but those links did not help.
Apple LLVM Compiler 3.1 error clang
Unsupported compiler 'com.apple.compilers.llvm.clang.1_0' selected for architecture 'x86_64' on Xcode 7 Beta 2
Clear the cache of pod with
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
Change flipper version in pod file:
use_flipper!({ 'Flipper-Folly' => '2.5' })
And delete the project's Pods directory. The location of it is project directory > ios > Pods.
Then in the project directory > ios location, install pod with pod install
And
react-native run-ios
in project directory.
This is a bug introduced in Xcode 7.2 (and still not fixed as of 7.2.1), see https://openradar.appspot.com/23857648 It seems that xcodebuild is not setting correctly the ARCH and PLATFORM_NAME variables when invoked with -sdk iphonesimulator.
There are two known workarounds at the moment, both involve passing extra flags to xcodebuild:
1) Pass the -destination flag, eg:
xcodebuild [...] -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6'
2) Override the PLATFORM variable, eg:
xcodebuild [...] -sdk iphonesimulator PLATFORM_NAME=iphonesimulator
I had this error after upgrading to React Native 0.68.x
AppDelegate.m changed to AppDelegate.mm
You have to do this: https://github.com/software-mansion/react-native-reanimated/issues/841#issuecomment-636297029 open the project in XCode, then navigate to Build Phases, in Compile Sources remove the AppDelegate.m file and add AppDelegate.mm instead.
If it is not already renamed: Open XCode, rename AppDelegate.m to AppDelegate.mm in the Project Navigator
i have tried to resolve this error many times and follows multiple steps of every one but not worked for me after that i deleted my build folder from project ios directory like react-native-project>ios>Build folder
it worked for me.
I am trying to build iOS projects from the command line as part of a CI system. I intend to use the xcodebuild command to get an app file, then the app file will be provided to the xcrun command to get a signed ipa file for distribution.
My projects use Cordova, which is located in the folder <project-folder>/CordovaLib.
In the project folder, I executed the following command from within an Ant script:
xcodebuild -target "<project-name>" -configuration Release clean build
The CordovaLib target was built succesfully, and it was produced the file:
<project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a
This is visible by the following snippet of log:
[exec] CreateUniversalBinary build/Release-iphoneos/libCordova.a
normal armv7\ armv7s\ arm64 [exec] cd <project-folder>/CordovaLib
[exec] export
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/quake/bin:Applications/tools/apache-ant-1.8.4/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin"
[exec]/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-static <project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7/libCordova.a
<project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7s/libCordova.a
<project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/arm64/libCordova.a
-o <project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a
During the build of the target <project-name> I got the following error for three times:
ld: file not found:
/build/Release-iphoneos/libCordova.a clang: error:
linker command failed with exit code 1 (use -v to see invocation)
And finally:
The following build commands failed: Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7/HelloWorld
normal armv7 Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7s/HelloWorld
normal armv7s Ld
build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/arm64/HelloWorld
normal arm64 (3 failures)
So the file libCordova.a was produced in the folder:
<project-folder>/CordovaLib/build/Release-iphoneos
and it was searched instead in:
<project-folder>/build/Release-iphoneos
I'm using Xcode Version 7.1 (7B91b) with iOS 9.1.
Should I set something on Xcode in addition to the parameters I have used in the xcodebuild command from the command line?
Thanks in advance, Simone.
My project comes from a MEAP IDE. I discovered that the auto-generated project file project.pbxproj had this setting for the linker:
OTHER_LDFLAGS=-force_load "$(BUILT_PRODUCTS_DIR)/libCordova.a" -Obj-C
Hence I modified this way the xcodebuild command invocation:
xcodebuild -target "<project-name>" -configuration Release clean build 'OTHER_LDFLAGS=-force_load "$SRCROOT/CordovaLib/build/Release-iphoneos/libCordova.a" -Obj-C'
That resolved my problem.
I am having one problem that is killing me. Here it is: I have and app project in xCode that goes perfect when I tried to do everything in xCode UI. Which that I mean build, run, test or whatever in all the different targets that I have (3), 2 of the App and one for the tests.
THe problem comes when I tried to install a continous integration to my system in Jenkins. I need to execute some commands in shell for it. Command like this one:
xcodebuild -project MYPROJECT -sdk iphonesimulator -scheme TESTS_SCHEME TEST_AFTER_BUILD=YES
I also have tried with this other one that in the end it does the same:
xcodebuild -project MY_PROJECT -target TEST_TARGET -sdk iphonesimulator -configuration "Debug"
Then is when the problems cames out, the terminal says the following:
....PrecompiledHeaders/MYLIBRARY-Prefix-hhjuztynfruquodlgqxroyfibfkh/MYLIBRARY-Prefix.pch.d
clang: error: invalid architecture 'arm' for deployment target '-mios-simulator-version-min=4.3'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
** BUILD FAILED **
The following build commands failed:
ProcessPCH /Users/nicoyuste/Library/Developer/Xcode/DerivedData/MY_APP-bxpgsdbefuawmiexyikbtvsatlsf/Build/Intermediates/PrecompiledHeaders/MYLIBRARY-Prefix-hhjuztynfruquodlgqxroyfibfkh/MYLIBRARY-Prefix.pch.pth MYLIBRARY-Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
I´ve been looking in the Internet (almost in here) but everything what I found with same problem didn´t work for me. The xCode version is 4.5 and if you do xcodebuild -version is what I get so that´s fine.
I also have tried changing headers files and everything what I have found around but nothing fixes my problem...
any suggestions...
If you're using a custom build script, you can pass -arch i386 to xcodebuild
For instance:
xcodebuild -project MY_PROJECT -target TEST_TARGET -sdk iphonesimulator -configuration "Debug" -arch i386
(Scroll all the way to the right in the code sample above. The relevant flag is -arch i386)
Should force it to build against i386. However, you need to make sure i386 is in your VALID_ARCHS settings for the target.
In case anyone running into the same annoying problem again, I will share my script here:
Remember to run this command under the directory that has the xcodeproj file.
xcodebuild \
-project "full-path-to-your-xcodeproj-file" \
-target YOUR_TARGET \
-sdk iphonesimulator6.1 \
-arch i386 \
-configuration Debug \
VALID_ARCHS="armv6 armv7 i386" \
ONLY_ACTIVE_ARCH=NO \
TARGETED_DEVICE_FAMILY="1" \
clean install
I modified the TARGETED_DEVICE_FAMILY because I only build for iPhone. If you want to build for both iPhone and iPad, delete this line or replace with TARGETED_DEVICE_FAMILY="1, 2".
I am seeing people who is still wondering about this. I posted this question a long time ago. I stopped using xcodebuild and I am using xctool now, it works much better. This tool is developed by Facebook.
I think that the problem reside in that your are building for the simulator specifying arm as the architecture, try changing it to i386
I ran into a similar problem after upgrading to Xcode 4.5 on my build machine. In my case, I have a third-party library that can't be built for armv7s (yet) and so, I set the Architectures build setting to armv7. Worked fine for unit tests, simulator builds, and the like inside of Xcode. However, when I did the command-line build, it failed with the same message.
I changed my Architectures to armv7 i386 and now it seems to build fine at the command line for the simulator.
Despite the GUI indicating that Architectures of Standard (armv7,armv7s) includes just those two, I'm pretty sure there's an i386 hiding there when you build for the simulator.
In the end, that setting works fine now with Jenkins.
I tried below command:
xcodebuild -arch i386 -sdk iphonesimulator7.1
But failed with similar error as clang: error: invalid architecture 'arm' for deployment target '-mios-simulator-version-min=6.0'
Here is how I solved :
xcodebuild -arch i386 VALID_ARCHS="i386 armv7 armv7s" ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator7.1
U need to make u set VALID_ARCHS and ONLY_ACTIVE_ARCH correctly and it will work. You can make these settings on Xcode directly too.