2

I have a question about excluding the arm64 architectures when building for iOS Simulators on m1 machines using React Native. I have successfully excluded arm64 from general project and pods by adding 'arm64' in every box with Excluded Architectures. It works, but every time I add or remove a new library and use pod install I would have to do exclusion all over again by hand. There are answers for how to solve it by using Podfile post_install, but it doesn't seem to work.

My env:

MacBook Pro M1 Pro
React: 17.0.2
React-Native: 0.66.1
XCode 13

My pod file post_install:

post_install do |installer|
  $RNMBGL.post_install(installer)
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer) <- this line means anything?
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        #this should exclude arm64
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
        config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
      end
    end
end

The similar question I was referring to: Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'

denistepp
  • 489
  • 7
  • 23

1 Answers1

0

I am doing this with the post_install block:

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ARCHS[sdk=iphonesimulator*]'] =  `uname -m`
      end
    end
    flipper_post_install(installer)
  end

It's also a bit better than excluding specifically arm64 on M1, uname -m will inject the current machine architecture.

Hope this helps.

halbano
  • 1,135
  • 14
  • 34
  • `flipper_post_install(installer)` has something to do with this or `config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'uname -m'` is enough? – Brogrammer Jun 13 '23 at 16:10