R.swift icon indicating copy to clipboard operation
R.swift copied to clipboard

Build failed for simulator on M1

Open guyaumetremblay opened this issue 1 year ago • 7 comments

Hi,

We just migrate from Cocoapod to SPM for this librairie in our projet. When we try to launch the app on a simulator, we got this error in R.generated:

Could not find module 'RswiftResources' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: /[redacted]/Build/Products/Debug-iphonesimulator/RswiftResources.swiftmodule

We tried every solutions about this kind of error (e.g. changing the value of Build Active Architecture Only and Always Embed Swift Standard Libraries ).

Seems there is nothing to do on our side when the dependencies come from SPM.

Thanks in advance

guyaumetremblay avatar Feb 07 '23 21:02 guyaumetremblay

I'm also seeing this issue, running on master:

Screenshot 2023-02-08 at 10 33 00 am

I also had to fork the repo as I could never get the correct R.Swift package to return in SPM

Screenshot 2023-02-08 at 10 31 17 am

pnicholls avatar Feb 07 '23 23:02 pnicholls

I too am having this issue on M1 laptop. Messed with Build Active Architecture Only as well. Now im getting the error "Command PhaseScriptExecution failed with a nonzero exit code"

deloitteshalem avatar Feb 08 '23 17:02 deloitteshalem

Same error here

alexiscreuzot avatar Feb 21 '23 16:02 alexiscreuzot

Same error too

tmiyamon avatar Feb 27 '23 08:02 tmiyamon

Unfortunately, I cannot reproduce this. If I create a new project with R.swift and point it at the iPhone Simulator it work.

This seems to be a generic Xcode problem. Have you tried the usual Clean build project, Delete Derived Data, reboot Mac?

If the issue still remains, can you try to create a minimal sample project that demonstrates the issue?

tomlokhorst avatar Mar 05 '23 13:03 tomlokhorst

facing the same issue. if I open Xcode using Rosetta it builds and runs successfully on the simulator.

idan-tap avatar Mar 08 '23 06:03 idan-tap

I just found the reason and solution for my project. I'm not sure I remember why but, when we started to have some devs with M1 and Intel in the same team, we had to exclude the arch arm64 in the project and for all dependencies in the podfile. It seems that this is not necessary anymore!

So, in the project config, I removed arm64 for Excluded Architectures. Also, in the PodFile, I removed :

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

Did a pod install, clean the build folder and retry! Works on my M1 and an Intel.

@tomlokhorst this issue is fixed for me!

guyaumetremblay avatar Mar 09 '23 17:03 guyaumetremblay