Opened 2 years ago

Closed 22 months ago

Last modified 22 months ago

#65146 closed defect (fixed)

gcc11/gcc12 portfiles need minor changes to enable building with gcc10-bootstrap on Leopard and Rosetta

Reported by: barracuda156 Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: snowleopard, leopard, powerpc Cc: cjones051073 (Chris Jones)
Port: gcc11, libgcc11

Description

Once gcc10-bootstrap is installed and advised by the port lines are added to gcc11 portfile:

depends_lib-append      port:gcc10-bootstrap

configure.cc            ${prefix}/libexec/gcc10-bootstrap/bin/gcc
configure.cxx           ${prefix}/libexec/gcc10-bootstrap/bin/g++

an attempt to build it leads to a circular dependency:

macmini:bin svacchanda$ ./port deps gcc11
Full Name: gcc11 @11.3.0_1
Extract Dependencies: xz
Build Dependencies:   texinfo, gcc11
Library Dependencies: gcc10-bootstrap, cctools, gmp, isl, ld64, libiconv,
                      libmpc, mpfr, zlib, zstd, libgcc
Runtime Dependencies: gcc_select, libgcc
macmini:bin svacchanda$ ./port deps libgcc11
Full Name: libgcc11 @11.3.0_1
Extract Dependencies: xz
Build Dependencies:   texinfo, gcc10-bootstrap, cctools, gmp, isl, ld64,
                      libiconv, libmpc, mpfr, zstd, gcc11
Library Dependencies: zlib, libgcc

The problem is observed regardless of whether the build is for x86_64 or ppc. It is solvable with manual trickery, but maybe there is a way to fix it properly?

Change History (18)

comment:1 Changed 2 years ago by barracuda156

  1. S. Perhaps it may not arise if clang is built first, but it is a bit strange to be required to build clang just to break dependency cycle. Also, that won't work for ppc.

comment:2 in reply to:  description ; Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

the port lines are added to gcc11 portfile:

depends_lib-append      port:gcc10-bootstrap

configure.cc            ${prefix}/libexec/gcc10-bootstrap/bin/gcc
configure.cxx           ${prefix}/libexec/gcc10-bootstrap/bin/g++

Just to clarify: These lines are not in the gcc11 Portfile we publish, correct? You have added them? And after you added, them this problem appeared?

Why did you add these lines? What is the problem you encountered prior to this attempt to fix it?

comment:3 in reply to:  2 Changed 2 years ago by barracuda156

Replying to ryandesign:

Just to clarify: These lines are not in the gcc11 Portfile we publish, correct? You have added them? And after you added, them this problem appeared?

Why did you add these lines? What is the problem you encountered prior to this attempt to fix it?

These are lines from gcc10-bootstrap notes: https://github.com/macports/macports-ports/blob/master/lang/gcc10-bootstrap/Portfile They are necessary in order to build a port using gcc10-bootstrap. And gcc11 cannot be built with an Xcode compiler on 10.6.x. The optimal way to get to gcc11 on 10.5–10.6 is to build gcc10-bootstrap and then use it for gcc11.

By the way, I know now what is the problem: for whatever reason, blacklisting gcc-4.x prevents Macports from seeing gcc10-bootstrap setting.

Specifically, once this is removed compiler.blacklist-append {clang < 800} gcc-4.0 *gcc-4.2 {llvm-gcc-4.2 < 2336.1} {macports-clang-3.[4-7]}, I get correct dependencies:

macmini:bin svacchanda$ ./port deps libgcc11
Full Name: libgcc11 @11.3.0_1
Extract Dependencies: xz
Build Dependencies:   gcc10-bootstrap, texinfo, gcc10-bootstrap, cctools, gmp,
                      isl, ld64, libiconv, libmpc, mpfr, zstd
Library Dependencies: zlib

I guess this is a wrong behavior in the base.

comment:4 Changed 2 years ago by kencu (Ken)

gcc11 builds using clang on 10.6 (for Intel).

Here you are trying to build gcc11 on 10.6 on PPC using gcc10-bootstrap?

We haven't really explored that path as yet. Someday we may set up gcc11/libgcc11 (or gcc12/libgcc12) to build with gcc10-bootstrap. That will require somebody figuring out how it should be done, and on which systems.

But it is not presently supported, and there is no error in gcc11 or circular dependancy a this time.

comment:5 Changed 2 years ago by kencu (Ken)

Summary: Circular dependency of gcc11 on Snow LeopardCircular dependency of gcc11 on Snow Leopard when trying to build gcc11 using an alternative bootstrapping path using gcc10-bootstrap in the hopes of it someday building on 10.6 for PPC

comment:6 in reply to:  4 Changed 2 years ago by jmroot (Joshua Root)

Replying to kencu:

gcc11 builds using clang on 10.6 (for Intel).

Well, it should. But doesn't at the moment. https://ports.macports.org/port/gcc11/builds/

comment:7 Changed 2 years ago by kencu (Ken)

that can now be #65149, whatever is going wrong there TBA

comment:8 in reply to:  5 Changed 2 years ago by barracuda156

Replying to kencu:

Haha, I have it already on PPC (both 10A190 and Rosetta). Now I am building for Intel, in a hope to cross-build ghc (which has to be built for x86_64 first before any attempts to cross-build).

The problem is that Macports extrapolates a ban of specific gcc-4.* to gcc10-bootstrap, which is likely just a bug. If not, then a ban should be made conditional in gcc10 and gcc11 portfile, excluding cases < 10.7. This problem has no direct relation to PPC.

comment:9 in reply to:  4 ; Changed 2 years ago by barracuda156

Replying to kencu:

gcc11 builds using clang on 10.6 (for Intel).

Here you are trying to build gcc11 on 10.6 on PPC using gcc10-bootstrap?

We haven't really explored that path as yet. Someday we may set up gcc11/libgcc11 (or gcc12/libgcc12) to build with gcc10-bootstrap. That will require somebody figuring out how it should be done, and on which systems.

But it is not presently supported, and there is no error in gcc11 or circular dependancy a this time.

Well, FWIU, gcc10-bootstrap was precisely designed to help older systems to get to the latest compilers (which cannot be bootstrapped directly).

To re-iterate, this issue has nothing to do with PPC, I get this problem when building for x86_64 (no universal) on 10.6.8 (no developer builds). I just don't need clang but need gcc11.

comment:10 Changed 22 months ago by cjones051073 (Chris Jones)

Resolution: fixed
Status: assignedclosed

Closing as gcc11 is now available on 10.6.

Not that it is relevant, but the build uses a macports provided clang version to build. Building gcc11 with gcc itself is not yet supported (although now gcc10 and newer support using libc++ as the c++ runtime doing so is more viable).

comment:11 Changed 22 months ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:12 in reply to:  10 ; Changed 22 months ago by barracuda156

Replying to cjones051073:

Closing as gcc11 is now available on 10.6.

Not that it is relevant, but the build uses a macports provided clang version to build. Building gcc11 with gcc itself is not yet supported (although now gcc10 and newer support using libc++ as the c++ runtime doing so is more viable).

In fact building gcc11 with gcc itself works perfectly fine (no circular dependencies, no trickery), I have built in multiple times across several systems. Portfile needs few fixes, and I know precisely which now. That gonna enable building on 10.5.8 for PPC. (There are additional complications with 10.6 PPC and 10.6.8 Rosetta: the first needs a custom patch, which I will have to provide as out-of-tree fix on Github; the second does not need any patches and is supported by the upstream, however Macports gcc10-bootstrap fails on Rosetta due to dependencies using wrong arch setting – perhaps fixable, but I do not have it done yet.)

comment:13 Changed 22 months ago by barracuda156

Keywords: leopard powerpc added
Summary: Circular dependency of gcc11 on Snow Leopard when trying to build gcc11 using an alternative bootstrapping path using gcc10-bootstrap in the hopes of it someday building on 10.6 for PPCgcc1/gcc12 portfiles need minor changes to enable building with gcc10-bootstrap on Leopard and Rosetta

comment:14 Changed 22 months ago by barracuda156

Summary: gcc1/gcc12 portfiles need minor changes to enable building with gcc10-bootstrap on Leopard and Rosettagcc11/gcc12 portfiles need minor changes to enable building with gcc10-bootstrap on Leopard and Rosetta

comment:15 in reply to:  12 ; Changed 22 months ago by catap (Kirill A. Korinsky)

Replying to barracuda156:

however Macports gcc10-bootstrap fails on Rosetta due to dependencies using wrong arch setting – perhaps fixable, but I do not have it done yet.)

may you share commands how can I reproduce it? Or maybe you open a dedicated ticket and assign it to me?

comment:16 in reply to:  15 Changed 22 months ago by barracuda156

Replying to catap:

Replying to barracuda156:

however Macports gcc10-bootstrap fails on Rosetta due to dependencies using wrong arch setting – perhaps fixable, but I do not have it done yet.)

may you share commands how can I reproduce it? Or maybe you open a dedicated ticket and assign it to me?

Yes, sure, I will make a ticket. Nothing special was done, I literally tried building gcc10-bootstrap on 10.6.8, but for ppc. No +universal, no custom args. Here is the failure: https://github.com/macports/macports-ports/pull/13995#issuecomment-1066014166 https://github.com/macports/macports-ports/pull/13995#issuecomment-1066718196

I can try that again in a day (now building gcc12 on Rosetta) and provide logs.

comment:17 in reply to:  10 Changed 22 months ago by kencu (Ken)

Replying to cjones051073:

Building gcc11 with gcc itself is not yet supported (although now gcc10 and newer support using libc++ as the c++ runtime doing so is more viable).

gcc should never be linked against libc++.

It is internally consistent and self-contained. Building it with a previous copy of gcc is highly recommended, in fact.

If any of it’s lib debs ever are linked against libc++ someday, I’m not sure how that might work out. Possibly not good, though.

In general, gcc uses it’s own bundled deps statically linked in, although that is not what macports has traditionally done.

comment:18 in reply to:  9 Changed 22 months ago by kencu (Ken)

Replying to barracuda156:

Replying to kencu:

gcc11 builds using clang on 10.6 (for Intel).

Here you are trying to build gcc11 on 10.6 on PPC using gcc10-bootstrap?

We haven't really explored that path as yet. Someday we may set up gcc11/libgcc11 (or gcc12/libgcc12) to build with gcc10-bootstrap. That will require somebody figuring out how it should be done, and on which systems.

But it is not presently supported, and there is no error in gcc11 or circular dependancy a this time.

Well, FWIU, gcc10-bootstrap was precisely designed to help older systems to get to the latest compilers (which cannot be bootstrapped directly).

That is indeed a plan, once gcc10-bootstrap builds everywhere it is needed, someone will correctly modify the builds of gcc11+ to build with gcc10-bootstrap, and then trigger the ancient systems to use libgcc12 as the new default by changing a couple of numbers in the libgcc port and elsewhere (I showed you how to do this last year).

Step 1. make sure gcc10-bootstrap builds everywhere (Tiger to Mojave, anyway). Universal where needed (10.6 at least).

Step 2. modify gcc11+ to build with it, properly, including universal, on certain systems TBA (? Tiger to Lion)

Step 3. update libgcc and compiler selection code to use libgcc12 on all system

But nobody with the proper skills and time has been motivated to do this yet, so it is still presently unsupported on MacPorts.

Note: See TracTickets for help on using tickets.