Opened 20 months ago

Last modified 19 months ago

#65924 closed defect

Linker crash when using GCC 12 — at Version 1

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-11 CXX=g++-mp-11 cmake .. -DBUILD_SHARED_LIBS=ON
cmake --build .

The error from the linking step is:

0  0x1050541a0  __assert_rtn + 140
1  0x104edba8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2  0x104eadd38  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  0x104f164ac  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4  0x104f19360  ___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-195512.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.

Change History (1)

comment:1 Changed 20 months ago by szhorvat (Szabolcs Horvát)

Description: modified (diff)
Note: See TracTickets for help on using tickets.