Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] [PREFIX] the road ahead for Darwin/macOS
Date: Sun, 13 Dec 2020 11:40:39
In Reply to: [gentoo-alt] [PREFIX] the road ahead for Darwin/macOS by Fabian Groffen
1 To whom it may concern.
3 After a few turbulent weeks, with lots of input and help from various
4 people, the macOS bootstraps appear to be functional again.
6 The recent default Python switch from 3.7 to 3.8 threw some mud on the
7 road, but I can confirm this is now sorted out/fixed for:
8 - powerpc-apple-darwin9
9 - x86_64-apple-darwin17
11 I have reasons to believe darwin20 (Big Sur) is also functioning, right
12 before the Python thing happened, darwin19 and 20 were bootstrapping
13 just fine.
15 Bootstraps use Python 3.8.6 straight from stage1 now, and the resulting
16 Prefix has just that single Python installed, so it's pretty much lean
17 and clean. On macOS, by default a strategy of using FSF GCC (10.1.0 at
18 this time) is used, which means, no Clang, but efforts for trying to get
19 that running are underway (bug #758167). There is no linker/cctools
20 being built, instead the Xcode ld/as etc. are used. This functions
21 fairly well, and should provide a stable and functional enough Prefix
22 for most users.
24 Thanks to those who have been patient, and thanks Sam for jumping on the
25 Prefix train to bring it forwards.
27 Fabian
30 On 27-12-2019 11:45:46 +0100, Fabian Groffen wrote:
31 > To all interested in Gentoo Prefix on recent macOS.
32 >
33 > In the past few releases of macOS, /usr/include has disappeared. While
34 > this previously was remedied by performing some commands, Apple has made
35 > this more strict, and it appears the way forwards, is by no longer
36 > relying on /usr/include.
37 >
38 > To deal with this, the packages sys-kernel/xnu-headers and
39 > sys-libs/darwin-libc-headers were added to @system for newer macOS
40 > profiles. While you may have seen these packages coming in, getting
41 > some updates here and there, they may still not be perfect, yet I think
42 > we're getting somewhere. The purpose of these packages obviously is to
43 > provide system headers and frameworks without relying on Xcode.
44 >
45 > Next I've modified the bootstrap script to unpack a Prefix-built clang
46 > compiler, and use it to bootstrap. This, in addition to the headers,
47 > allowed me to progress until stage2 where a compiler is built. This
48 > failed, for a number of reasons. 1) requirement of cmake, which is
49 > horrible. It requires way too much in terms of dependencies, so I
50 > resorted to an unpacked Prefix-built version to provide it. Can't use
51 > upstream's binaries for cmake, because they insist on using Xcode SDKs.
52 > Next, 2) clang fails to build halfway because it throws away CXXFLAGS
53 > pointing to the headers provided. I seem to remember that this is what
54 > GCC build does as well, so not that surprising, but it basically renders
55 > the approach useless.
56 >
57 > This lead me to investigating how to tell the bootstrap compiler to keep
58 > looking for the headers we provided. Turns out the compiler is
59 > hard-wired to add c++ headers (stdinc) to its search-path, and this is
60 > necessary (at least on Darwin) because the math.h header appears twice,
61 > and only one of them is compatible with c++ code. Anyway. Apple seems
62 > to use -isysroot to point to an SDK that's selected/targetted. It seems
63 > to me, at this point we should follow that lead, and simply turn the
64 > Prefix into such sysroot. Experimenting with this option on our
65 > Prefix-build clang, results in not exactly desirable behaviour. Because
66 > the offset prefix is added to the compiler's search paths, nothing ends
67 > up right.
68 > So I downloaded clang binary from, and tried the same. That
69 > made more sense, and it seems the search path is correct there.
70 >
71 > What I want to try now, is if I can set CC/CXX to "clang -isysroot
72 > /path/to/prefix", and if that will get me through compiler building of
73 > stage2 during bootstrap.
74 >
75 > If that works, it seems the first step towards Xcode free bootstrapping
76 > on macOS. There will be some questions towards how we build our clang,
77 > if we should step away from patching it and using isysroot instead.
78 > Finally, how we're going to provide the binaries that we want to use
79 > during bootstraps. Ideally we can provide stage1/stage2 by simply
80 > installing form binpkgs, for instance using q/portage-utils.
81 >
82 > End of update, hopefully bootstrapping can be working again soon.
83 >
84 > Thanks,
85 > Fabian
86 >
87 > --
88 > Fabian Groffen
89 > Gentoo on a different level
93 --
94 Fabian Groffen
95 Gentoo on a different level


File name MIME type
signature.asc application/pgp-signature