I used the migration assistant to migrate from a 2014 MacBook Air to a M1 chip Mac Mini. Part of the migration moved my Xcode projects 11.3.1 to the new Mac mini. I subsequently downloaded Xcode 12.3 to the Mac Mini and used it to build the projects. Three of the projects are static libraries and one is the consumer of the libraries.
The builds for the static libraries uses a Run Script with XCodeBuild for iphoneos and iphonesimulator and then lipo to build a universal library. Finally the universal library is copied to the consumer.
On Xcode12 Mac mini I was getting errors from lipo stating that both have arm64 slices and could not build. I used ONLYACTIVEARCH=NO and Yes in various efforts to try to remove the arm64 from the iphoneos to no avail. Also the build settings was sticky with exclude architectures and would not delete entries.
After a few very frustrating days combing the web for solutions that mainly dealt with excluding arm64 from the simulator I gave up and just built a iphoneos .a file and a iphonesimulator .a file and moved them to the consumer project. This worked so I created a "sim" version of my consumer prjoject and a iphoneos debug version. This worked and even better because of the -swift.h headers for both simulator and iphoneos.
But I am now unable to copy the files in my Run Script as it gives me "permission denied" errors on my cp command. I think it is because the ouput files are marked read only as well as the directories created in the build folders. This may be a migration issue and what user runs Xcode. Apparently not my userid (which is Admin and the installer of Xcode 12).
Scripting on Linux is not my strong suit so maybe some errors in the copy but the Xcodebuild issue with arm64 may be a bug. However, the copy worked fine on the Macbook air Xcode 11.3.1.
One possible issue is The MacBook Air was given to me by my son and it is still called name as owner. This may the permissions issues as the projects migrated over to the new Mac mini.
Below is the pervious Run Script and the new run script:
Xcode 11.3.1 Run Script on intel Mac Air
xcodebuild -target AppLibrary -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x8664 -arch i386 -arch armv7 -arch armv7s -arch arm64 BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILDROOT}"
echo UNIVERSALOUTPUTFOLDER
cp -R "/Users/davidsmaltz/Documents/afsLibrary/AppLibrary/Build/Products/Debug-universal/" "/Users/davidsmaltz/Documents/afsLibrary/MyApp/Debug-universal/"
New Mac mini Xcode 12 Run Script
xcodebuild -target afsViewControlManager ONLYACTIVEARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILDROOT}"
xcodebuild -target afsViewControlManager -configuration ${CONFIGURATION} -sdk iphonesimulator BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILD_ROOT}"
cp -R
"/Users/davidsmaltz/Documents/afsLibrary/afsViewControlManager/Build/Products/Debug-iphonesimulator/libafsViewControlManager.a"
"/Users/davidsmaltz/Documents/afsLibrary/MyAppSim/Debug-universal/"
"/Users/davidsmaltz/Documents/afsLibrary/afsViewControlManager/Build/Products/Debug-iphoneos/libafsViewControlManager.a"
"/Users/davidsmaltz/Documents/afsLibrary/MyApp/Debug-universal/"
Thank You
The builds for the static libraries uses a Run Script with XCodeBuild for iphoneos and iphonesimulator and then lipo to build a universal library. Finally the universal library is copied to the consumer.
On Xcode12 Mac mini I was getting errors from lipo stating that both have arm64 slices and could not build. I used ONLYACTIVEARCH=NO and Yes in various efforts to try to remove the arm64 from the iphoneos to no avail. Also the build settings was sticky with exclude architectures and would not delete entries.
After a few very frustrating days combing the web for solutions that mainly dealt with excluding arm64 from the simulator I gave up and just built a iphoneos .a file and a iphonesimulator .a file and moved them to the consumer project. This worked so I created a "sim" version of my consumer prjoject and a iphoneos debug version. This worked and even better because of the -swift.h headers for both simulator and iphoneos.
But I am now unable to copy the files in my Run Script as it gives me "permission denied" errors on my cp command. I think it is because the ouput files are marked read only as well as the directories created in the build folders. This may be a migration issue and what user runs Xcode. Apparently not my userid (which is Admin and the installer of Xcode 12).
Scripting on Linux is not my strong suit so maybe some errors in the copy but the Xcodebuild issue with arm64 may be a bug. However, the copy worked fine on the Macbook air Xcode 11.3.1.
One possible issue is The MacBook Air was given to me by my son and it is still called name as owner. This may the permissions issues as the projects migrated over to the new Mac mini.
Below is the pervious Run Script and the new run script:
Xcode 11.3.1 Run Script on intel Mac Air
define output folder environment variable
UNIVERSALOUTPUTFOLDER=${BUILDDIR}/${CONFIGURATION}-universalStep 1. Build Device and Simulator versions
xcodebuild -target AppLibrary ONLYACTIVEARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILDROOT}"xcodebuild -target AppLibrary -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x8664 -arch i386 -arch armv7 -arch armv7s -arch arm64 BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILDROOT}"
echo UNIVERSALOUTPUTFOLDER
make sure the output directory exists
mkdir -p "${UNIVERSALOUTPUTFOLDER}"Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSALOUTPUTFOLDER}/lib${PROJECTNAME}.a" "${BUILDDIR}/${CONFIGURATION}-iphoneos/lib${PROJECTNAME}.a" "${BUILDDIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECTNAME}.a"Last touch. copy the header files. Just for convenience
cp -R "${BUILDDIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSALOUTPUTFOLDER}/"cp -R "/Users/davidsmaltz/Documents/afsLibrary/AppLibrary/Build/Products/Debug-universal/" "/Users/davidsmaltz/Documents/afsLibrary/MyApp/Debug-universal/"
New Mac mini Xcode 12 Run Script
xcodebuild -target afsViewControlManager ONLYACTIVEARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILDROOT}"
xcodebuild -target afsViewControlManager -configuration ${CONFIGURATION} -sdk iphonesimulator BUILDDIR="${BUILDDIR}" BUILDROOT="${BUILD_ROOT}"
cp -R
"/Users/davidsmaltz/Documents/afsLibrary/afsViewControlManager/Build/Products/Debug-iphonesimulator/libafsViewControlManager.a"
"/Users/davidsmaltz/Documents/afsLibrary/MyAppSim/Debug-universal/"
"/Users/davidsmaltz/Documents/afsLibrary/afsViewControlManager/Build/Products/Debug-iphoneos/libafsViewControlManager.a"
"/Users/davidsmaltz/Documents/afsLibrary/MyApp/Debug-universal/"
Thank You