Xcode 15 linking error

Hi, I am getting a linking error when building my app to run against an iOS17 device, using Xcode15. Same project builds and runs fine with Xcode 14 and iOS16. The linking error just says:

clang: error: unable to execute command: Segmentation fault: 11 clang: error: linker command failed due to signal (use -v to see invocation)

Not sure what I should try to overcome this. I can't run my app on an iOS17 device. It builds, links and runs just fine on a simulator.

Post not yet marked as solved Up vote post of zulfishah Down vote post of zulfishah
19k views
  • I had a similar problem

    Ld *** clang: error: unable to execute command: Segmentation fault: 11 clang: error: linker command failed due to signal (use -v to see invocation)

  • My issue had to do with some SPM repositories, and how they were being reset to v1.0 when set to "Exact Match" to an older version. This seems to be a bug with Xcode 15 Beta1 (FB12283412). Setting it 'Up to Major Version' from 1.0 to the last acceptable version worked for me.

  • Working now after I added "-ld64" to "Other linker Flags". Thank you @songme

Replies

The question is: will adding the -ld64 flag be disturbing once the big is fixed?

will adding the -ld64 flag be disturbing once the big is fixed?

Ultimately you’ll want to remove that flag and switch back to the default of ld_prime [1].

When you add a workaround like this, my general advice is that you make a note to retest on each new beta release of Xcode as they get seeded. Indeed, at least some of the bugs referenced in this thread have been fixed in 15.0b4.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] If history is anything to go by, ld64 support will be removed at some point.

Thanks. adding -ld64 flag also fixed our deploy issue. 👍🏻

But could somebody please explain what this flag is and what it does?

But could somebody please explain what this flag is and what it does?

It disables ld_prime. “What’s ld_prime?”, I hear you ask! Well, I discuss that in An Apple Library Primer.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is this fixed? I can't add "-ld64" to the project settings because CI uses Xcode 14 and Xcode 14 does not recognise the flag.

  • Moreover, I can't go back to Xcode 14 because MacOS Sonoma does not work with Xcode 14 anymore.

  • Yes you can run Xcode 14 on Sonoma. Right click the Xcode 14 app icon -> show contents -> browse Contents/MacOS -> Run Xcode

    I don't know why Apple puts a stop sign on old Xcode versions when they release a new OS version. Ive been running Xcode 14 since Sonoma came out with no issues. I guess they don't want to spend time supporting older versions if something breaks.

    I would suggest you uninstall Xcode from App Store and instead use this excellent app: https://www.xcodes.app

Add a Comment

Is this fixed?

The issue here is that there isn’t a single issue. Xcode 15 includes a new linker and various have discovered various problems with it. With specific details as to what problem you’re hitting, it’s hard to say whether it’s been fixed.

If you want to drive a fix for your specific problem, I encourage you to file a bug with your problem’s details. I offer specific advice on that front in my posts on this thread.

CI uses Xcode 14

Using different Xcode versions at your desk versus in your CI is going to lead to all sorts of weird problems. I strongly recommend that you either move your CI forward or your desk back.

Moreover, I can't go back to Xcode 14 because macOS Sonoma does not work with Xcode 14 anymore.

Indeed. If you decide to move your desk back then you’ll need to go back to macOS 13 as well.

Having said that, it is possible to conditionalise your linker flags such that you apply -ld_classic (note that flag has been renamed) only when building with the latest SDK, and thus with the latest Xcode.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Updating Firebase from 10.2 to 10.16 resolved the issue for me. The previously used BoringSSL-GRPC dependency, which caused the error for me, is now also gone.

I'm using Xcode14.3.1, and added '-ld64' in other linker flags too, but it still gets wrong "library not found for -ld64". Could somebody help me!!!

You can enable Rosetta in Xcode as a destination for the simulators. After enabling these in Product > Destination > Destination Architectures > Show Rosetta Destinations you can choose those in Xcode and the builds start working again.