Opened 3 years ago

Closed 3 years ago

#63677 closed defect (fixed)

libgcc11 11.2.0_1 fails to build on Monterey

Reported by: jwhowarth Owned by: Knapoc <Knapoc@…>
Priority: Normal Milestone:
Component: ports Version: 2.7.99
Keywords: Cc: amake (Aaron Madlon-Kay), devernay (Frédéric Devernay), breiter (Brian Reiter), astroboylrx (Rixin Li), imgx64, xroblot, mascguy (Christopher Nielsen), fracai, judaew (Vadym-Valdis Yudaiev), Sebastian-Maier (Sebastian Maier), cjones051073 (Chris Jones), ilTofa (Giacomo Tufano), hakante (HåkanT), luillo76, cooljeanius (Eric Gallager), diochnos, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: libgcc11

Description

libgcc11 11.2.0_1 fails to build on Monterey with the error....

:info:build Error: configuring for an unreleased macOS version x86_64-apple-darwin21
:info:build make[2]: *** [configure-stage1-gcc] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/build'
:info:build make[1]: *** [stage1-bubble] Error 2

Attachments (6)

patch-monterey.diff (3.5 KB) - added by jwhowarth 3 years ago.
patch currently used by home-brew to solve build failures on Monterey
main.log_on_Intel_Mac.zip (2.5 MB) - added by astroboylrx (Rixin Li) 3 years ago.
Full log of a failed build on an Intel Mac
main.log.gz (1.7 MB) - added by hakante (HåkanT) 3 years ago.
/libgcc11/main.log
config.log.gz (4.2 KB) - added by hakante (HåkanT) 3 years ago.
/libgcc11/work/build/arm64-apple-darwin21/libgomp/config.log
gcc11_patch_macOS12_arm64 (1.2 KB) - added by JohnPritchard (Johnny P) 3 years ago.
main.log.2.gz (43.9 KB) - added by diochnos 3 years ago.

Change History (58)

Changed 3 years ago by jwhowarth

Attachment: patch-monterey.diff added

patch currently used by home-brew to solve build failures on Monterey

comment:1 Changed 3 years ago by amake (Aaron Madlon-Kay)

Cc: amake added

comment:2 Changed 3 years ago by devernay (Frédéric Devernay)

Cc: devernay added

comment:3 Changed 3 years ago by devernay (Frédéric Devernay)

port configures fine with attached patch, but then fails with:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/build/./gcc/xgcc -B/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/build/./gcc/ -xc++ -nostdinc /dev/null -S -o /dev/null -fself-test=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/gcc-11.2.0/gcc/testsuite/selftests
xgcc: warning: could not understand version 12.0
xgcc: warning: could not understand version 12.0
<built-in>: error: unknown value '12.0' of '-mmacosx-version-min'
<built-in>: error: unknown value '12.0' of '-mmacosx-version-min'
-fself-test: 64067 pass(es) in 1.185077 seconds
make[3]: *** [s-selftest-c] Error 1
Last edited 3 years ago by devernay (Frédéric Devernay) (previous) (diff)

comment:4 Changed 3 years ago by devernay (Frédéric Devernay)

Last edited 3 years ago by devernay (Frédéric Devernay) (previous) (diff)

comment:5 Changed 3 years ago by breiter (Brian Reiter)

Cc: breiter added

comment:6 Changed 3 years ago by Knapoc <Knapoc@…>

Owner: set to Knapoc <Knapoc@…>
Resolution: fixed
Status: newclosed

In 7f9e2fb69924a606ed00a7c09d0d07cfd9a0604b/macports-ports (master):

gcc11: add macOS 12 support

Closes: #63677

comment:7 Changed 3 years ago by imgx64

Resolution: fixed
Status: closedreopened

I'm still unable to build libgcc11 on macOS 12. But now the error is different.

Note that I'm on M1 Mac Mini and don't have Rosetta installed.

:info:build checking whether we are cross compiling... configure: error: in `/opt/local/var/macports/build/_opt_local_macports-ports_lang_gcc11/libgcc11/work/build/arm64-apple-darwin21/libgomp':
:info:build configure: error: cannot run C compiled programs.
:info:build If you meant to cross compile, use `--host'.
:info:build See `config.log' for more details
:info:build make[2]: *** [configure-stage1-target-libgomp] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_macports-ports_lang_gcc11/libgcc11/work/build'
:info:build make[1]: *** [stage1-bubble] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_macports-ports_lang_gcc11/libgcc11/work/build'
:info:build make: *** [bootstrap-lean] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_macports-ports_lang_gcc11/libgcc11/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_macports-ports_lang_gcc11/libgcc11/work/build" && /usr/bin/make -j8 -w bootstrap-lean 
:info:build Exit code: 2
:error:build Failed to build libgcc11: command execution failed
:debug:build Error code: CHILDSTATUS 92846 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_macports-ports_lang_gcc11/libgcc11/main.log for details.

comment:8 Changed 3 years ago by abey79 (Antoine Beyeler)

I have the exact same error as imgx64 on a new M1 Max MBP under Monterey.

comment:9 Changed 3 years ago by ednl (Ewoud Dronkert)

I only see libgcc11 11.1.0_2, is that correct? Is 11.2.0_1 a development version which is not (yet) seeded to the general repos, or is it a typo in the version number? In any case, same build problem for me on Monterey M1 Mac Mini (with Rosetta).

Last edited 3 years ago by ednl (Ewoud Dronkert) (previous) (diff)

comment:10 Changed 3 years ago by mpbarlow (Matt Barlow)

Copying my comment from #63698

---

I have found a workaround. The error in config.log is that it cannot find /usr/lib/libgcc_s.1.1.dylib or /usr/local/lib/libgcc_s.1.1.dylib. However, this file is present in the work directory for the port, so after the install failed I ran

sudo cp /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/build/arm64-apple-darwin21/libgcc/libgcc_s.1.1.dylib /usr/local/lib

After that the port built without issue—hopefully there are no further implications from doing this.

comment:11 Changed 3 years ago by abey79 (Antoine Beyeler)

Matt's workaround worked for me.

comment:12 Changed 3 years ago by astroboylrx (Rixin Li)

Cc: astroboylrx added

comment:13 Changed 3 years ago by astroboylrx (Rixin Li)

It seems there was an fix mentioned in #63691 and port selfupdate leads to different error during make:

Comparing stages 2 and 3
warning: gcc/cc1obj-checksum.o differs
warning: gcc/cc1objplus-checksum.o differs
Bootstrap comparison failure!
gcc/tree-ssa-operands.o differs
gcc/tree-ssanames.o differs
gcc/ipa-inline.o differs
gcc/tree-ssa-pre.o differs
...

Any suggestions other than putting library outside /opt/local to /usr/local? Thanks in advance.

comment:15 Changed 3 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:16 Changed 3 years ago by imgx64

Cc: imgx64 added

comment:17 in reply to:  14 Changed 3 years ago by astroboylrx (Rixin Li)

Replying to cjones051073:

See https://github.com/macports/macports-ports/commit/a32f923fd3e337be4eae3c8dce70e49c2de1c1ed

Sorry, doesn't seem to work. Same error after this.

comment:18 Changed 3 years ago by xroblot

Cc: xroblot added

comment:19 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:20 Changed 3 years ago by mascguy (Christopher Nielsen)

This port is also failing to build on our Monterey buildbot, blocking builds of numerous dependent ports.

The latest attempt, from today:

https://build.macports.org/builders/ports-12_arm64-builder/builds/1059

comment:21 Changed 3 years ago by fracai

Cc: fracai added

comment:22 Changed 3 years ago by judaew (Vadym-Valdis Yudaiev)

Cc: judaew added

comment:23 Changed 3 years ago by Sebastian-Maier (Sebastian Maier)

Cc: Sebastian-Maier added

comment:24 Changed 3 years ago by Tatsh (Andrew Udvare)

Seems this only affects ARM64 so the title should be updated.

comment:25 in reply to:  24 Changed 3 years ago by astroboylrx (Rixin Li)

Replying to Tatsh:

Seems this only affects ARM64 so the title should be updated.

It also fails on my Intel Mac. I don't think it only affects ARM64.

comment:26 Changed 3 years ago by cjones051073 (Chris Jones)

If it is also affecting Intel builds please can someone running this OS post a full log, just so we can see iff it really is the same error or not. Note the ARM and Intel builds use different versions of gcc 11, from different sources, so could be entirely different issues.

comment:27 Changed 3 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 removed

comment:28 Changed 3 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:29 in reply to:  26 Changed 3 years ago by astroboylrx (Rixin Li)

Replying to cjones051073:

If it is also affecting Intel builds please can someone running this OS post a full log, just so we can see iff it really is the same error or not. Note the ARM and Intel builds use different versions of gcc 11, from different sources, so could be entirely different issues.

This issue was not meant to be dedicated to ARM64 (#63698 was, but was then closed due to duplicate to this issue). The full log may not help because I had to dive into the log and execute the command that failed and then found what happened was Bootstrap comparison failure! (objects differ between the stage 2 and 3 of building). Anyway, I uploaded my main.log just in case it helps.

EDIT: sorry, this error is indeed in the main log. I might confuse it with some previous bugs.

Last edited 3 years ago by astroboylrx (Rixin Li) (previous) (diff)

Changed 3 years ago by astroboylrx (Rixin Li)

Attachment: main.log_on_Intel_Mac.zip added

Full log of a failed build on an Intel Mac

comment:30 Changed 3 years ago by ilTofa (Giacomo Tufano)

Cc: ilTofa added

comment:31 Changed 3 years ago by cjones051073 (Chris Jones)

See https://github.com/macports/macports-ports/commit/573b82fd5df538ea2ad75e2c2373f4727ef3430c

I incorrectly read the home-brew recipe, they in fact apply the patch from the arm branch to both intel and arm builds.

Tested on intel only (no access to an arm machine) and libgcc11 built fine.

comment:32 in reply to:  31 Changed 3 years ago by Sebastian-Maier (Sebastian Maier)

Replying to cjones051073:

See https://github.com/macports/macports-ports/commit/573b82fd5df538ea2ad75e2c2373f4727ef3430c

I incorrectly read the home-brew recipe, they in fact apply the patch from the arm branch to both intel and arm builds.

Tested on intel only (no access to an arm machine) and libgcc11 built fine.

Also works for me on ARM64.
Both libgcc11 and gcc11 built fine now on macOS Monterey (macOS 12.0.1, Darwin 21.1.0, MacPorts 2.7.1).

comment:33 in reply to:  31 Changed 3 years ago by saagarjha (Saagar Jha)

Replying to cjones051073:

See https://github.com/macports/macports-ports/commit/573b82fd5df538ea2ad75e2c2373f4727ef3430c

I incorrectly read the home-brew recipe, they in fact apply the patch from the arm branch to both intel and arm builds.

Tested on intel only (no access to an arm machine) and libgcc11 built fine.

You also probably want to take this patch, otherwise the generated binaries will fail to run: https://github.com/iains/gcc-darwin-arm64/pull/46#issuecomment-864925727

comment:34 Changed 3 years ago by cjones051073 (Chris Jones)

Binaries run fine for me, on Intel. Used to build a number of ports that require fortran...

I'll take a look though.

comment:35 Changed 3 years ago by cjones051073 (Chris Jones)

I suspect that patch is not required, and the one now used supersedes it.

comment:36 Changed 3 years ago by hakante (HåkanT)

I'm still having the issue on M1 silicon after syncing and cleaning when building libgcc11, with the error message matching #63698.

Changed 3 years ago by hakante (HåkanT)

Attachment: main.log.gz added

/libgcc11/main.log

Changed 3 years ago by hakante (HåkanT)

Attachment: config.log.gz added

/libgcc11/work/build/arm64-apple-darwin21/libgomp/config.log

comment:37 Changed 3 years ago by hakante (HåkanT)

Cc: hakante added

comment:38 Changed 3 years ago by cjones051073 (Chris Jones)

I cannot help with arm machines as I do not have access to any. Others though seem to claim it works for them, so try comparing your logs to theirs...

comment:39 in reply to:  31 Changed 3 years ago by astroboylrx (Rixin Li)

Replying to cjones051073:

See https://github.com/macports/macports-ports/commit/573b82fd5df538ea2ad75e2c2373f4727ef3430c

I incorrectly read the home-brew recipe, they in fact apply the patch from the arm branch to both intel and arm builds.

Tested on intel only (no access to an arm machine) and libgcc11 built fine.

The new tree works for Intel Mac. Thank you all very much for patching this port.

Replying to hakante:

I'm still having the issue on M1 silicon after syncing and cleaning when building libgcc11, with the error message matching #63698.

I can confirm that it still fails to build on ARM Mac and shows the same error as shown in #63698.

comment:40 Changed 3 years ago by Sebastian-Maier (Sebastian Maier)

I have no idea why it worked for me on ARM64 but not others.

Maybe because I was pretty aggressive when deleting leftover files from previous build attempts as I used a variation of (1):

sudo rm -rf /opt/local/var/macports/build/*
sudo rm -rf /opt/local/var/macports/distfiles/*
sudo rm -rf /opt/local/var/macports/packages/*

Apart from that, libgcc11 is actually installed in version 11.1.0_2 on ARM64 in accordance with the latest Portfile (and not in version 11.2.0_1 which is used on Intel Macs):

$ port installed libgcc11
The following ports are currently installed:
  libgcc11 @11.1.0_2 (active)
$ uname --processor 
arm64

(1) https://superuser.com/a/165670

comment:41 Changed 3 years ago by manuelmenzella (Manuel Menzella)

I can't get this to work for arm64, unfortunately. I'm getting the same error as above.

:info:build checking whether we are cross compiling... configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/work/build/arm64-apple-darwin21/libgomp':
:info:build configure: error: cannot run C compiled programs.
:info:build If you meant to cross compile, use `--host'.
:info:build See `config.log' for more details
:info:build make[2]: *** [configure-stage1-target-libgomp] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/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_gcc11/libgcc11/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_gcc11/libgcc11/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_gcc11/libgcc11/work/build" && /usr/bin/make -j8 -w bootstrap-lean
:info:build Exit code: 2
:error:build Failed to build libgcc11: command execution failed
:debug:build Error code: CHILDSTATUS 98007 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/main.log for details.

Is there any information I can provide to help debug this?

comment:42 in reply to:  40 ; Changed 3 years ago by astroboylrx (Rixin Li)

Replying to Sebastian-Maier:

I have no idea why it worked for me on ARM64 but not others.

Maybe because I was pretty aggressive when deleting leftover files from previous build attempts as I used a variation of (1):

sudo rm -rf /opt/local/var/macports/build/*
sudo rm -rf /opt/local/var/macports/distfiles/*
sudo rm -rf /opt/local/var/macports/packages/*

This doesn't work for me. The error log complains about cannot run C compiled programs. and says If you meant to cross compile, use '--host'.

I think it may worth trying to add --host=arm or --host=arm64 to the configure step. But I'm not familiar with Portfile. Is there a quick way to do that?

comment:43 in reply to:  40 Changed 3 years ago by imgx64

Replying to Sebastian-Maier:

I have no idea why it worked for me on ARM64 but not others.

Do you have the files /usr/lib/libgcc_s.1.1.dylib or /usr/local/lib/libgcc_s.1.1.dylib as per comment:10? If yes, where did they come from?

comment:44 Changed 3 years ago by Sebastian-Maier (Sebastian Maier)

/usr/local/lib/libgcc_s.1.1.dylib does exist on my MBP (while /usr/lib/libgcc_s.1.1.dylib does not).

According to the creation date, it looks like a leftover from Matt's workaround that I tried several days earlier (seemingly without any success).

The build does not work for me either when I delete this file.

Sorry for the confusion.

comment:45 in reply to:  42 Changed 3 years ago by astroboylrx (Rixin Li)

Replying to astroboylrx:

The error log complains about cannot run C compiled programs. and says If you meant to cross compile, use '--host'.

To add some extra info, trying to install gcc with HomeBrew on macOS 12.0.1 (M1) also runs into the same issue/error.

Changed 3 years ago by JohnPritchard (Johnny P)

Attachment: gcc11_patch_macOS12_arm64 added

comment:46 Changed 3 years ago by JohnPritchard (Johnny P)

I have successfully built libgcc11 (and gcc11) on macOS Monterey arm64 by applying the workaround patch gcc11_patch_macOS12_arm64 (that I have attached to this ticket) which I think addresses the symptoms, rather than curing the problem.

The issues seem to revolve around libgcc_s.1.1.dylib.

The first issue is that when "checking whether we are cross compiling" it is checks for libgcc_s.1.1.dylib only in /usr/lib and /usr/local/lib, so the first part of the patch is to create (and remove) a softlink /usr/local/lib/libgcc_s.1.1.dylib so that it will be found when needed.

The 2nd issue is that once created, libgcc_s.1.1.dylib doesn't have executable permissions, like all the other dylibs created, so the 2nd part of the patch sets the permissions (on all the dylibs, just in case...)

I don't understand why these problems present only for arm64 and not for x86_64 (probably because they are using different versions), I leave that for others to resolve.

comment:47 Changed 3 years ago by luillo76

Cc: luillo76 added

comment:48 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

Changed 3 years ago by diochnos

Attachment: main.log.2.gz added

comment:49 Changed 3 years ago by diochnos

Cc: diochnos added

comment:50 Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:51 Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

I am not sure the patch to fix this problem is actually applied. I have created a pull request that attempts to prevent the patchfiles-append patch-darwin21-support.diff command from being overridden later.

comment:52 Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: reopenedclosed

In 3d0dde8ac41070f5782bf70d082c30d5f3632391/macports-ports (master):

gcc11: ensure all patches are applied

Patch file from
7f9e2fb69924a606ed00a7c09d0d07cfd9a0604b/macports-ports
is lost when patchfile command is later used.

Fixes #63677
No revbump since port either builds correctly or not at all.

Note: See TracTickets for help on using tickets.