[odb-users] Linker error building odb on mac 12

Boris Kolpackov boris at codesynthesis.com
Tue Sep 20 11:21:08 EDT 2022


Cunliffe, Sam <s.cunliffe at ucl.ac.uk> writes:

> > g++-12 --version
> g++-12 (Homebrew GCC 12.2.0) 12.2.0

For completeness, what version of Xcode/Command Line Tools do you have?
If you don't know, `clang --version` output should be sufficient to trace
it back.


> > bpkg build odb at https://pkg.cppget.org/1/beta
> ### full output pasted below but the errors are... ###
> ld: warning: -undefined dynamic_lookup may not work with chained fixups
> 0  0x1022241a0  __assert_rtn + 140
> 1  0x1020aba8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
> 2  0x10207dd38  mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
> 3  0x1020c8180  archive::File<arm64>::makeObjectFileForMember(archive::File<arm64>::Entry const*) const + 1084
> 4  0x1020c7ac8  archive::File<arm64>::File(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, archive::ParserOptions const&) + 856
> 5  0x1020c002c  archive::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, archive::ParserOptions const&) + 388
> 6  0x1020e66d0  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 2016
> 7  0x1020e9360  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
> 8  0x1b81741f4  _dispatch_client_callout2 + 20
> 9  0x1b8187954  _dispatch_apply_invoke + 224
> 10  0x1b81741b4  _dispatch_client_callout + 20
> 11  0x1b8185a04  _dispatch_root_queue_drain + 680
> 12  0x1b8186104  _dispatch_worker_thread2 + 164
> 13  0x1b8334324  _pthread_wqthread + 228
> A linker snapshot was created at:
> 	/tmp/odb.so-2022-09-20-153316.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
> info: failed to update dir{odb-2.5.0-b.23/}
> 
> build2 seemed to install fine, and I have tried adding paths to homebrew
> libs and includes (as suggested). 

GCC 12.2.0 seems to be quite buggy on Mac OS[1] so one thing to try is
GCC 11 (`brew install gcc at 11`).

Also, your error looks very similar to the Xcode 14 ld bug mentioned,
for example[2]. So maybe also try downgrading Xcode/CLT.

[1] https://github.com/Homebrew/homebrew-core/issues/110673
[2] https://github.com/open-source-parsers/jsoncpp/issues/1434



More information about the odb-users mailing list