How to make Xcode Run Script x86_64 compatible - xcode

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

Related

iOS 14, build issue when Framework is integrated - x86_64 simulator

In iOS Framework project, we have Obj C and Swift code, we build a .framework and distribute through our code repo for other app projects to integrate.
The build we generate is an universal framework, so that it works on device as well as simulator.
Recently in Xcode 12 iOS 14, the build generation failed as we use lipo to combine the frameworks for simulator and device architectures as shown here iOS 14, lipo error while creating library for both device and simulator, as suggested in the answer, excluded the arm64 arch from simulator build then the lipo cmd worked and Framework got built, following is the build command(s) we use
simulator:
MySDK -target MySDK ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}/DependentBuilds" EXCLUDED_ARCHS="arm64"
device:
MySDK -target MySDK ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}/DependentBuilds"
Now when this .framework is integrated with other app project(MyProject) using cocoapods. Upon building the project with below command gives following errors
xcodebuild install -scheme MyProject -workspace MyProject.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 8'
Errors
** INSTALL FAILED **
The following build commands failed:
CompileSwift normal x86_64
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal x86_64
/Users/path/to/MyProject/Pods/MySDK/MySDK.framework/Modules/MySDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:21:96: error: 'someStruct' is not a member type of 'MySDK'
#objc public func someMethod(some: args) -> Swift.void)
Note: The project with MySDK(Framework) integrated works fine we run on a device or simulator through Xcode, but when the above command is run it is giving these errors

xcodebuild arch i386 sdk iphonesimulator7.1 errors

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

TestFlight: Invalid Profile: distribution build entitlements must have get-task-allow set to false

After looking through various other ideas here and elsewhere, I still have yet to find an answer to this. I believe it has something to do with the way I'm building the command in the bash script, but I'm not sure. It builds and archives as I would expect, but then when I try to upload to TestFlight, bad things happen. I call TestFlight via curl after the code below.
xcodebuild -target ${PROJ_NAME} -configuration "Ad Hoc"
xcodebuild archive -project "${PROJ_NAME}.xcodeproj" -scheme ${SCHEME_NAME} -configuration "Ad Hoc"
cd ~/Library/Developer/Xcode/Archives
cd ${ARCH_FOLDER}
LATEST_FILE=`ls -rt | tail -1`
cd "$LATEST_FILE/Products/Applications"
xcrun -sdk iphoneos PackageApplication -v ${APP_NAME} -o ${IPA_LOC}/${IPA_NAME}

Xcode 5: 'xcodebuild' fails even on 'Empty Application' template

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.

Error when building using xcodebuild

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.

Resources