Subject: bug#43679: closed (Re: [bug#43679] [PATCH v2 0/5] Add '--with-c-toolchain')

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 12 Oct 2020 16:29:02 +0000

Your bug report

#43679: [PATCH 0/5] Add '--with-toolchain' package transformation option

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
43679: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43679
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#43679] [PATCH v2 0/5] Add '--with-c-toolchain'
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Date: Mon, 12 Oct 2020 18:27:55 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi!

Ludovic Courtès <[email-masked]> skribis:

> This is v2 of this patch, with these changes:
>
>   1. ‘with-toolchain’ is replaced by ‘with-c-toolchain’ everywhere,
>      with the understanding that it’s about the C/C++ toolchain
>      in practice.  In the end I’m sympathetic with the argument
>      that C/C++ don’t have a monopoly on toolchains.  ;-)
>
>   2. ‘--with-c-toolchain=PACKAGE=TOOLCHAIN’ rebuilds not just
>      PACKAGE with TOOLCHAIN, but also everything above PACKAGE
>      with TOOLCHAIN (in v1, only PACKAGE was rebuilt with TOOLCHAIN
>      but everything above it had to be rebuilt anyway.)
>
>      The main motivation here is to reduce the changes that we’re
>      introducing ABI incompatibilities that users would have to work
>      around by passing on ‘--with-c-toolchain’ for each package in
>      the chain.  I think it also more closely matches user
>      expectations: when you see things are being rebuilt, you’re
>      likely to think that’s because they’re rebuilt with the new
>      toolchain, not the default one.
>
> Feedback welcome!
>
> Ludo’.
>
> Ludovic Courtès (5):
>   gnu: gcc-toolchain: Add 'GUIX_LOCPATH' to the search paths.
>   gnu: clang-toolchain: Add 'GUIX_LOCPATH' to the search paths.
>   gnu: clang-toolchain: Create 'cc' and 'c++' symlinks.
>   packages: Add 'package-with-c-toolchain'.
>   guix build: Add '--with-c-toolchain'.

Pushed as a2ed00f79fd5bf69c6cca3fa7bdc62726bf848fa!

Ludo’.

Subject: [PATCH 0/5] Add '--with-toolchain' package transformation option
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Cc: Ludovic Courtès <[email-masked]>
Date: Mon, 28 Sep 2020 21:53:05 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

From: Ludovic Courtès <[email-masked]>

Hello!

This patch series adds the ‘--with-toolchain’ option.  I’ve
tested it with gcc-toolchain@10 and clang-toolchain, and I can say
it works as advertised.  :-)

One thing I wasn’t entirely sure about: ‘--with-toolchain’ changes
the toolchain of the specified package, not that of its dependents.
This assumes that the toolchains all follow the same ABI.  This is
the case for C, apparently, maybe not for C++.  Should it instead
change to toolchain of the package’s dependents as well?

Something like:

  guix build guile --with-toolchain=[email-masked]=clang-toolchain 

generates working code.

Another issue is that since we use ‘package-input-rewriting/spec’,
we can’t change the toolchain of core packages like Guile or Perl
without rebuilding the world.  For example, if we omit “@3.0.4”
in the example above, we rebuild a “guile” package deep down and
everything that follows (aka. “the world”).

Another option I considered was to graft the package that
‘--with-toolchain’ targets instead of rebuilding its dependents.
Again that’d only work if the resulting binaries are ABI-compatible,
but maybe that’s a reasonable assumption.  It would definitely save
build time.  Should it be grafted, or should there be a separate
option to do that?  Thoughts?

Last, when doing ‘--with-toolchain=foo=gcc-toolchain’, I noticed
that ‘foo’ would keep a reference to ‘gcc-toolchain’ for some obscure
reasons:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build hello --with-toolchain=hello=gcc-toolchain
/gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10
$ grep -r $(guix build gcc-toolchain | head -2 |tail -1) /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10
Duuma dosiero /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10/bin/hello kongruas
$ strings /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10/bin/hello | grep $(guix build gcc-toolchain | head -2 |tail -1)
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib:/gnu/store/qj38f3vi4q1d7z30hkpaxyajv49rwamb-gcc-10.2.0-lib/lib:/gnu/store/qj38f3vi4q1d7z30hkpaxyajv49rwamb-gcc-10.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.2.0/../../..:/gnu/store/pknm43xsza6nlc7bn27djip8fis92akd-gcc-toolchain-10.2.0/lib
--8<---------------cut here---------------end--------------->8---

Not a showstopper but would be nice to address.

Feedback welcome!

Ludo’.

Ludovic Courtès (5):
  gnu: gcc-toolchain: Add 'GUIX_LOCPATH' to the search paths.
  gnu: clang-toolchain: Add 'GUIX_LOCPATH' to the search paths.
  gnu: clang-toolchain: Create 'cc' and 'c++' symlinks.
  packages: Add 'package-with-toolchain'.
  guix build: Add '--with-toolchain'.

 doc/guix.texi                 | 61 +++++++++++++++++++++++++++++++++++
 gnu/packages/commencement.scm |  8 +++--
 gnu/packages/llvm.scm         | 12 ++++++-
 guix/build-system.scm         | 35 ++++++++++++++++++--
 guix/packages.scm             |  9 ++++++
 guix/scripts/build.scm        | 40 +++++++++++++++++++++++
 tests/packages.scm            | 20 ++++++++++++
 tests/scripts-build.scm       | 30 +++++++++++++++++
 8 files changed, 210 insertions(+), 5 deletions(-)

-- 
2.28.0