Opened 17 months ago

Last modified 7 weeks ago

#67652 new defect

gcc12, 13 +universal arm64/x86_64 isn't universal

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cjones051073 (Chris Jones), catap (Kirill A. Korinsky), ShadSterling (Shad Sterling)
Port: gcc12 gcc13 libgcc libgcc13 libgcc12

Description

It looks like our universal build of gcc12 arm64/x86_64 is not actually universal at all.

At least, as far as I can see, the arm64 build of gcc12 has nothing x86_64 in it:

% port -v installed | grep gcc
  gcc12 @12.3.0_0+stdlib_flag+universal (active)
requested_variants='+universal' platform='darwin 22' archs='arm64 x86_64'
date='2023-06-17T08:32:19-0700'
  gcc12-libcxx @12.3.0_0+clang14 (active) requested_variants=''
platform='darwin 22' archs='noarch' date='2023-06-17T07:46:36-0700'
  gcc_select @0.1_10 (active) requested_variants='' platform='darwin 22'
archs='noarch' date='2023-06-17T07:46:37-0700'
  libgcc @6.0_0+universal (active) requested_variants='+universal'
platform='darwin 22' archs='arm64 x86_64' date='2023-06-17T08:11:23-0700'
  libgcc12 @12.3.0_0+stdlib_flag+universal (active)
requested_variants='+universal' platform='darwin 22' archs='arm64 x86_64'
date='2023-06-17T08:11:14-0700'
% port contents gcc12 | grep x86_64
% port contents gcc12 | grep bin/ | xargs file
/opt/local/bin/arm64-apple-darwin22-c++-mp-12:        Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-g++-mp-12:        Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gcc-12.3.0:       Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gcc-ar-mp-12:     Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gcc-mp-12:        Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gcc-nm-mp-12:     Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gcc-ranlib-mp-12: Mach-O 64-bit
executable arm64
/opt/local/bin/arm64-apple-darwin22-gfortran-mp-12:   Mach-O 64-bit
executable arm64
/opt/local/bin/c++-mp-12:                             Mach-O 64-bit
executable arm64
/opt/local/bin/cpp-mp-12:                             Mach-O 64-bit
executable arm64
/opt/local/bin/g++-mp-12:                             Mach-O 64-bit
executable arm64
/opt/local/bin/gcc-ar-mp-12:                          Mach-O 64-bit
executable arm64
/opt/local/bin/gcc-mp-12:                             Mach-O 64-bit
executable arm64
/opt/local/bin/gcc-nm-mp-12:                          Mach-O 64-bit
executable arm64
/opt/local/bin/gcc-ranlib-mp-12:                      Mach-O 64-bit
executable arm64
/opt/local/bin/gcov-dump-mp-12:                       Mach-O 64-bit
executable arm64
/opt/local/bin/gcov-mp-12:                            Mach-O 64-bit
executable arm64
/opt/local/bin/gcov-tool-mp-12:                       Mach-O 64-bit
executable arm64
/opt/local/bin/gfortran-mp-12:                        Mach-O 64-bit
executable arm64
/opt/local/bin/lto-dump-mp-12:                        Mach-O 64-bit
executable arm64

and neither is libgcc12:

% port contents libgcc12 | grep dylib | xargs file
/opt/local/lib/libgcc/libatomic.1.dylib:   Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libatomic.dylib:     Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libgcc_s.1.1.dylib:  Mach-O universal binary with 1
architecture: [arm64:Mach-O 64-bit dynamically linked shared library
arm64]
/opt/local/lib/libgcc/libgcc_s.1.1.dylib (for architecture arm64):
Mach-O 64-bit dynamically linked shared library arm64
/opt/local/lib/libgcc/libgcc_s.dylib:      Mach-O universal binary with 1
architecture: [arm64:Mach-O 64-bit dynamically linked shared library
arm64]
/opt/local/lib/libgcc/libgcc_s.dylib (for architecture arm64):  Mach-O
64-bit dynamically linked shared library arm64
/opt/local/lib/libgcc/libgfortran.5.dylib: Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libgfortran.dylib:   Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libgomp.1.dylib:     Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libgomp.dylib:       Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libitm.1.dylib:      Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libitm.dylib:        Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libobjc-gnu.4.dylib: Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libobjc-gnu.dylib:   Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libquadmath.0.dylib: Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libquadmath.dylib:   Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libssp.0.dylib:      Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libssp.dylib:        Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libstdc++.6.dylib:   Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libgcc/libstdc++.dylib:     Mach-O 64-bit dynamically
linked shared library arm64
/opt/local/lib/libstdc++.6.dylib:          Mach-O 64-bit dynamically
linked shared library arm64

Change History (10)

comment:1 Changed 17 months ago by jmroot (Joshua Root)

Cc: cjones051073 added
Port: gcc12 added
Summary: gcc12 @12.3.0 +universal arm64/x86_64gcc12 @12.3.0 +universal arm64/x86_64 isn't universal

Did this ever work? It looks like configure.universal_archs x86_64 arm64 first appeared when gcc11 was created, was subsequently copied into gcc12, and was also added to gcc10 in [c2f52d3529d4d8958143af466a32070fbfaec016/macports-ports] without any explanation of why it would now work.

It's also odd that there are two separate platform blocks that between them cover all the possibilities, and both do exactly the same thing.

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

Yeah, I don't think it ever worked, indeed.

for the short term, we should mark the appropriate systems as having no universal variant.

for the medium term, someone might build it like gcc10-bootstrap, and then it will be at least sorta universal

for the longer term, the plan would be a fully universal gccN+ with libraries that support arm64/x86_64 and fully universal cross compilers (ie the arm64 and x86_64 compilers both exist universal in both arches).

for the long long term, someone will fix driverdriver.c to make it all work as seamlessly as clang and apple-gcc42 work, supporting multiple arch flags.

comment:3 Changed 14 months ago by jjstickel (Jonathan Stickel)

Cc: jjstickel added

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

Port: gcc13 libgcc libgcc13 libgcc12 added

Now that Chris has an arm system, perhaps this will get some traction -- but it's not an easy fix to undertake. Building gcc as four separate compilers:

  1. x86_64 building x86_64
  2. x86_64 building arm64
  3. arm64 building arm64
  4. arm64 building x86_64

and lipoing them all together into a coherent package is quite a project.

And then getting these to actually build the proper archs without a fixed driverdriver.c is very messy too.

Perhaps this will never happen -- in which case we should just label all these systems as having no universal gcc variant, and clean this up.

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

Summary: gcc12 @12.3.0 +universal arm64/x86_64 isn't universalgcc12, 13 +universal arm64/x86_64 isn't universal

comment:6 Changed 13 months ago by jjstickel (Jonathan Stickel)

Cc: jjstickel removed

comment:7 Changed 12 months ago by catap (Kirill A. Korinsky)

Cc: catap added

comment:8 Changed 8 months ago by barracuda156

Possibly related #69586

comment:9 Changed 8 months ago by ShadSterling (Shad Sterling)

Cc: ShadSterling added

comment:10 Changed 7 weeks ago by jmroot (Joshua Root)

In f3a3d36e576fcbf2a9ee970cf497741d349b0a16/macports-ports (master):

gcc1*: indicate correct supported multilib archs

See: #67652

Note: See TracTickets for help on using tickets.