GNU bug report logs - #37924
[PATCH] gnu: Fix make-gcc-libc

Previous Next

Package: guix-patches;

Reported by: Carl Dong <contact <at> carldong.me>

Date: Fri, 25 Oct 2019 15:41:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37924 in the body.
You can then email your comments to 37924 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37924; Package guix-patches. (Fri, 25 Oct 2019 15:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carl Dong <contact <at> carldong.me>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 25 Oct 2019 15:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carl Dong <contact <at> carldong.me>
To: "guix-patches <at> gnu.org" <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: Fix make-gcc-libc
Date: Fri, 25 Oct 2019 15:40:19 +0000
Reviewers, would like some insight into whether it's okay to remove the
FLAGS_FOR_TARGET. From what I can tell it comes from CROSS-GCC-ARGUMENTS in (gnu
packages cross-base) which might not be needed here since we're not
cross-building. I've tested this toolchain built without FLAGS_FOR_TARGET and it
_seems_ to work fine.

-----

Until now the following wouldn't build:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages commencement)
             (gnu packages gcc)
             (gnu packages base))

(make-gcc-libc gcc-9 glibc-2.27)
--8<---------------cut here---------------end--------------->8---

* gnu/packages/base.scm (make-gcc-libc)[phases]: Add environment
variables to place the target libc on the system header search path.
[make-flags]: Remove unncessary FLAGS_FOR_TARGET.
[native-inputs]: Construct in a way that doesn't require emptying
inputs.
---
 gnu/packages/base.scm | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 4e80a2fadb..3a3360dc7a 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -981,18 +981,23 @@ with the Linux kernel.")
             (substitute-keyword-arguments
              (ensure-keyword-arguments (package-arguments base-gcc)
                                        '(#:implicit-inputs? #f))
-             ((#:make-flags flags)
-              `(let ((libc (assoc-ref %build-inputs "libc")))
-                 ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
-                 ;; the -Bxxx for the startfiles.
-                 (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
-                       ,flags)))))
+             ((#:phases phases)
+              `(modify-phases ,phases
+                 (add-before 'configure 'treat-glibc-as-system-header
+                   (lambda _
+                     (let ((libc (assoc-ref %build-inputs "libc")))
+                       ;; GCCs build processes requires that the libc
+                       ;; we're building against is on the system header
+                       ;; search path.
+                       (for-each (lambda (var)
+                                   (setenv var (string-append libc "/include")))
+                                 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
+                       #t)))))))
            (native-inputs
-            `(("libc" ,libc)
-              ("libc:static" ,libc "static")
-              ,@(append (package-inputs base-gcc)
-                        (fold alist-delete (%final-inputs) '("libc" "libc:static")))))
-           (inputs '())))
+            `(,@(package-native-inputs base-gcc)
+              ,@(append (fold alist-delete (%final-inputs) '("libc" "libc:static")))
+              ("libc" ,libc)
+              ("libc:static" ,libc "static")))))

 (define-public (make-glibc-locales glibc)
   (package
--
2.23.0




Information forwarded to guix-patches <at> gnu.org:
bug#37924; Package guix-patches. (Fri, 25 Oct 2019 16:22:02 GMT) Full text and rfc822 format available.

Message #8 received at 37924 <at> debbugs.gnu.org (full text, mbox):

From: Carl Dong <contact <at> carldong.me>
To: "37924 <at> debbugs.gnu.org" <37924 <at> debbugs.gnu.org>
Subject: [PATCH 2/2] ci: Add 'make-gcc-toolchain' packages
Date: Fri, 25 Oct 2019 16:21:40 +0000
* gnu/ci.scm (%core-packages): Add 'glibc-2.28', a toolchain with
default 'gcc', and a toolchain targeting 'glibc-2.28'.
---
 gnu/ci.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/ci.scm b/gnu/ci.scm
index 5d5a826647..74df3c34ab 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -110,9 +110,11 @@ SYSTEM."
   ;; Note: Don't put the '-final' package variants because (1) that's
   ;; implicit, and (2) they cannot be cross-built (due to the explicit input
   ;; chain.)
-  (list gcc-4.8 gcc-4.9 gcc-5 glibc binutils
+  (list gcc-4.8 gcc-4.9 gcc-5 glibc glibc-2.28 binutils
         gmp mpfr mpc coreutils findutils diffutils patch sed grep
         gawk gnu-gettext hello guile-2.0 guile-2.2 zlib gzip xz
+        (make-gcc-toolchain gcc)
+        (make-gcc-toolchain gcc glibc-2.28)
         %bootstrap-binaries-tarball
         %binutils-bootstrap-tarball
         (%glibc-bootstrap-tarball)
--
2.23.0




Information forwarded to guix-patches <at> gnu.org:
bug#37924; Package guix-patches. (Mon, 04 Nov 2019 22:19:02 GMT) Full text and rfc822 format available.

Message #11 received at 37924 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: 37924 <at> debbugs.gnu.org
Subject: Re: [bug#37924] [PATCH] gnu: Fix make-gcc-libc
Date: Mon, 04 Nov 2019 23:18:28 +0100
Hi Carl,

Carl Dong <contact <at> carldong.me> skribis:

> Reviewers, would like some insight into whether it's okay to remove the
> FLAGS_FOR_TARGET. From what I can tell it comes from CROSS-GCC-ARGUMENTS in (gnu
> packages cross-base) which might not be needed here since we're not
> cross-building. I've tested this toolchain built without FLAGS_FOR_TARGET and it
> _seems_ to work fine.

I think it wouldn’t hurt to keep FLAGS_FOR_TARGET, but like you write,
it seems to be for cross-compilation only, so I guess it’s OK to remove
it here since ‘make-gcc-libc’ is meant to build native toolchains
anyway.

> Until now the following wouldn't build:
>
> (use-modules (gnu packages commencement)
>              (gnu packages gcc)
>              (gnu packages base))
>
> (make-gcc-libc gcc-9 glibc-2.27)
>
> * gnu/packages/base.scm (make-gcc-libc)[phases]: Add environment
> variables to place the target libc on the system header search path.
> [make-flags]: Remove unncessary FLAGS_FOR_TARGET.
> [native-inputs]: Construct in a way that doesn't require emptying
> inputs.

LGTM, thank you!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#37924; Package guix-patches. (Mon, 04 Nov 2019 22:23:01 GMT) Full text and rfc822 format available.

Message #14 received at 37924 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: "37924 <at> debbugs.gnu.org" <37924 <at> debbugs.gnu.org>
Subject: Re: [bug#37924] [PATCH 2/2] ci: Add 'make-gcc-toolchain' packages
Date: Mon, 04 Nov 2019 23:22:04 +0100
Hi,

Carl Dong <contact <at> carldong.me> skribis:

> * gnu/ci.scm (%core-packages): Add 'glibc-2.28', a toolchain with
> default 'gcc', and a toolchain targeting 'glibc-2.28'.

The problem is ‘%core-packages’ is only built when we explicitly choose
the “core” subset in CI (which we do only when experimenting with
‘core-updates’ early on); in other cases, all the public packages get
built and ‘%core-packages’ does not matter.

Would it be an option to have:

  (define-public gcc/glibc-2.28
    (make-gcc-libc gcc glibc-2.28))

in (gnu packages base), or does that create circular dependency issues
(I don’t think so, but better be safe)?

If we did that, that package would automatically picked up in CI.

Thanks,
Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 16 Nov 2019 16:37:02 GMT) Full text and rfc822 format available.

Notification sent to Carl Dong <contact <at> carldong.me>:
bug acknowledged by developer. (Sat, 16 Nov 2019 16:37:02 GMT) Full text and rfc822 format available.

Message #19 received at 37924-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: 37924-done <at> debbugs.gnu.org
Subject: Re: [bug#37924] [PATCH] gnu: Fix make-gcc-libc
Date: Sat, 16 Nov 2019 17:36:04 +0100
Carl Dong <contact <at> carldong.me> skribis:

> Until now the following wouldn't build:
>
> (use-modules (gnu packages commencement)
>              (gnu packages gcc)
>              (gnu packages base))
>
> (make-gcc-libc gcc-9 glibc-2.27)
>
> * gnu/packages/base.scm (make-gcc-libc)[phases]: Add environment
> variables to place the target libc on the system header search path.
> [make-flags]: Remove unncessary FLAGS_FOR_TARGET.
> [native-inputs]: Construct in a way that doesn't require emptying
> inputs.
> ---
>  gnu/packages/base.scm | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)

This was pushed as 2b1d708294f0aced5c991baed146e0ae4e7d63dd, closing!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Dec 2019 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.