My Mac updated Xcode to version 14.0. After installing the new command line tools I started running into issues with the version of ld
that it ships with. More specifically I have a project I compile with the g++-12 compiler (installed via homebrew) and the linker bombs when I try to compile anything with the following output:
[ 0%] Linking CXX shared library ../../lib/libeckit.dylib
0 0x10675fffa __assert_rtn + 139
1 0x10659328d mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 4989
2 0x106583f8f mach_o::relocatable::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 207
3 0x1065fa9d4 ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 2036
4 0x1065fdfa0 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 48
5 0x7ff80248534a _dispatch_client_callout2 + 8
6 0x7ff8024968f5 _dispatch_apply_invoke + 213
7 0x7ff802485317 _dispatch_client_callout + 8
8 0x7ff802494c0c _dispatch_root_queue_drain + 673
9 0x7ff80249525c _dispatch_worker_thread2 + 160
10 0x7ff802638f8a _pthread_wqthread + 256
A linker snapshot was created at:
/tmp/libeckit.dylib-2022-09-15-112741.ld-snapshot
ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libeckit.dylib] Error 1
I’ve tried reinstalling all the home-brew packages but this didn’t seem to affect anything.
3
Answers
I do not have an answer but I’m seeing a similar problem with GCC-11.
I also had the same problem with GCC-11, but upgraded via brew to GCC-12 in hopes that it would solve the problem. No joy.
This seems to be a recent linker bug, I have found a few references, and I think this SO thread describes a downgrade of xcode/command line tools to work around it until the bug is fixed in xcode 14.