[MacPorts] #65924: Linker crash when using GCC 12

MacPorts noreply at macports.org
Sun Oct 2 17:59:48 UTC 2022


#65924: Linker crash when using GCC 12
-----------------------+--------------------
  Reporter:  szhorvat  |      Owner:  (none)
      Type:  defect    |     Status:  new
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:
Resolution:            |   Keywords:
      Port:  gcc12     |
-----------------------+--------------------
Description changed by szhorvat:

Old description:

> 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`.

New description:

 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`.

--

-- 
Ticket URL: <https://trac.macports.org/ticket/65924#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list