24

I upgraded Xcode to Xcode 12, and build my project. Firstly, it come out an error such as below:

ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/ethanli/Documents/Aspira/RA.com4iOS/RA.com4iOS/source/ReserveAmerica/ReserveAmerica4/External/Mapbox/MapboxMobileEvents.framework/MapboxMobileEvents' for architecture arm64

I wiped out this error by adding "arm64" to Excluded Architecture in Build Settings. Refer to https://developer.apple.com/forums/thread/656509

configuration like this

But... another error came out:

error: Build input file cannot be found: '/Users/ethanli/Library/Developer/Xcode/DerivedData/ReserveAmerica4-cgnruuknmgycgrbadguodtkwspmy/Build/Products/DEBUG-iphonesimulator/ReserveAmerica4.app/ReserveAmerica4' (in target 'ReserveAmerica4' from project 'ReserveAmerica4')

I went to the path in Finder, “ReserveAmerica4” really doesn't exist.

Is there any way to solve this problem?

Ethan Li
  • 489
  • 1
  • 3
  • 8

5 Answers5

24

I resolved this error.

The root reason is that Xcode 12 does not allow build arm64 architecture for Simulator. We should set x86_64 for Simulator building.

  1. Set "Build Active Architecture Only" to "YES" in target Build Settings tab;
  2. Set x86_64 for Simulator: enter image description here

For more answers: Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Ethan Li
  • 489
  • 1
  • 3
  • 8
12

You can fix it in flutter with this

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end
gtr Developer
  • 2,369
  • 16
  • 12
12

I got same error at M1 Silicon. But adding arm64 to Excluded + Build Active Architecture Only did not help because one library failed with: For builds to run in the simulator, this should be set to "x64" error.

Temporary solution that worked for me:

  • in Finder right click on Xcode app;
  • select Get Info;
  • set checkmark Open using Rosetta;
  • reopen Xcode / clean / rebuild;

app info

Oleksandr B
  • 3,400
  • 1
  • 25
  • 28
2
  1. Comment the pod files about Firebase (you may need to comment your program code also), pod file example:

enter image description here

  1. Quit Xcode
  2. pod install
  3. Restart Xcode and build the project
  4. Uncomment the pod files about Firebase
  5. Quit Xcode
  6. pod install again
  7. Restart Xcode and build the project
Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
wai
  • 31
  • 2
  • Tried to both update the pod and delete and reinstall pod, but nothing worked. But this workaround worked perfectly thank you! – Peter Dec 09 '21 at 15:37
1

After doing a lot of things like installing pods, I cloned the project again deleting the previous one, it worked for me.