16

I have an M1 MacBook Air.

When building for a simulator in Xcode, I am seeing the following warnings and errors:

ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GoogleSignIn.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file 
/Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMAppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuthCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMSessionFetcherCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GIDConfiguration", referenced from:
      objc-class-ref in GlobalState.o
  "_OBJC_CLASS_$_GIDSignIn", referenced from:
      objc-class-ref in GoogleAuthService.o
      objc-class-ref in GoogleRefreshTokenService.o
      objc-class-ref in InvisibleComputersAppApp.o
  "_OBJC_CLASS_$_GIDSignInButton", referenced from:
      objc-class-ref in LoginView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This sounds to me like Xcode is somehow trying to build an x86 binary? Why is it even trying to do that, aren't the simulators arm based on the M1 Macs?

How can I

5
  • Check project settings and .xcconfig files - probably there is there x86_64 architecture set.
    – Asperi
    Commented Oct 31, 2021 at 14:37
  • @Asperi what would this look like? Commented Oct 31, 2021 at 15:39
  • Under "Architectures" it says "Standard Architectures (arm64, armv7) - $(ARCHIS STANDARD) Commented Oct 31, 2021 at 15:41
  • Hey @Asperi - yes, I found a settings. I had previously been following a stack overflow answer to disable ARM builds for simulator, due to some other issue... now after switching to an M1 Mac, this has bitten me. Commented Oct 31, 2021 at 19:24
  • 3
    Got the same. Did you find out?
    – EagleOne
    Commented Dec 11, 2021 at 23:08

3 Answers 3

10

I spent 3 days on this issue beating my head against the wall. Today, I finally cracked it and understood the problem.

I am working on a highly modular project with ~100 frameworks. When migrating from the X86_64 (Intel) architecture to arm64 (M1) I was always getting this error:

Could not find module 'MyModule' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at /my/path/

when building natively on M1.

The reason is that the simulator runs natively on M1 but the simulated app runs still under Intel. That's why the x86_64 architecture was built in the first place.

The two architectures are now beating each other as the simulator is arm64 while the simulated app is X86_64. Removing the arm64 architecture for the pods and project settings fixed the issue and I can build the project entirely on M1 now.

Here are screenshots from the ActivityMonitor. AchieveMe is the app running in the simulator.

enter image description here enter image description here

To fix the problem for Cocoapods you can simply do:

target.build_configurations.each do |config|
  config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end

I am using XcodeGen and there it can simply be added under debug configuration as:

YourSettings
...
configs:
      Debug:
        EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64

Best of luck, I hope it helps. I can sleep in peace now.

5
  • Hello I'm trying to test my Unity game on Xcode. Unfortunately, Unity exports builds for iOS Simulator with x86_64 architecture and I'm currently on M1 Silicon Mac. If I understand correctly, Xcode on Silicon Mac only has arm64 Simulators. Is it still possible to test my x86_64 build?
    – A.Tikadze
    Commented Apr 28, 2023 at 12:30
  • 2
    Hi @A.Tikadze, with the latest Xcode 14.3 Apple shipped ARM64 so as X86_64 simulators, therefore you should be able to do that. You can enable it under Product -> Destination Architecture -> Show Both, then you will be able to select Rosetta simulator. Good luck there! Commented Apr 29, 2023 at 14:01
  • 1
    Yep, I was able to do that Thanks
    – A.Tikadze
    Commented May 1, 2023 at 9:01
  • This is a useful workaround, thanks. The question I'm really hoping to find the answer for is how to get the simulated app to run under arm64 rather than x64. By the sounds of it, I just need to update Xcode to 14.3 (and select an arm64 destination)? Commented Jul 14, 2023 at 16:29
  • Hi Andrew, yes, that is correct, I don't think you have any other option. Commented Jul 17, 2023 at 13:04
1

You can try opening Xcode with "Open using Rosetta" check ON.

  1. Quit Xcode
  2. Go to your Applications folder
  3. Right click Xcode then select "Get Info"
  4. Check "Open using Rosetta"
  5. Open Xcode

Open using Rosetta

1
  • 1
    Running Xcode under Rosetta is not supported. Please fix the project to build x86_64 only instead of running under Rosetta. Commented Jun 9, 2022 at 6:08
0

If you have a dependency that does not support arm64, you can tell the build system to skip arm64 (this building x86_64) by adding "arm64" to the list of excluded architectures (EXCLUDED_ARCHS) in your targets' build settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.