I have an xcode Objective-C iPhone static library project. When I build it in xcode I get no errors or warnings. But when I build it using xcodebuild from the command line I get:
"/Developer/usr/bin/gcc" -v -dM -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk -E -arch armv6 -o - -x objective-c /dev/null
gcc-4.2: error trying to exec '/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
I cannot find anything that helps me to understand what the issue is, any ideas?
And yes the /Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 file does exist :-)
For some reason what seemed to fix this for me is actually passing in the architectures to be used.
For instance, this command fails:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4
But this one works:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4 ARCHS=i386
Note, this only failed for me when building against the simulator. Building against the device seemed to work just fine.
Related
Xcode 12.3
Cocoapods 1.10.1
React Native CLI 4.13.1
I am having a recurring failure building a React Native app at the linking stage (library not found for -lRCTTypeSafety) in the Xcode "Archive" Build task. ("Product" > "Archive") It fails with the same error when I run the first "Build" after a "Clean Build Folder".
It does not occur when I run the "Build" task, which usually succeeds, but the "first build after a clean" behavior lines up with how the "Archive" task behaves, which appears to run an implicit "clean" first, so they appear to be a similar failure case.
None of the suggested remediations I've found on-line have worked. I am using the workspace, not the project file. FWIW, I have confirmed the same occurs using xcodebuild. (As opposed to the Xcode gui.) xcodebuild clean build fails reliably, as well as xcodebuild archive, but xcodebuild build succeeds if it isn't the first build after a clean.
Several Pod libraries are missing from the linker command when it fails. On a successful run, the xcodebuild build action has the following additional -L flags in the clang linking command that are missing on the failed attempts:
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/DoubleConversion
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/FBReactNativeSpec
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/Folly
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RNCPicker
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-Core
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-CoreModules
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTAnimation
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTBlob
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTImage
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTLinking
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTNetwork
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTSettings
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTText
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTVibration
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-cxxreact
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsi
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsiexecutor
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsinspector
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/ReactCommon
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/<project>.app
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/Yoga
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/glog
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/react-native-geolocation
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/react-native-maps
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-Core/AccessibilityResources.bundle
A successful build action has no WriteAuxiliaryFile, CompileC, or Libtool log lines, so it appears that the failed first attempt after a clean is actually building the Pod files correctly, just not providing the necessary paths to the linker command.
The Libtool lines for the missing library from a failed build look like:
Libtool /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety/libRCTTypeSafety.a normal (in target 'RCTTypeSafety' from project 'Pods')
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -D -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk -L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety -filelist /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Intermediates.noindex/Pods.build/Release-iphoneos/RCTTypeSafety.build/Objects-normal/arm64/RCTTypeSafety.LinkFileList -dependency_info /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Intermediates.noindex/Pods.build/Release-iphoneos/RCTTypeSafety.build/Objects-normal/arm64/RCTTypeSafety_libtool_dependency_info.dat -o /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety/libRCTTypeSafety.a
and I've checked that the output file libRCTTypeSafety.a is present in the path specified for the -o flag above. The directory that contains the file is included in the missing -L flags provided, so it really looks like there's just some step between compilation and linking that is getting missed.
Any help would be greatly appreciated!
Hello hello community!
So here is my issue, welll not really an issue but the following Run Script compiles my static library and it works great! my only issue is that it doesnt compile it for the simulator and i get a x86_64 error. I know that i could just edit this code to make it compatible can someone tell me what i need to do??
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# Step 1. Build Device and Simulator versions
xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}"
BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}"
In referencing to a "build a framework" project done here. I was able to find that i can add additional builds just by adding an additional "-arch" parameter. and just make the xcodebuild command
xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 -arch x86_86 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
and it solved my problem! just in case anyone had a slow moment like i did. lol
For users having trouble building cordova/phonegap apps to send to Facebook for review of permissions using the following command:
xcodebuild arch i386 sdk iphonesimulator7.1
and getting errors like:
file not found #import ...
Here's the solution:
Follow these instructions:
https://developers.facebook.com/docs/ios/creating-ios-simulator-build-for-review
Use this command to build your app
xcodebuild -project HelloWorld.xcodeproj -arch i386 -target HelloWorld -configuration Debug -sdk iphonesimulator clean build VALID_ARCHS=i386 CONFIGURATION_BUILD_DIR=/Users/pedro/Documents/Cordova/HelloWorld/platforms/ios/build
If you want to read more about it, I found the solution here:
https://groups.google.com/forum/#!topic/oclint-users/GD1a242k_X0
Issues between xcodebuild and Jenkins prompted me to try xcodebuild on a vanilla Empty Application template where it still fails:
>> xcodebuild -target FizzBuzz -sdk iphonesimulator7.0 -arch i386
The following build commands failed:
ProcessPCH /var/folders/64/<someHash>/C/com.apple.DeveloperTools/5.0-5A1413/\
Xcode/SharedPrecompiledHeaders/FizzBuzz-Prefix-<someHash>/FizzBuzz-Prefix.pch.pch
FizzBuzz/FizzBuzz-Prefix.pch
normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
>> xcodebuild -version
Xcode 5.0
Build version 5A1413
What is the proper incantation of xcodebuild?
These 3 were the key issues for me:
xcodebuild was still relying on gcc-4.7 (Command Line Tools installed or not). Check $CC and unset $CC to let clang do its job.
Use the -scheme option with xcodebuild ...
... and ONLY_ACTIVE_ARCH=NO.
I downloaded and installed Xcode 4.2 on Lion. With installed examples, I could build them with Xcode IDE, but I got those error messages when I tried to execute the same project file with xcodebuild.
can't exec '/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/
Developer/Library/Xcode/Plug-ins/LLVM GCC 4.2.xcplugin/Contents/Resources/
cc -arch i386' (No such file or directory)
The problem is that it tries to call "...\cc -arch i386" as a command, but the cc is not in that directory.
What's wrong with this xcodebuild setup? Why xcodebuild tries to call the cc based on the wrong directory information?
During xcodebuild, I need to specify the path of CC, otherwise wrong one got used.
make CC="$PLATFORM_DEVELOPER_BIN_DIR/cc"