1 |
On Fri, 2023-01-20 at 23:11 +0000, James Le Cuirot wrote: |
2 |
> The context for this is a pull request I've been working on for a few weeks. |
3 |
> |
4 |
> https://github.com/gentoo/gentoo/pull/28851 |
5 |
> |
6 |
> RAP prefix nobbled gcc/clang's sysroot when invoking the linker because glibc |
7 |
> installed its linker scripts with prefixed paths, such as /path/to/prefix/lib |
8 |
> rather than just /lib. Adjusting the linker scripts rather than the compiler |
9 |
> behaviour is more natural and makes cross-compiling far easier. |
10 |
> |
11 |
> For the migration procedure, I did try a different approach of manually fixing |
12 |
> up the linker scripts, but if you do this first, the gcc build fails |
13 |
> immediately, and if you do this afterwards, the gcc build fails later. A |
14 |
> symlink is therefore needed to allow the sysroot to be applied, even when the |
15 |
> linker script paths are still prefixed. |
16 |
> |
17 |
> Unfortunately, it's not possible to filter news items on USE flags or even |
18 |
> profile parents, so I've had to resort to explicitly listing all the prefix |
19 |
> profiles. Prefix is quite a niche feature, so I don't want to show this news |
20 |
> to everyone. |
21 |
|
22 |
Following some feedback elsewhere, I'm going to add an additional paragraph, |
23 |
because many users are not sure what kind of prefix they have. See below. |
24 |
|
25 |
> ---- |
26 |
> |
27 |
> Title: Breaking changes to the RAP Prefix toolchain |
28 |
> Author: James Le Cuirot <chewi@g.o> |
29 |
> Posted: 2023-01-20 |
30 |
> Revision: 1 |
31 |
> News-Item-Format: 2.0 |
32 |
> Display-If-Profile: default/linux/amd64/17.0/no-multilib/prefix/* |
33 |
> Display-If-Profile: default/linux/amd64/17.1/no-multilib/prefix/* |
34 |
> Display-If-Profile: default/linux/amd64/23.0/no-multilib/prefix/* |
35 |
> Display-If-Profile: default/linux/amd64/23.0/split-usr/no-multilib/prefix/* |
36 |
> Display-If-Profile: default/linux/arm/17.0/armv7a/prefix/* |
37 |
> Display-If-Profile: default/linux/arm/23.0/armv7a/prefix/* |
38 |
> Display-If-Profile: default/linux/arm/23.0/split-usr/armv7a/prefix/* |
39 |
> Display-If-Profile: default/linux/arm64/17.0/prefix/* |
40 |
> Display-If-Profile: default/linux/arm64/23.0/prefix/* |
41 |
> Display-If-Profile: default/linux/arm64/23.0/split-usr/prefix/* |
42 |
> Display-If-Profile: default/linux/ppc64le/17.0/prefix/* |
43 |
> Display-If-Profile: default/linux/riscv/20.0/rv64gc/lp64d/prefix/* |
44 |
> Display-If-Profile: default/linux/riscv/23.0/rv64/lp64d/prefix/* |
45 |
> Display-If-Profile: default/linux/riscv/23.0/rv64/split-usr/lp64d/prefix/* |
46 |
> Display-If-Profile: default/linux/x86/17.0/prefix/* |
47 |
> Display-If-Profile: default/linux/x86/23.0/prefix/* |
48 |
> Display-If-Profile: default/linux/x86/23.0/split-usr/prefix/* |
49 |
> |
50 |
> We are changing the way the toolchain operates on RAP Prefix systems in order to |
51 |
> reduce the number of hacks we need to apply and make cross-compiling easier. |
52 |
> |
53 |
> If you using a non-RAP "Prefix Guest" or "Prefix Stack" variant (e.g. macOS) |
54 |
> then this does not apply. |
55 |
|
56 |
If you're not sure what kind of prefix you have, then check whether the |
57 |
prefix-guest USE flag is enabled. |
58 |
|
59 |
portageq envvar USE | grep prefix-guest |
60 |
|
61 |
> If you are using a libc other than glibc (e.g. musl) then this *does* apply, but |
62 |
> your libc will *not* break, so you should not carry out the following procedure. |
63 |
> The only other package known to be affected is dev-libs/libbsd, which you can |
64 |
> simply update. If you find another package affected by this, then please file a |
65 |
> bug report. |
66 |
> |
67 |
> WARNING! It is important that you carry out the following procedure, otherwise |
68 |
> your toolchain will break when you next update your compiler or glibc. |
69 |
> |
70 |
> 1. Run the following to create a temporary symlink: |
71 |
> |
72 |
> EPREFIX=$(portageq envvar EPREFIX) |
73 |
> mkdir -p "${EPREFIX}${EPREFIX%/*}" |
74 |
> ln -sn "${EPREFIX}" "${EPREFIX}${EPREFIX}" |
75 |
> |
76 |
> 2. Update or rebuild all installed slots of sys-devel/gcc and sys-devel/clang |
77 |
> (if any). Feel free to remove any you no longer need. |
78 |
> |
79 |
> 3. Update or rebuild sys-libs/glibc. |
80 |
> |
81 |
> 4. Run the following to remove the symlink: |
82 |
> |
83 |
> EPREFIX=$(portageq envvar EPREFIX) |
84 |
> rm "${EPREFIX}${EPREFIX}" |
85 |
> |
86 |
> 5. If dev-libs/libbsd is installed, then update it to 0.11.7-r2 or later. |
87 |
> |
88 |
> If you are reading this having updated glibc first and you are no longer able to |
89 |
> build anything, then don't panic. Simply execute the line below and then carry |
90 |
> out the regular procedure above. |
91 |
> |
92 |
> qlist sys-libs/glibc | xargs grep -lIF "GNU ld script" | xargs sed -i -r "s: /(usr|lib): $(portageq envvar EPREFIX)/\1:g" |
93 |
> |