Skip to content

linking issue in GCC 12 (Linker bug) #84

Description

@yafshar

@ellio167 I have encountered a linking issue using C++ in the GCC 12 (12.2.0) release.

[ 52%] Linking CXX shared library libkim-api.dylib
...
0  0x10fc07ffa  __assert_rtn + 139
1  0x10fa3b28d  mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 4989
2  0x10fa2bf8f  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  0x10faa29d4  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 2036
4  0x10faa5fa0  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 48
5  0x7ff80714634a  _dispatch_client_callout2 + 8
6  0x7ff8071578f5  _dispatch_apply_invoke + 213
7  0x7ff807146317  _dispatch_client_callout + 8
8  0x7ff807155c0c  _dispatch_root_queue_drain + 673
9  0x7ff80715625c  _dispatch_worker_thread2 + 160
10  0x7ff8072f9f8a  _pthread_wqthread + 256
A linker snapshot was created at:
	/tmp/libkim-api.2.3.0.dylib-2022-10-08-133230.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]: *** [libkim-api.2.3.0.dylib] Error 1
make[1]: *** [CMakeFiles/kim-api.dir/all] Error 2
make: *** [all] Error 2

I did not dig into the issue and used a simple workaround by enabling the C++11 feature with -DCMAKE_CXX_STANDARD=11.
@ellio167, in case someone has the same issue, this is a simple workaround for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions