1 |
commit: d15a8504e74114febbbbee439493a282f4450c5c |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 3 01:55:19 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Sep 3 01:55:19 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d15a8504 |
7 |
|
8 |
scripts/bootstrap-prefix.sh: fix for >= glibc-2.35 in stage3 |
9 |
|
10 |
slyfox explains it well in the linked bugs, but |
11 |
the gist is that we mostly got lucky for a while. |
12 |
|
13 |
We would mix system crt*.o with just-built libc_nonshared.a/libc.so |
14 |
which led to issues like: |
15 |
``` |
16 |
configure:4383: x86_64-pc-linux-gnu-gcc -O2 -pipe -O2 -pipe -L/home/share/gentoo/usr/lib64 -Wl,--dynamic-linker=/home/share/gentoo/lib64/ld-linux-x86-64.so.2 conftest.c >&5 |
17 |
/home/share/gentoo/tmp/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib/../lib64/Scrt1.o: in function `_start': |
18 |
(.text+0x16): undefined reference to `__libc_csu_fini' |
19 |
/home/share/gentoo/tmp/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x1d): undefined reference to `__libc_csu_init' |
20 |
``` |
21 |
|
22 |
We need to force GCC to use the Prefix version |
23 |
of glibc we just built. |
24 |
|
25 |
Bug: https://github.com/NixOS/nixpkgs/issues/158042 |
26 |
Closes: https://bugs.gentoo.org/824482 |
27 |
Thanks-to: Bart Oldeman <bartoldeman <AT> gmail.com> |
28 |
Thanks-to: Sergei Trofimovich <slyich <AT> gmail.com> |
29 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
30 |
|
31 |
scripts/bootstrap-prefix.sh | 39 ++++++++------------------------------- |
32 |
1 file changed, 8 insertions(+), 31 deletions(-) |
33 |
|
34 |
diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh |
35 |
index 0635887745..4795d87ee5 100755 |
36 |
--- a/scripts/bootstrap-prefix.sh |
37 |
+++ b/scripts/bootstrap-prefix.sh |
38 |
@@ -503,35 +503,6 @@ bootstrap_setup() { |
39 |
einfo "Your profile is set to ${fullprofile}." |
40 |
fi |
41 |
|
42 |
- # bug #788613 avoid gcc-11 during stage 2/3 prior sync/emerge -e |
43 |
- is-rap && cat >> "${ROOT}"/etc/portage/make.profile/package.mask <<-EOF |
44 |
- # during bootstrap mask, bug #788613 |
45 |
- >=sys-devel/gcc-11 |
46 |
- EOF |
47 |
- |
48 |
- # bug #824482 avoid glibc-2.34 |
49 |
- if is-rap; then |
50 |
- if ! [ -d "${ROOT}"/etc/portage/package.mask ]; then |
51 |
- mkdir "${ROOT}"/etc/portage/package.mask |
52 |
- fi |
53 |
- |
54 |
- if ! [ -d "${ROOT}"/etc/portage/package.unmask ]; then |
55 |
- mkdir "${ROOT}"/etc/portage/package.unmask |
56 |
- fi |
57 |
- |
58 |
- cat >> "${ROOT}"/etc/portage/package.mask/glibc <<-EOF |
59 |
- # Temporary mask for newer glibc until bootstrapping issues are fixed. |
60 |
- # bug #824482: Avoid glibc-2.34 for now. See package.unmask/glibc too. |
61 |
- >=sys-libs/glibc-2.34 |
62 |
- EOF |
63 |
- |
64 |
- cat >> "${ROOT}"/etc/portage/package.unmask/glibc <<-EOF |
65 |
- # Temporary mask for newer glibc until bootstrapping issues are fixed. |
66 |
- # bug #824482: Avoid glibc-2.34 for now. See package.mask/glibc too. |
67 |
- >=sys-libs/glibc-2.34_p1 |
68 |
- EOF |
69 |
- fi |
70 |
- |
71 |
# Use package.use to disable in the portage tree to be shared between |
72 |
# stage2 and stage3. The hack will be undone during tree sync in stage3. |
73 |
cat >> "${ROOT}"/etc/portage/make.profile/package.use <<-EOF |
74 |
@@ -2131,8 +2102,14 @@ bootstrap_stage3() { |
75 |
${linker} |
76 |
) |
77 |
# use the new dynamic linker in place of rpath from now on. |
78 |
- RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9]) |
79 |
+ RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!") |
80 |
export LDFLAGS="-L${ROOT}/usr/$(get_libdir) -Wl,--dynamic-linker=${RAP_DLINKER}" |
81 |
+ if [[ ${compiler_type} == gcc ]] ; then |
82 |
+ # make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS |
83 |
+ export LDFLAGS="-B${ROOT}/usr/$(get_libdir) ${LDFLAGS}" |
84 |
+ export CC="gcc ${CPPFLAGS} ${LDFLAGS}" |
85 |
+ export CXX="g++ ${CPPFLAGS} ${LDFLAGS}" |
86 |
+ fi |
87 |
BOOTSTRAP_RAP=yes \ |
88 |
pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
89 |
|
90 |
@@ -2189,7 +2166,7 @@ bootstrap_stage3() { |
91 |
|
92 |
# Undo libgcc_s.so path of stage2 |
93 |
# Now we have the compiler right there |
94 |
- unset CXX CPPFLAGS LDFLAGS |
95 |
+ unset CC CXX CPPFLAGS LDFLAGS |
96 |
|
97 |
rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf |