Gentoo Archives: gentoo-dev

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

Attachments

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

Replies

Subject Author
Re: [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain James Le Cuirot <chewi@g.o>