Building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64 in Xocde 12

Building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64

Please find the below environment details,

Code Block
xcode-select --print-path
/Applications/Xcode-beta.app/Contents/Developer


Code Block
xcodebuild -version
Xcode 12.0
Build version 12A8189h


Code Block
xcodebuild -showsdks
iOS SDKs:
iOS 14.0            -sdk iphoneos14.0
iOS Simulator SDKs:
Simulator - iOS 14.0      -sdk iphonesimulator14.0
macOS SDKs:
DriverKit 20.0         -sdk driverkit.macosx20.0
macOS 11.0           -sdk macosx11.0
tvOS SDKs:
tvOS 14.0            -sdk appletvos14.0
tvOS Simulator SDKs:
Simulator - tvOS 14.0      -sdk appletvsimulator14.0
watchOS SDKs:
watchOS 7.0           -sdk watchos7.0
watchOS Simulator SDKs:
Simulator - watchOS 7.0     -sdk watchsimulator7.0


Code Block
system_profiler SPSoftwareDataType
Software:
  System Software Overview:
   System Version: macOS 10.15.6 (19G73)
   Kernel Version: Darwin 19.6.0
   Boot Volume: Macintosh HD
   Boot Mode: Normal
   Computer Name: Chetana’s Mac mini
   User Name: Deepthi Uma (deepthi)
   Secure Virtual Memory: Enabled
   System Integrity Protection: Enabled
   Time since boot: 22:40


Could you please provide your suggestion?


Note: Same application successfully compiled on Xcode11.6 with iphonesimulatorSDK13.6.


Post not yet marked as solved Up vote post of pak.support Down vote post of pak.support
7.2k views

Answers

I have the same issue - my app was building properly with Xcode12 beta2, the error appeared with beta4 I believe.
Same here with one of our dependencies. Was building fine until beta3.
Can some guys of the Xcode team pay attention to this issue?
This issue has appeared since Beta2. And I downloaded the latest Beta 5 still not work!!!!!!!!
You haven't provided much information here so I can only make guesses.

This might be caused by a project mis-configuration. If you were previously overriding the default value for build architecture please reset that to the default setting "$(STANDARD_ARCHS)".

If you are building from the command line try giving xcodebuild the generic simulator destination.

If that doesn't help please file a feedback item so we can investigate. It will help if you can provide your entire build log.

You can also create a new project from a template and compare build settings between the two to attempt to narrow down what is misconfigured in your project.
You can easily check the problem with the below environment variables,

Code Block
$ARCHS
$ARCHS_STANDARD
$ARCHS_STANDARD_32_64_BIT
$ARCHS_STANDARD_64_BIT
$VALID_ARCHS

Problem

We can able to resolve the problem with the help of hardcode the Standard Architecture to x8664 and Valid Architecture to x8664 for both Library Xcode project(It used for build the static library) and Application generate Xcode project(Used for generate the application).

But the trouble is we are using the same project for both iOS Simulator and iOS Device building. So we can't go with the hardcoded value.

Analysis

For this issue please find my analysis, if anything wrong please correct me.

I have checked the below environment variables in both Xcode11 and Xcode12 while building the library for iOS Simulator and I found the arm_64 appended in all the environment variables in Xcode12.

Xcode 11 Environment Variable values:

Code Block
  export ARCHS="i386 x86_64"
    export ARCHS_STANDARD="i386 x86_64"
    export ARCHS_STANDARD_32_64_BIT="i386 x86_64"
    export ARCHS_STANDARD_64_BIT=x86_64
   export ARCHS_STANDARD_INCLUDING_64_BIT="i386 x86_64"
    export ARCHS_UNIVERSAL_IPHONE_OS="i386 x86_64"
    export VALID_ARCHS="i386 x86_64"

Xcode 12 Environment Variable values:

Code Block
export ARCHS\=arm64\ i386\ x86_64
export ARCHS_STANDARD\=arm64\ i386\ x86_64
export ARCHS_STANDARD_32_64_BIT\=arm64\ i386\ x86_64
export ARCHS_STANDARD_64_BIT\=arm64\ x86_64
export ARCHS_STANDARD_INCLUDING_64_BIT\=arm64\ i386\ x86_64
export ARCHS_UNIVERSAL_IPHONE_OS\=arm64\ i386\ x86_64
export VALID_ARCHS\=arm64\ i386\ x86_64


Could you please provide your quick suggestion?

Note:
  1. The above information is not help then i will file feedback request.

  2. Above environment variable copied from my build log file.

@rbishopapple or any other Apple Guys Any update ??
Just a thought - how about excluding arm64 in "Excluded Architectures" for simulator builds? If yes, what's the exact value to be set? I just tried with "arm64", no luck.
Any update?
I filed a Feedback regarding this and Apple closed it saying it is an expected behavior without any proper clarification. Such a waste!
I tried some approach that worked for me and I have described it here. Still finding its loopholes though.
I can't run the simulator anymore on MacBook Pro & Xcode 12. What's the fix for this?

library built using clang
  • m64 -miphoneos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk

App built using standard arch

linker output:
building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
Any answers?
We're also experiencing this when running the following command:

xcodebuild -workspace ios/ExampleApp.xcworkspace -scheme ExampleApp -destination 'generic/platform=iOS Simulator' -configuration Debug -derivedDataPath ios/build

The way I read this error is that a XCFramework that we're using is built for 86_64 but the iOS Simulator launched is 64.
I can't understand why something that's built for both 86 and 64 doesn't work for an 64 device.

Maybe using another iOS Simulator device or version (and 86 one, maybe an older simulator) would work???

Does anyone else make more sense of that error?