#65924 closed defect (fixed)
Linker crash when using GCC 12
Reported by: | szhorvat (Szabolcs Horvát) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | cjones051073 (Chris Jones) | |
Port: | gcc12 |
Description (last modified by szhorvat (Szabolcs Horvát))
When I use GCC 12 to build a certain project, the linker crashes at the final linking stage. This happens on an M1 Mac with the following OS:
ProductName: macOS ProductVersion: 12.6 BuildVersion: 21G115
It does NOT happen on an Intel Mac with:
ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: 18G9323
The project I was trying to build is igraph, see https://github.com/igraph/igraph/ For reference, the build command was:
mkdir build && cd build CC=gcc-mp-12 CXX=g++-mp-12 cmake .. -DBUILD_SHARED_LIBS=ON cmake --build .
The error from the linking step is:
0 0x1011901a0 __assert_rtn + 140 1 0x101017a8c mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536 2 0x100fe9d38 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 0x1010524ac ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468 4 0x101055360 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56 5 0x1b86d81f4 _dispatch_client_callout2 + 20 6 0x1b86eb954 _dispatch_apply_invoke + 224 7 0x1b86d81b4 _dispatch_client_callout + 20 8 0x1b86e9a04 _dispatch_root_queue_drain + 680 9 0x1b86ea104 _dispatch_worker_thread2 + 164 10 0x1b8898324 _pthread_wqthread + 228 A linker snapshot was created at: /tmp/libigraph.3.0.0.dylib-2022-10-02-195930.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 ninja: build stopped: subcommand failed.
I cannot reproduce this when linking a trivial one-file C++ program, and I could not yet track down what precisely causes the problem. My main machine is the Intel one (where everything works fine), and it's not always convenient for me to use the M1 one.
Notes:
- I have the latest
gcc12
port installed (as of today). - The same happens with
gcc11
.
Attachments (1)
Change History (11)
comment:1 Changed 2 years ago by szhorvat (Szabolcs Horvát)
Description: | modified (diff) |
---|
comment:2 Changed 2 years ago by szhorvat (Szabolcs Horvát)
Description: | modified (diff) |
---|
comment:3 Changed 2 years ago by cjones051073 (Chris Jones)
comment:4 Changed 2 years ago by szhorvat (Szabolcs Horvát)
Reported here: https://github.com/iains/gcc-12-branch/issues/11
comment:5 Changed 2 years ago by mouse07410 (Mouse)
This crash does happen on Intel Mac running Monterey 12.6.1 and Xcode-14.0.1. Current Macports. gcc12 @12.2.0_0+stdlib_flag (active)
.
Linker crashes with:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: polynomi.o has no symbols 0 0x105e0affa __assert_rtn + 139 1 0x105c3e28d mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 4989 2 0x105c2ef8f 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 0x105ca59d4 ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 2036 4 0x105ca8fa0 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 48 5 0x7ff812a8134a _dispatch_client_callout2 + 8 6 0x7ff812a928f5 _dispatch_apply_invoke + 213 7 0x7ff812a81317 _dispatch_client_callout + 8 8 0x7ff812a90c0c _dispatch_root_queue_drain + 673 9 0x7ff812a9125c _dispatch_worker_thread2 + 160 10 0x7ff812c34f8a _pthread_wqthread + 256 A linker snapshot was created at: /tmp/libcryptopp.dylib-2022-11-01-114807.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: *** [libcryptopp.dylib] Error 1
To my surprise, there's no crash report in the system log. I will attach linker snapshot /tmp/ui-r7-2022-11-01-145806.ld-snapshot
.
Changed 2 years ago by mouse07410 (Mouse)
Attachment: | ld-snapshot.tar.xz added |
---|
/tmp/ui-r7-2022-11-01-145806.ld-snapshot
comment:6 Changed 2 years ago by kencu (Ken)
It's a known issue with gcc and certain Xcodes, including 14.0.1 I believe.
comment:7 Changed 2 years ago by cjones051073 (Chris Jones)
This is a bug with Xcode/CLT 14.0.x and thus nothing much we can do from the macPorts side. Best solution is to update to Xcode 14.1, or if this is not an option (an older OS) downgrade to Xcode 13.x.
comment:8 Changed 2 years ago by szhorvat (Szabolcs Horvát)
Xcode 14.1 is now released so I think this can be closed.
comment:9 Changed 2 years ago by kencu (Ken)
Resolution: | → fixed |
---|---|
Status: | new → closed |
fixed by Apple :)
comment:10 Changed 2 years ago by mouse07410 (Mouse)
Upgrading Xcode to 14.1 resolved this problem, like was suggested in the upstream. I concur - we can close this.
We are running precisely the main Darwin developers branches for gcc 10,11, and 12 these days.
https://github.com/iains
I suggest you file an issue against one of the versions there, say the gcc 12 branch
https://github.com/iains/gcc-12-branch/issues
and see what he says.