Xcode 26 Link Error

Using xcode 26 with linker flag -ld_classic,get an error :

0 0x1042b9778 __assert_rtn + 160 1 0x1042bc560 ld::tool::SymbolTableAtom<x86_64>::classicOrdinalForProxy(ld::Atom const*) (.cold.3) + 0 2 0x1041f3da8 ld::tool::SymbolTableAtom<x86_64>::classicOrdinalForProxy(ld::Atom const*) + 172 3 0x1041f4c1c ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 140 4 0x1041f6500 ld::tool::SymbolTableAtom<arm64>::encode() + 396 5 0x1041e83a8 ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke.413 + 36 6 0x182a95b2c _dispatch_call_block_and_release + 32 7 0x182aaf85c _dispatch_client_callout + 16 8 0x182acc478 _dispatch_channel_invoke.cold.5 + 92 9 0x182aa7fa4 _dispatch_root_queue_drain + 736 10 0x182aa85d4 _dispatch_worker_thread2 + 156 11 0x182c49e28 _pthread_wqthread + 232 A linker snapshot was created at: /tmp/app-2025-06-13-215652.ld-snapshot ld: Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5196. clang++: error: linker command failed with exit code 1 (use -v to see invocation)

How Can I Fix This Error?

Does building your project with Xcode 16 produce this error? If so, then that's a regression, and you should file a bug report about it with a reproducible project attached. Then post the FB number here for our reference.

It would also be helpful if you shared more about the library (here and in your bug report). For example:

  • How is it built, and when? Using Xcode or other tools?
  • What happens if you rebuild the library so that you don't need the -ld_classic option?
  • Does it contain multiple architectures? Is it mixing iOS and iOS simulator together in the same binary?
  • What platform is this build for?

— Ed Ford,  DTS Engineer

Hi Ed,

Thanks for your follow-up.

  1. When building with Xcode 16, the project compiles successfully with the -ld_classic flag. If we remove the flag, we get duplicate symbols errors. Our project includes multiple internal libraries, and some of them currently contain overlapping symbols. This isn’t something we can resolve quickly, so for now, we’re relying on -ld_classic for compatibility.

  2. We see the same issue when building with Xcode 16.2 beta (Build 16C5050e). Removing the -ld_classic flag also results in duplicate symbol errors, just like with Xcode 16.0.

  3. The libraries contain both iOS and iOS Simulator architectures.

  4. Our primary target platform is iOS, built for arm64.

We’ll work on producing a minimal reproducible example and file a bug report. I’ll post the Feedback Assistant number here once that’s done.

Best regards,

ZWZ

I’ve filed a report via Feedback Assistant: FB18047963. The report includes the linker snapshot and full Xcode build output from when the issue occurred.

We appreciate you filing FB18047963. Can you try adding -dead_strip -allow_dead_duplicates to your linker options?

I hope that will help you out as a workaround, but you should invest in fixing up your project structure so that you don't have the issues you list in point 1, so that you can entirely remove use of ld_classic from your project. That's the correct long term solution.

— Ed Ford,  DTS Engineer

Several folks have replied above to say that the workaround options don't help them with the circumstances of their project. If you're in that camp, then you'll need to update your library so that it works without requiring -ld_classic, which as I said above, is the correct long-term solution. If you're not aware, ld_classic was deprecated in Xcode 16, and stated in the Xcode 16 Release Notes.

— Ed Ford,  DTS Engineer

@xixihaha1024 said the following in a comment:

clang++: error: unknown argument: '-allow_dead_duplicates' Command Ld failed with a nonzero exit code

The arguments need to be passed through from the clang driver to the linker, so they need to be prefixed with -Xlinker. The complete set of options for the workaround that you need to set in your linker options build setting is -Xlinker -dead_strip -Xlinker -allow_dead_duplicates. I'm sorry I didn't make that clear previously.

— Ed Ford,  DTS Engineer

Mixed ObjC ABI, compiled without category class properties.

how to resolve this warning?

All the information about resolving this warning is above — you can use the workaround flags as I noted above, but its a workaround that does not replace the need to fix the real root cause in your library configuration.

— Ed Ford,  DTS Engineer

1  0x104816d40  ld::tool::SymbolTableAtom<x86_64>::classicOrdinalForProxy(ld::Atom const*) (.cold.3) + 0
2  0x10470c990  ld::tool::SymbolTableAtom<x86_64>::classicOrdinalForProxy(ld::Atom const*) + 176
3  0x10470e430  ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 204
4  0x1047131d8  ld::tool::SymbolTableAtom<arm64>::encode() + 436
5  0x1047003bc  ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke.413 + 36
6  0x18d87eb2c  _dispatch_call_block_and_release + 32
7  0x18d89885c  _dispatch_client_callout + 16
8  0x18d8b54a4  _dispatch_channel_invoke.cold.5 + 92
9  0x18d890fa4  _dispatch_root_queue_drain + 736
10  0x18d8915d4  _dispatch_worker_thread2 + 156
11  0x18da32e28  _pthread_wqthread + 232
A linker snapshot was created at:
	/tmp/newgapp-2025-06-24-165436.ld-snapshot
ld: Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5184.
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

As a senior engineer, based on your experience, could you provide an idea that can solve this mistake?

could you provide an idea that can solve this mistake?

To resolve the root cause of the error message in this thread, you need to rebuild your library with the new linker. The new linker was introduced with Xcode 15, and has benefits over the prior linker (sometimes called ld64 or ld_classic), namely, the introduction of mergable libraries. Configuring your project to use mergeable libraries has the details on that, along with a link to a WWDC session for even more information on the subject.

Adopting the new linker only requires you to remove the -ld_classic option in your build settings, and rebuilding the library. Using the new linker does not require that you make your library mergable, though doing so is recommended so that any app depending on your library can reap the benefits that mergable libraries provide.

— Ed Ford,  DTS Engineer

I filed two Feedback Assistant reports on Xcode 26 Beta 2.

FB18441843 - Xcode 26 Beta 2 Linker Crash - Segmentation fault

FB18442206 - Xcode 26 Beta 2 Linker Crash - Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5196

The first one uses the old linker (-ld64) and the second used the new linker. The -Xlinker -dead_strip -Xlinker -allow_dead_duplicates made no difference.

I just hope the Xcode 26 Linker will link my app someday. Beta 1 and beta 2 were both abject failures.

@DTS Engineer I set other linker Flags -Xlinker,-dead_strip,-Xlinker,-allow_dead_duplicates。

still cause error Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5196. clang++

I also encountered the same problem. Adding -Xlinker -dead_strip -Xlinker -allow_dead_duplicates did not work. It's really a headache

Xcode 26 Link Error
 
 
Q