#65573 closed defect (fixed)

libgcc12: build fails for macOS 12.6 and 13 Beta

Reported by: adamgao1996 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: monterey Cc: matteocorti (Matteo Corti), markemer (Mark Anderson), mascguy (Christopher Nielsen), cgilles (HumanDynamo)
Port: libgcc12

Description (last modified by kencu (Ken))

0  0x1010a01a0  __assert_rtn + 140
1  0x100f27a8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2  0x100ef9d38  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  0x100f624ac  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4  0x100f65360  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
5  0x193537674  _dispatch_client_callout2 + 20
6  0x19354b0e8  _dispatch_apply_invoke + 224
7  0x193537634  _dispatch_client_callout + 20
8  0x193549184  _dispatch_root_queue_drain + 684
9  0x193549884  _dispatch_worker_thread2 + 164
10  0x1936ba0c4  _pthread_wqthread + 228
A linker snapshot was created at:
	/tmp/libstdc++.6.dylib-2022-07-29-182559.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[6]: *** [libstdc++.la] Error 1
make[6]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3/src'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3'
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
make: *** [bootstrap-lean] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build" && /usr/bin/make -j10 -w bootstrap-lean 
Exit code: 2
Error: Failed to build libgcc12: command execution failed
DEBUG: Error code: CHILDSTATUS 93705 2
DEBUG: Backtrace: command execution failed
    while executing
"system {*}$notty {*}$callback {*}$nice $fullcmdstring"
    invoked from within
"command_exec -callback portprogress::target_progress_callback build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port libgcc12 failed

Attachments (1)

libgcc12-12.2.0_0-macOS12-Xcode14-main.log.gz (1.4 MB) - added by mopihopi 19 months ago.
libgcc12 @12.2.0_0 build from source on macOS 12.6 x86_64 with Xcode 14.0

Download all attachments as: .zip

Change History (22)

comment:1 Changed 21 months ago by kencu (Ken)

Description: modified (diff)
Keywords: uhd libgcc removed
Priority: HighNormal

comment:2 Changed 21 months ago by kencu (Ken)

strange error...

any idea why you are not getting the prebuilt libgcc12 binary?

https://packages.macports.org/libgcc12/libgcc12-12.1.0_6+stdlib_flag.darwin_21.arm64.tbz2

comment:3 Changed 21 months ago by adamgao1996

Thanks for the fast reply.

where should i put the prebuild file?

Just for documentation purpose:

My mac system is version 13.0 Beta (22A5311f)

I installed macport from source code in folder /opt

comment:4 Changed 21 months ago by kencu (Ken)

OK, that's why you didn't get the binary for darwin 21 -- you're on darwin 22 :>

If you can, please zip up and attach the log.

comment:5 Changed 21 months ago by kencu (Ken)

Summary: Error: Failed to build libgcc12: command execution failedError: Failed to build libgcc12 on mac system is version 13.0 Beta (22A5311f)

comment:6 Changed 21 months ago by kencu (Ken)

Summary: Error: Failed to build libgcc12 on mac system is version 13.0 Beta (22A5311f)Error: Failed to build libgcc12 on mac system version 13.0 Beta (22A5311f)

comment:7 Changed 21 months ago by kencu (Ken)

I'm not sure if gcc12 builds on darwin 22 yet. You could check with the darwin maintainer directly:

https://github.com/iains

and open an issue with him there in his gcc12 repo -- you'll get a much faster and probably accurate response directly from Iain.

comment:8 Changed 21 months ago by adamgao1996

thanks.

comment:9 Changed 20 months ago by matteocorti (Matteo Corti)

Cc: matteocorti added

comment:10 Changed 20 months ago by markemer (Mark Anderson)

Cc: markemer added

comment:11 Changed 19 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:12 Changed 19 months ago by mopihopi

The same ld assertion failure is seen on macOS 12.6 x86_64 when building libgcc12 (or libgcc-devel, ticket:65850) from source with Xcode 14.0, so this is not specific to macOS 13 or arm64.

Last edited 19 months ago by mopihopi (previous) (diff)

Changed 19 months ago by mopihopi

libgcc12 @12.2.0_0 build from source on macOS 12.6 x86_64 with Xcode 14.0

comment:13 Changed 19 months ago by mascguy (Christopher Nielsen)

Keywords: monterey added
Summary: Error: Failed to build libgcc12 on mac system version 13.0 Beta (22A5311f)libgcc12: build fails for macOS 12.6 and 13 Beta
Version: 2.7.2

Related ticket, for libgcc-devel: issue:65850

comment:14 Changed 19 months ago by michaelld (Michael Dickens)

I've seen this and #65850 for a while ... I did a little code poking ... my best guess is that GCC's build system needs to be tweaked for Darwin 22 ... just a guess. I have not yet contacted Iain yet ... maybe @kencu can do that? Lack of GCC is holding back critical ports when using Xcode 14 or (so I understand) macOS 13-beta + Xcode 14-beta ... like OpenBLAS, NumPy, SciPy, etc. ...

comment:16 Changed 19 months ago by ttelford (Troy Telford)

I've had this issue for a while, and I can say exactly why I can't use the prebuilt binary: Unavoidable corporate proxy forbids access to the prebuilt versions.

I see the error from macOS 12.5.1

comment:17 Changed 19 months ago by matteocorti (Matteo Corti)

With the latest beta of the Xcode command line tools (Command Line Tools for Xcode 14.1 beta 3, September 27 2022) the problem is solved.

comment:18 Changed 18 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: cgilles added

Has duplicate #65943.

comment:19 Changed 18 months ago by soapdog (Andre Alves Garzia)

This is still happening on macOS Ventura with Xcode 14.1 RC 2 with the Command Line Tools reinstalled after installing the RC 2.

:info:build 0  0x1009cc1a0  __assert_rtn + 140
:info:build 1  0x100853a8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
:info:build 2  0x100825d38  mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
:info:build 3  0x10088e4ac  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
:info:build 4  0x100891360  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
:info:build 5  0x1b3627544  _dispatch_client_callout2 + 20
:info:build 6  0x1b363b024  _dispatch_apply_invoke + 224
:info:build 7  0x1b3627504  _dispatch_client_callout + 20
:info:build 8  0x1b36390b4  _dispatch_root_queue_drain + 684
:info:build 9  0x1b36397c0  _dispatch_worker_thread2 + 164
:info:build 10  0x1b37aa0c4  _pthread_wqthread + 228
:info:build A linker snapshot was created at:
:info:build 	/tmp/libstdc++.6.dylib-2022-10-27-130036.ld-snapshot
:info:build ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
:info:build collect2: error: ld returned 1 exit status
:info:build make[6]: *** [libstdc++.la] Error 1
:info:build make[6]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3/src'
:info:build make[5]: *** [all-recursive] Error 1
:info:build make[5]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3/src'
:info:build make[4]: *** [all-recursive] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3'
:info:build make[3]: *** [all] Error 2
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build/arm64-apple-darwin22/libstdc++-v3'
:info:build make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
:info:build make[1]: *** [stage1-bubble] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
:info:build make: *** [bootstrap-lean] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc12/libgcc12/work/build" && /usr/bin/make -j8 -w bootstrap-lean 
:info:build Exit code: 2
:error:build Failed to build libgcc12: command execution failed
:debug:build Error code: CHILDSTATUS 48019 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"

Versions used:

agarzia@Andres-MacBook-Air Desktop % xcodebuild -version
Xcode 14.1
Build version 14B47b

This version is coming from the tools inside the Xcode 14.1 RC 2 bundle:

agarzia@Andres-MacBook-Air Documentation % gcc -v
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
agarzia@Andres-MacBook-Air Documentation %

comment:20 Changed 18 months ago by soapdog (Andre Alves Garzia)

Even though the version numbers in the command-line tools in Xcode 14.1 RC 2 and the downloadable RC 2 CLT-only package from Apple are the same, this package will fail to build with the one bundled in Xcode and build successfully with the one from the CLT-only package. It is very strange since in theory they're the exact same dev tools.

comment:21 Changed 16 months ago by cjones051073 (Chris Jones)

Resolution: fixed
Status: newclosed

This issue now appears resolved, as gcc12 builds fine using the latest Xcodes on macos 12 and 13

Note: See TracTickets for help on using tickets.