• [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain

    From James Le Cuirot@21:1/5 to All on Sat Jan 21 00:20:01 2023
    The context for this is a pull request I've been working on for a few weeks.

    https://github.com/gentoo/gentoo/pull/28851

    RAP prefix nobbled gcc/clang's sysroot when invoking the linker because glibc installed its linker scripts with prefixed paths, such as /path/to/prefix/lib rather than just /lib. Adjusting the linker scripts rather than the compiler behaviour is more natural and makes cross-compiling far easier.

    For the migration procedure, I did try a different approach of manually fixing up the linker scripts, but if you do this first, the gcc build fails immediately, and if you do this afterwards, the gcc build fails later. A symlink is therefore needed to allow the sysroot to be applied, even when the linker script paths are still prefixed.

    Unfortunately, it's not possible to filter news items on USE flags or even profile parents, so I've had to resort to explicitly listing all the prefix profiles. Prefix is quite a niche feature, so I don't want to show this news
    to everyone.

    ----

    Title: Breaking changes to the RAP Prefix toolchain
    Author: James Le Cuirot <chewi@gentoo.org>
    Posted: 2023-01-20
    Revision: 1
    News-Item-Format: 2.0
    Display-If-Profile: default/linux/amd64/17.0/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/17.1/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/23.0/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/23.0/split-usr/no-multilib/prefix/* Display-If-Profile: default/linux/arm/17.0/armv7a/prefix/*
    Display-If-Profile: default/linux/arm/23.0/armv7a/prefix/*
    Display-If-Profile: default/linux/arm/23.0/split-usr/armv7a/prefix/* Display-If-Profile: default/linux/arm64/17.0/prefix/*
    Display-If-Profile: default/linux/arm64/23.0/prefix/*
    Display-If-Profile: default/linux/arm64/23.0/split-usr/prefix/* Display-If-Profile: default/linux/ppc64le/17.0/prefix/*
    Display-If-Profile: default/linux/riscv/20.0/rv64gc/lp64d/prefix/* Display-If-Profile: default/linux/riscv/23.0/rv64/lp64d/prefix/* Display-If-Profile: default/linux/riscv/23.0/rv64/split-usr/lp64d/prefix/* Display-If-Profile: default/linux/x86/17.0/prefix/*
    Display-If-Profile: default/linux/x86/23.0/prefix/*
    Display-If-Profile: default/linux/x86/23.0/split-usr/prefix/*

    We are changing the way the toolchain operates on RAP Prefix systems in order to
    reduce the number of hacks we need to apply and make cross-compiling easier.

    If you using a non-RAP "Prefix Guest" or "Prefix Stack" variant (e.g. macOS) then this does not apply.

    If you are using a libc other than glibc (e.g. musl) then this *does* apply, but
    your libc will *not* break, so you should not carry out the following procedure.
    The only other package known to be affected is dev-libs/libbsd, which you can simply update. If you find another package affected by this, then please file a bug report.

    WARNING! It is important that you carry out the following procedure, otherwise your toolchain will break when you next update your compiler or glibc.

    1. Run the following to create a temporary symlink:

    EPREFIX=$(portageq envvar EPREFIX)
    mkdir -p "${EPREFIX}${EPREFIX%/*}"
    ln -sn "${EPREFIX}" "${EPREFIX}${EPREFIX}"

    2. Update or rebuild all installed slots of sys-devel/gcc and sys-devel/clang
    (if any). Feel free to remove any you no longer need.

    3. Update or rebuild sys-libs/glibc.

    4. Run the following to remove the symlink:

    EPREFIX=$(portageq envvar EPREFIX)
    rm "${EPREFIX}${EPREFIX}"

    5. If dev-libs/libbsd is installed, then update it to 0.11.7-r2 or later.

    If you are reading this having updated glibc first and you are no longer able to
    build anything, then don't panic. Simply execute the line below and then carry out the regular procedure above.

    qlist sys-libs/glibc | xargs grep -lIF "GNU ld script" | xargs sed -i -r "s: /(usr|lib): $(portageq envvar EPREFIX)/\1:g"


    -----BEGIN PGP SIGNATURE-----

    iQJFBAABCAAvFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAmPLH5sRHGNoZXdpQGdl bnRvby5vcmcACgkQEiZBXQDdMTc1BQ//c1mICfQNiuiRVMNu+kXt/hqMQYDbnvyG +AdlT/D8Z0ybaI8ibc/xe8HWzRgdpqxZL7OnBDI7NmJcH4KHRzcDpmlEWZMCBFeH tMtW2wo36cZ/UbzNiRYPu9jkSzgftHZHcoVutrLYU5jwQWq1Utp8oweaeV2mJR+q Cw3GGhfSwdzAV9ITxiDIwZqS5B5l0s0yYUNvzKV9NjZfXs4TAEn0NW+2nQ5RMuBA 4ThGq/ah1vXWANOBtKlOfM6N+NLilUPqNu1Xz06xMHIud28PruJJyt1bYNhZydyS 8bDQUKXrZ2U1Zahdmg7XujzYHPTFcFkn66ZHs3Qfd4aPQRd15x3ArGrher4dWGaT 0eMm7rbbtI0/dYe1dWCP3VZMGT2SyudLc6rtFgndoq5JL2fyFmLd1j3DKYO9z8m1 ksYwi9fHBqKIHI7gvEgCEuM9F+DPNzrb7km0aig2bTCgNYwB7RhT6MnGeT4Ecjwp O0gWLww8Eb8nSC9bBit+OkddlPoBcK/ELKb+2qHtjEztCjG3auQJf5H/HTAdJwlV k/vjeYXnQ8q/XzZe3LDYwr87y3uKcw2zJflhcify1VFykt9H1wGvUe/IeeCZeMZd 1YxUdx5dSWeXG8WagEPtvNmqTdRlei6bZGmQd8Ab8nLAgckTdx+pqEFjSB0gS2x5
    t3HkEHM/Qk0=
    =r9Nd
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Le Cuirot@21:1/5 to James Le Cuirot on Tue Jan 24 23:50:01 2023
    On Fri, 2023-01-20 at 23:11 +0000, James Le Cuirot wrote:
    The context for this is a pull request I've been working on for a few weeks.

    https://github.com/gentoo/gentoo/pull/28851

    RAP prefix nobbled gcc/clang's sysroot when invoking the linker because glibc installed its linker scripts with prefixed paths, such as /path/to/prefix/lib rather than just /lib. Adjusting the linker scripts rather than the compiler behaviour is more natural and makes cross-compiling far easier.

    For the migration procedure, I did try a different approach of manually fixing
    up the linker scripts, but if you do this first, the gcc build fails immediately, and if you do this afterwards, the gcc build fails later. A symlink is therefore needed to allow the sysroot to be applied, even when the linker script paths are still prefixed.

    Unfortunately, it's not possible to filter news items on USE flags or even profile parents, so I've had to resort to explicitly listing all the prefix profiles. Prefix is quite a niche feature, so I don't want to show this news to everyone.

    Following some feedback elsewhere, I'm going to add an additional paragraph, because many users are not sure what kind of prefix they have. See below.

    ----

    Title: Breaking changes to the RAP Prefix toolchain
    Author: James Le Cuirot <chewi@gentoo.org>
    Posted: 2023-01-20
    Revision: 1
    News-Item-Format: 2.0
    Display-If-Profile: default/linux/amd64/17.0/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/17.1/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/23.0/no-multilib/prefix/* Display-If-Profile: default/linux/amd64/23.0/split-usr/no-multilib/prefix/* Display-If-Profile: default/linux/arm/17.0/armv7a/prefix/* Display-If-Profile: default/linux/arm/23.0/armv7a/prefix/* Display-If-Profile: default/linux/arm/23.0/split-usr/armv7a/prefix/* Display-If-Profile: default/linux/arm64/17.0/prefix/*
    Display-If-Profile: default/linux/arm64/23.0/prefix/*
    Display-If-Profile: default/linux/arm64/23.0/split-usr/prefix/* Display-If-Profile: default/linux/ppc64le/17.0/prefix/*
    Display-If-Profile: default/linux/riscv/20.0/rv64gc/lp64d/prefix/* Display-If-Profile: default/linux/riscv/23.0/rv64/lp64d/prefix/* Display-If-Profile: default/linux/riscv/23.0/rv64/split-usr/lp64d/prefix/* Display-If-Profile: default/linux/x86/17.0/prefix/*
    Display-If-Profile: default/linux/x86/23.0/prefix/*
    Display-If-Profile: default/linux/x86/23.0/split-usr/prefix/*

    We are changing the way the toolchain operates on RAP Prefix systems in order to
    reduce the number of hacks we need to apply and make cross-compiling easier.

    If you using a non-RAP "Prefix Guest" or "Prefix Stack" variant (e.g. macOS) then this does not apply.

    If you're not sure what kind of prefix you have, then check whether the prefix-guest USE flag is enabled.

    portageq envvar USE | grep prefix-guest

    If you are using a libc other than glibc (e.g. musl) then this *does* apply, but
    your libc will *not* break, so you should not carry out the following procedure.
    The only other package known to be affected is dev-libs/libbsd, which you can simply update. If you find another package affected by this, then please file a
    bug report.

    WARNING! It is important that you carry out the following procedure, otherwise
    your toolchain will break when you next update your compiler or glibc.

    1. Run the following to create a temporary symlink:

    EPREFIX=$(portageq envvar EPREFIX)
    mkdir -p "${EPREFIX}${EPREFIX%/*}"
    ln -sn "${EPREFIX}" "${EPREFIX}${EPREFIX}"

    2. Update or rebuild all installed slots of sys-devel/gcc and sys-devel/clang
    (if any). Feel free to remove any you no longer need.

    3. Update or rebuild sys-libs/glibc.

    4. Run the following to remove the symlink:

    EPREFIX=$(portageq envvar EPREFIX)
    rm "${EPREFIX}${EPREFIX}"

    5. If dev-libs/libbsd is installed, then update it to 0.11.7-r2 or later.

    If you are reading this having updated glibc first and you are no longer able to
    build anything, then don't panic. Simply execute the line below and then carry
    out the regular procedure above.

    qlist sys-libs/glibc | xargs grep -lIF "GNU ld script" | xargs sed -i -r "s: /(usr|lib): $(portageq envvar EPREFIX)/\1:g"



    -----BEGIN PGP SIGNATURE-----

    iQJFBAABCAAvFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAmPQXvERHGNoZXdpQGdl bnRvby5vcmcACgkQEiZBXQDdMTf0xg//TZHQG2dL8i+U3qkG1F3oFrAr7Mg6AfD6 a7F05MeuiPCADNqwN+StutlWMuUKpTgjY0hzyQptJiBDShYhJIQxrjlqUAZPlGmu bot80wgg+DXrQ/6BTbGVcZLHyJXEpnWrlixMqGA8EsaN2oRlJ7l65pZfg0P+m3/v U6nh+SVfkkPEWeNgTN9p73lsNIOqDnmdCcRgazPP9d8Um/0AOCHqDSXJjZdiBZfu 265vHDCzKiYzsCxaKn9ZTZ3c3/1UrvtitGbMTfwOv+kiv8Vztowe1rI/Q4m1t3t8 zJL8lTl1e/ga3Ojx9XURtTwqtuDoMfq6kFP9XFeH+G2aK+zXghcBLgQOdzBra0/C 5taCWT6U8yrQREbn2oxv5vJkVE4XiqLLZsoDX+JFRFoIb1SRTT6OYgTCtPmuaosQ Kb++TJKreryncj+wawjmjqhFyPmUehp73+zmAdmhLSu7TvCIEWHBlt5117oXh/J1 lMgHocg77cyBeps7EWym7gFOAmYtPsqJtEMJS878agllHfu7iqu4deX+OuHbXWWb 5jH0DqFHrc1qP9JgeBNQQW//s4laJRrlir1zsA7nWi+z0ITGZVMQ5EgxdMjxefpt bcy2Mt26Wj4DMWfoUbZUnf4vGLwQ9YcBEzt+wKqM24ZSeUSp4ZiiXBhTrUf6bUQr
    7AeBtVEOe3E=
    =jRtP
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)