0

I updated from 13.4 to 13.6.1 and reinstalled Xcode. I have installed gcc (which I believe includes g++) using Homebrew, and have made sure my Homebrew installation is up to date. When I g++ foo.cpp, which used to compile and link cleanly, I now get

ld: warning: ignoring duplicate libraries: '-lgcc'
0  0x1023ef648  __assert_rtn + 72
1  0x102323fac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x102339924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x102346e30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x196db0440  _dispatch_client_callout2 + 20
5  0x196dc3f1c  _dispatch_apply_invoke + 224
6  0x196db0400  _dispatch_client_callout + 20
7  0x196dc1fb8  _dispatch_root_queue_drain + 684
8  0x196dc26c0  _dispatch_worker_thread2 + 164
9  0x196f5c038  _pthread_wqthread + 228
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status

I have no idea what is going on and also have no idea how to figure it out.

1 Answer 1

0

It turns out there is a thread on this issue at https://developer.apple.com/forums/thread/737707?answerId=765203022#765203022.

It is either a bug in the linker newly-implemented for Xcode 15, or else an error in the Apple Silicon output of g++ combined with a linker implementation that crashes instead of returning some kind of error.

The solution that worked for me was g++ foo.cpp -Xlinker -ld_classic (or g++ foo.cpp -Xlinker -ld64).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .