skip to Main Content

After updating to Xcode 15, I’m no long able to run my code on a simulator. Currently I’m getting the error

building for 'iOS-simulator', but linking in object file (/{project path}/libs/IceLink/libFMIceLinkOpus.a[x86_64][15](bands.o)) built for 'iOS'

When upgrading my Mac to the silicone chip, I did have similar issues where I had to insert this into my Podfile

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            # Needed for building for simulator on M1 Macs
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
    end
end

Online there were similar errors with arm64 architecture, which included updating the Excluded Architectures in the Build Settings. I figured I would do the same with x86_64

enter image description here

And after doing so I received another error when trying to run the code on a simulator

Command PhaseScriptExecution failed with a nonzero exit code

Is this the correct path to go down, or should I look at another path? I’m not sure if adding x86_64 to the Excluded Architectures is just leading me down a rabbit hole when I should be taking another route.

2

Answers


  1. You’re correct to worry that you’re headed down a rabbit hole. The "excluded architectures" and the ONLY_ACTIVE_ARCH settings were hacks that happened to work for a while. They never addressed the problem.

    The fundamental issue is that the architecture is not a valid way to distinguish between device and simulator. For a long time people built "fat" (lipo) libraries based on this assumption, and it kind of worked, but was never actually supported. Then they added various configuration hacks to try to keep this approach working. In fairness, it was all we had since Apple didn’t have a supported solution.

    Apple finally does have a fully supported solution that works well. Your libFMIceLinkOpus library needs to be repackaged as an xcframework so that it can support both device and simulator. The specifics of how to do that depend on how your library is currently built and packaged.

    Login or Signup to reply.
  2. It seems it is caused by Xcode 15’s new linker,add the -ld64 flag under Other Linker Flags i solve this issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search