public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain
@ 2023-01-20 23:11 James Le Cuirot
  2023-01-24 22:42 ` James Le Cuirot
  0 siblings, 1 reply; 2+ messages in thread
From: James Le Cuirot @ 2023-01-20 23:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: pr

[-- Attachment #1: Type: text/plain, Size: 3930 bytes --]

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"


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain
  2023-01-20 23:11 [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain James Le Cuirot
@ 2023-01-24 22:42 ` James Le Cuirot
  0 siblings, 0 replies; 2+ messages in thread
From: James Le Cuirot @ 2023-01-24 22:42 UTC (permalink / raw
  To: gentoo-dev; +Cc: pr

[-- Attachment #1: Type: text/plain, Size: 4465 bytes --]

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"
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-24 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-20 23:11 [gentoo-dev] NEWS: Breaking changes to the RAP Prefix toolchain James Le Cuirot
2023-01-24 22:42 ` James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox