Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#61494 closed defect (fixed)

gcc9 @9.3.0 "Failed to build libgcc9: command execution failed" in macOS 11.0 Big Sur

Reported by: kgerheiser (Kyle Gerheiser) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur Cc: cjones051073 (Chris Jones), michaelld (Michael Dickens), ericmoret
Port: libgcc9

Description

I updated to Big Sur and attempted to build GCC9 and it fails. GCC 10 worked.

First, there was an error that it couldn't find the command gsed, so I installed it with MacPorts.

Then, more errors:

Looks like it's picking up the macOS version incorrectly and then thinking it's macOS 10.4?

info:build xgcc: warning: couldn't understand version 11.0
...
:info:build ld: warning: building for macOS 10.4 is deprecated
:info:build ld: warning: could not create compact unwind for __Unwind_RaiseException: non-standard register 0 being saved in prolog
:info:build ld: warning: could not create compact unwind for __Unwind_ForcedUnwind: non-standard register 0 being saved in prolog
:info:build ld: warning: could not create compact unwind for __Unwind_Resume: does not use RBP or RSP based frame
:info:build ld: warning: could not create compact unwind for __Unwind_Resume_or_Rethrow: does not use RBP or RSP based frame
:info:build MLIBS=`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc9/libgcc9/
:info:build could not create compact unwind for std::__facet_shims::(anonymous namespace)::money_put_shim<wchar_t>::do_put(std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, bool, std::ios_base&, wchar_t, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) const: dwarf uses DW_CFA_GNU_args_size
:info:build ld: warning: could not create compact unwind for std::money_get<wchar_t, std::istreambuf_iterator<wchar_t, std::char_traits<wchar_t> > >::do_get(std::istreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, std::istreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, bool, std::ios_base&, std::_Ios_Iostate&, long double&) const: dwarf uses DW_CFA_GNU_args_size
:info:build Undefined symbols for architecture x86_64:
:info:build   "__Unwind_DeleteException", referenced from:
:info:build       ___cxa_end_catch in eh_catch.o
:info:build       eh_globals_dtor(void*)  in eh_globals.o
:info:build       ___cxa_tm_cleanup in eh_tm.o
:info:build   "__Unwind_GetDataRelBase", referenced from:
:info:build       base_of_encoded_value(unsigned char, _Unwind_Context*) in eh_personality.o
:info:build   "__Unwind_GetLanguageSpecificData", referenced from:
:info:build       ___gxx_personality_v0 in eh_personality.o
:info:build   "__Unwind_GetRegionStart", referenced from:
:info:build       base_of_encoded_value(unsigned char, _Unwind_Context*) in eh_personality.o
:info:build       parse_lsda_header(_Unwind_Context*, unsigned char const*, lsda_header_info*) in eh_personality.o
:info:build   "__Unwind_GetTextRelBase", referenced from:
:info:build       base_of_encoded_value(unsigned char, _Unwind_Context*) in eh_personality.o
:info:build   "__Unwind_RaiseException", referenced from:
:info:build       std::rethrow_exception(std::__exception_ptr::exception_ptr)  in eh_ptr.o
:info:build       ___cxa_throw in eh_throw.o
:info:build   "__Unwind_Resume", referenced from:
:info:build       std::basic_istream<char, std::char_traits<char> >::ignore(long) in compatibility.o
:info:build       std::basic_istream<wchar_t, std::char_traits<wchar_t> >::ignore(long) in compatibility.o
:info:build       __gnu_cxx::__scoped_lock::~__scoped_lock() [clone .isra.0] in eh_alloc.o
:info:build       ___cxa_call_unexpected in eh_personality.o
:info:build       __cxxabiv1::__terminate(void (*)()) in eh_terminate.o
:info:build       ___cxa_tm_cleanup in eh_tm.o
:info:build       ___cxa_guard_acquire in guard.o
:info:build       ...
:info:build   "__Unwind_Resume_or_Rethrow", referenced from:
:info:build       ___cxa_rethrow in eh_throw.o
:info:build   "__Unwind_SetGR", referenced from:
:info:build       ___gxx_personality_v0 in eh_personality.o
:info:build   "__Unwind_SetIP", referenced from:
:info:build       ___gxx_personality_v0 in eh_personality.o
:info:build ld: symbol(s) not found for architecture x86_64
: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_gcc9/libgcc9/work/build/x86_64-apple-darwin20/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_gcc9/libgcc9/work/build/x86_64-apple-darwin20/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_gcc9/libgcc9/work/build/x86_64-apple-darwin20/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_gcc9/libgcc9/work/build/x86_64-apple-darwin20/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_gcc9/libgcc9/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_gcc9/libgcc9/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_gcc9/libgcc9/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_gcc9/libgcc9/work/build" && /usr/bin/make -j20 -w bootstrap-lean 
:info:build Exit code: 2
:error:build Failed to build libgcc9: command execution failed
:debug:build Error code: CHILDSTATUS 10423 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"

Attachments (2)

main.log (83.9 KB) - added by kgerheiser (Kyle Gerheiser) 3 years ago.
Build log
libgcc9_Xcode_12.2.log.txt.xz (858.4 KB) - added by michaelld (Michael Dickens) 3 years ago.

Download all attachments as: .zip

Change History (20)

Changed 3 years ago by kgerheiser (Kyle Gerheiser)

Attachment: main.log added

Build log

comment:1 Changed 3 years ago by mf2k (Frank Schima)

Keywords: gcc9 libgcc9 bigsur removed
Port: gcc9 removed

comment:2 Changed 3 years ago by mf2k (Frank Schima)

Keywords: bigsur added

comment:3 Changed 3 years ago by kgerheiser (Kyle Gerheiser)

Perhaps related to this, but GCC 9 instead of GCC 10?

https://trac.macports.org/ticket/60908

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

I've updated gcc10 to use an official upstream patch

https://github.com/macports/macports-ports/commit/9e96d20dc0a8b69bcdf6fc888eac6c68e3703b58

turns out it also applies cleanly to gcc9, so I have added it there as well

https://github.com/macports/macports-ports/commit/cd4c1c9bb392cf1e19922cac9246262e5e06990b

I haven't fully tested it, as I don't have the spare CPU cycles right now for another gcc build, so lets see what the buildbots make of it.

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

Cc: cjones051073 added

comment:6 Changed 3 years ago by michaelld (Michael Dickens)

Cc: michaelld added

comment:7 Changed 3 years ago by michaelld (Michael Dickens)

Might be related ... might not ... I updated my ports to tree to get this latest GCC9 patch. libgcc9 failed to install anything during destroot ... I'm running macOS 11.0.1 20B29 && Xcode 12.2 12B5035g. I'll attach a highly-compressed build log; maybe it will help

Changed 3 years ago by michaelld (Michael Dickens)

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

It should install one file...

Titan ~ > port content libgcc9
Port libgcc9 contains:
  /opt/local/lib/libgcc/libasan.5.dylib

if that is not being produced something is up with the build...

I don't really have huge interest in investigating gcc9 tbh. gcc10 works and most (all) use cases should be able to use that newer version.

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

Interesting, the issue also seems to affect gcc10, as I cannot see the asan lib there either.

> port content libgcc10
<sbip>
 /opt/local/lib/libgcc/libatomic.1.dylib
  /opt/local/lib/libgcc/libgcc_ext.10.4.dylib
  /opt/local/lib/libgcc/libgcc_ext.10.5.dylib
  /opt/local/lib/libgcc/libgcc_s.1.dylib
  /opt/local/lib/libgcc/libgfortran.5.dylib
  /opt/local/lib/libgcc/libgomp.1.dylib
  /opt/local/lib/libgcc/libitm.1.dylib
  /opt/local/lib/libgcc/libobjc-gnu.4.dylib
  /opt/local/lib/libgcc/libquadmath.0.dylib
  /opt/local/lib/libgcc/libssp.0.dylib
  /opt/local/lib/libgcc/libstdc++.6.dylib
  /opt/local/lib/libstdc++.6.dylib

this didn't cause any problems there, as there are other files so destroot still works. With gcc9 as it was the only file that fails, as destroot requires at least one file.

Until someone works out why the asan lib is not being made, adding a stub file to libgcc9 would be a work around.

Note the the asan lib is for the address sanitiser, so is not a critical part needed for the compiler to work...

Last edited 3 years ago by cjones051073 (Chris Jones) (previous) (diff)

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

OK, I see why the sanitiser libs are not being made. GCC configuration is riddled with lines like

  x86_64-*-darwin1[2-9]* | i?86-*-darwin1[2-9]*)

which don't match Darwin20.... The above is what is used to enable sanitisers, and without a match for darwin20 they are disabled.

TBH, from what I can see its a bit of a miracle the builds work at all...

I am not sure the effort to fix things just for the sanitisers is worth it, unless someone has a killer reason ?

eventually gcc11 will come along which should fix all this properly from upstream..

comment:12 Changed 3 years ago by michaelld (Michael Dickens)

Wow yeah it is a miracle that GCC builds at all on Darwin 20 ... I can't think of a good reason to fix these except for completion.

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

I have to confess I got curious after my last post so threw together a quick patch and testing it now, just to see what happens...

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

OK that worked. Fix now pushed.

comment:15 Changed 3 years ago by michaelld (Michael Dickens)

Nice ... thx will test tonight!

comment:16 Changed 3 years ago by ericmoret

Cc: ericmoret added

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

Resolution: fixed
Status: newclosed

comment:18 Changed 3 years ago by michaelld (Michael Dickens)

Works nicely for me on macOS 11 ... thx! Building now on 10.14 ... then 10.15 ... but guessing it'll work on those too

Note: See TracTickets for help on using tickets.