1 |
On Dec 27, 2019, at 5:45 AM, Fabian Groffen <grobian@g.o> wrote: |
2 |
> |
3 |
> To all interested in Gentoo Prefix on recent macOS. |
4 |
> |
5 |
> In the past few releases of macOS, /usr/include has disappeared. While |
6 |
> this previously was remedied by performing some commands, Apple has made |
7 |
> this more strict, and it appears the way forwards, is by no longer |
8 |
> relying on /usr/include. |
9 |
> |
10 |
> To deal with this, the packages sys-kernel/xnu-headers and |
11 |
> sys-libs/darwin-libc-headers were added to @system for newer macOS |
12 |
> profiles. While you may have seen these packages coming in, getting |
13 |
> some updates here and there, they may still not be perfect, yet I think |
14 |
> we're getting somewhere. The purpose of these packages obviously is to |
15 |
> provide system headers and frameworks without relying on Xcode. |
16 |
> |
17 |
> Next I've modified the bootstrap script to unpack a Prefix-built clang |
18 |
> compiler, and use it to bootstrap. This, in addition to the headers, |
19 |
> allowed me to progress until stage2 where a compiler is built. This |
20 |
> failed, for a number of reasons. 1) requirement of cmake, which is |
21 |
> horrible. It requires way too much in terms of dependencies, so I |
22 |
> resorted to an unpacked Prefix-built version to provide it. Can't use |
23 |
> upstream's binaries for cmake, because they insist on using Xcode SDKs. |
24 |
> Next, 2) clang fails to build halfway because it throws away CXXFLAGS |
25 |
> pointing to the headers provided. I seem to remember that this is what |
26 |
> GCC build does as well, so not that surprising, but it basically renders |
27 |
> the approach useless. |
28 |
> |
29 |
> This lead me to investigating how to tell the bootstrap compiler to keep |
30 |
> looking for the headers we provided. Turns out the compiler is |
31 |
> hard-wired to add c++ headers (stdinc) to its search-path, and this is |
32 |
> necessary (at least on Darwin) because the math.h header appears twice, |
33 |
> and only one of them is compatible with c++ code. Anyway. Apple seems |
34 |
> to use -isysroot to point to an SDK that's selected/targetted. It seems |
35 |
> to me, at this point we should follow that lead, and simply turn the |
36 |
> Prefix into such sysroot. Experimenting with this option on our |
37 |
> Prefix-build clang, results in not exactly desirable behaviour. Because |
38 |
> the offset prefix is added to the compiler's search paths, nothing ends |
39 |
> up right. |
40 |
> So I downloaded clang binary from llvm.org, and tried the same. That |
41 |
> made more sense, and it seems the search path is correct there. |
42 |
> |
43 |
> What I want to try now, is if I can set CC/CXX to "clang -isysroot |
44 |
> /path/to/prefix", and if that will get me through compiler building of |
45 |
> stage2 during bootstrap. |
46 |
> |
47 |
> If that works, it seems the first step towards Xcode free bootstrapping |
48 |
> on macOS. There will be some questions towards how we build our clang, |
49 |
> if we should step away from patching it and using isysroot instead. |
50 |
> Finally, how we're going to provide the binaries that we want to use |
51 |
> during bootstraps. Ideally we can provide stage1/stage2 by simply |
52 |
> installing form binpkgs, for instance using q/portage-utils. |
53 |
> |
54 |
> End of update, hopefully bootstrapping can be working again soon. |
55 |
> |
56 |
> Thanks, |
57 |
> Fabian |
58 |
> |
59 |
> -- |
60 |
> Fabian Groffen |
61 |
> Gentoo on a different level |
62 |
|
63 |
Hi Fabian, |
64 |
|
65 |
Any luck here? I'd like to install on my new Mac laptop. |
66 |
|
67 |
Thanks, |
68 |
|
69 |
John Gibson |