Xcode10.3 linker assertion failure _followOnNexts.count(atom) == 0 when set Order File

when set the Order file in linking on Xcode, link failed

Xcode 10.3,order file is right

0  0x106beb748  __assert_rtn + 129 
1 0x106cce8bc ld::passes::order::Layout::buildFollowOnTables() + 2298
2 0x106ccf2bf ld::passes::order::Layout::doPass() + 23
3 0x106ccf3c7 ld::passes::order::doPass(Options const&, ld::Internal&) + 151
4 0x106bec63c main + 986
A linker snapshot was created at: /tmp/KB-2019-07-12-201917.ld-snapshot ld: Assertion failed: (_followOnNexts.count(atom) == 0), function buildFollowOnTables, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-450.3/src/ld/passes/order.cpp, line 405.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Replies

This is tripping over an assertion within the linker itself. That clearly shouldn’t happen, so this is automatically bugworthy. If you can include a minimal project that reproduces the problem, that’d be grand.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your reply. Xcode link failed when I set order file in my company project. However, when set it in a demo project it’s ok, so I cann’t provide a minimal project, sorry. Others have encountered this problem. https://stackoverflow.com/questions/57883986/xcodebuild-linker-assertion-failure-followonnexts-countatom-0-when-set-ord

However, when set it in a demo project it’s ok, so I cann’t provide a minimal project

Bummer.

Is the bug still present with Xcode 11?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yeah, Xcode has been upgraded to 11 today and the bug is still present.

Xcode has been upgraded to 11 today and the bug is still present.

Bummer.

When

ld
crashes, does it generate a crash report?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

No crash report on iPhone device, only these link error messages:

0 0x105ed4168 __assert_rtn + 127

1 0x105edded4 ld::passes::order::Layout::buildFollowOnTables() (.cold.5) + 0

2 0x105eaadb7 ld::passes::order::Layout::buildFollowOnTables() + 2209

3 0x105eab795 ld::passes::order::Layout::doPass() + 23

4 0x105eab89d ld::passes::order::doPass(Options const&, ld::Internal&) + 151

5 0x105db712f main + 1001

A linker snapshot was created at: /tmp/myApp-2019-09-17-102139.ld-snapshot

ld: Assertion failed: (_followOnNexts.count(atom) == 0), function buildFollowOnTables, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-512.4/src/ld/passes/order.cpp, line 411.

clang: error: linker command failed with exit code 1 (use -v to see invocation)

No crash report on iPhone device

Right, because the linker doesn’t run on your iPhone, it runs on your Mac. Look for a crash report there.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks again, the crash report has been submitted through Feedback Assistant. The bug number is 7367783.

I'm running in to the same linker assertion with Xcode 11.4.1. I was wondering if you've been able to find a solution or workaround for this assertion?

@xindong’s bug (FB7367783) was closed as a dup of a bug from another developer (r. 58990312) and that’s not fixed in any public release of Xcode. However, it may be possible to avoid the crash.

It seems that the problem is triggered by a suboptimal

.o
file in your project, most likely from some third-party SDK. This
.o
file causes problems for a specific linker optimisation. You may be able to prevent the crash by disabling that optimisation. To do this, pass in the
-no_objc_category_merging
flag.

Let us know how you get along.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

In Target's Build Settings -> Other Linker Flags, add two flag: -Xlinker -no_objc_category_merging , this method can make the compile process completed and run app on device successfully. detail reference this page: https://stackoverflow.com/questions/11829512/suppress-instance-method-override-linker-warning-framework-xcode

This method can make project build, but the ld bug also should be fixed as soom as possible