GNU bug report logs - #52574
Cross-compiling glib failure

Previous Next

Package: guix;

Reported by: L p R n d n <guix <at> lprndn.info>

Date: Fri, 17 Dec 2021 12:53:02 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

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 52574 in the body.
You can then email your comments to 52574 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 bug-guix <at> gnu.org:
bug#52574; Package guix. (Fri, 17 Dec 2021 12:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to L p R n d n <guix <at> lprndn.info>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 17 Dec 2021 12:53:02 GMT) Full text and rfc822 format available.

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

From: L  p R n  d n    <guix <at> lprndn.info>
To: bug-guix <at> gnu.org 
Subject: Cross-compiling glib failure
Date: Fri, 17 Dec 2021 12:51:51 +0000
Hello guix,

Trying to cross-compile glib to aarch64with:

guix build --target=aarch64-linux-gnu glib

I get this error:

`Unbound variable: %outputs

I suppose the glib’s definition needs to be adapted to Guix’s new style
which was merged a few days ago?

Thanks,

L  p R n  d n   




Information forwarded to bug-guix <at> gnu.org:
bug#52574; Package guix. (Fri, 17 Dec 2021 21:41:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: L p R n d n <guix <at> lprndn.info>, 52574 <at> debbugs.gnu.org
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Fri, 17 Dec 2021 21:40:17 +0000
L p R n d n schreef op vr 17-12-2021 om 12:51 [+0000]:
> 
> Hello guix,
> 
> Trying to cross-compile glib to aarch64with:
> 
> guix build --target=aarch64-linux-gnu glib
> 
> I get this error:
> 
> `Unbound variable: %outputs
> 
> I suppose the glib’s definition needs to be adapted to Guix’s new
> style
> which was merged a few days ago?
> 

Actually, glib's build system (meson-build-system) did not support
cross-compilation at all before the merge. Cross-compilation support
was added on that branch, but glib's package broke later, presumably in
<https://git.savannah.gnu.org/cgit/guix.git/commit/?id=f22f6fc3b6cc6382df3246d192a40a3951b48c37>.

The fix would be to replace to wrap the configure flags in a #~,
instead of a ´,replace (assoc-ref %outputs "bin") by #$output:bin and
adjust the configure flags of glib-with-documentation to use #~ and #$
instead of ´ and ,.

To avoid rebuilds, some
(if (%current-target-system) #~#$output:bin #~(assoc-ref %outputs
"bin"))
may be needed.

Greetings,
Maxime.





Information forwarded to bug-guix <at> gnu.org:
bug#52574; Package guix. (Sat, 18 Dec 2021 04:35:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 52574 <at> debbugs.gnu.org, L p R n d n <guix <at> lprndn.info>
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Fri, 17 Dec 2021 23:34:47 -0500
Maxime Devos <maximedevos <at> telenet.be> writes:

> L p R n d n schreef op vr 17-12-2021 om 12:51 [+0000]:
>> 
>> Hello guix,
>> 
>> Trying to cross-compile glib to aarch64with:
>> 
>> guix build --target=aarch64-linux-gnu glib
>> 
>> I get this error:
>> 
>> `Unbound variable: %outputs
>> 
>> I suppose the glib’s definition needs to be adapted to Guix’s new
>> style
>> which was merged a few days ago?
>> 
>
> Actually, glib's build system (meson-build-system) did not support
> cross-compilation at all before the merge. Cross-compilation support
> was added on that branch, but glib's package broke later, presumably in
> <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=f22f6fc3b6cc6382df3246d192a40a3951b48c37>.
>
> The fix would be to replace to wrap the configure flags in a #~,
> instead of a ´,replace (assoc-ref %outputs "bin") by #$output:bin and
> adjust the configure flags of glib-with-documentation to use #~ and #$
> instead of ´ and ,.
>
> To avoid rebuilds, some
> (if (%current-target-system) #~#$output:bin #~(assoc-ref %outputs
> "bin"))
> may be needed.

Thanks for the hints.  I'm trying the following fix on my (local for
now) version-1.4.0 branch:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/glib.scm
@@ -212,12 +212,11 @@ (define glib
                    `(,(this-package-native-input "python")
                      ,(this-package-native-input "python-wrapper")))
               '()))
-       #:configure-flags (list "--default-library=both"
-                               "-Dman=false"
-                               "-Dselinux=disabled"
-                               (string-append "--bindir="
-                                              (assoc-ref %outputs "bin")
-                                              "/bin"))
+       #:configure-flags #~(list "--default-library=both"
+                                 "-Dman=false"
+                                 "-Dselinux=disabled"
+                                 (string-append "--bindir="
+                                                #$output:bin "/bin"))
        #:phases
        (modify-phases %standard-phases
          ;; Needed to pass the test phase on slower ARM and i686 machines.
@@ -365,8 +364,8 @@ (define-public glib-with-documentation
     (arguments
      (substitute-keyword-arguments (package-arguments glib)
        ((#:configure-flags flags ''())
-        `(cons "-Dgtk_doc=true"
-               (delete "-Dman=false" ,flags)))
+        #~(cons "-Dgtk_doc=true"
+                (delete "-Dman=false" #$flags)))
        ((#:phases phases)
         `(modify-phases ,phases
            (add-after 'unpack 'patch-docbook-xml
--8<---------------cut here---------------end--------------->8---

Thanks,

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#52574; Package guix. (Sun, 19 Dec 2021 22:14:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 52574 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 L p R n d n <guix <at> lprndn.info>
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Sun, 19 Dec 2021 23:12:51 +0100
[Message part 1 (text/plain, inline)]
Hi,

Maxime Devos <maximedevos <at> telenet.be> skribis:

> Actually, glib's build system (meson-build-system) did not support
> cross-compilation at all before the merge. Cross-compilation support
> was added on that branch, but glib's package broke later, presumably in
> <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=f22f6fc3b6cc6382df3246d192a40a3951b48c37>.
>
> The fix would be to replace to wrap the configure flags in a #~,
> instead of a ´,replace (assoc-ref %outputs "bin") by #$output:bin and
> adjust the configure flags of glib-with-documentation to use #~ and #$
> instead of ´ and ,.
>
> To avoid rebuilds, some
> (if (%current-target-system) #~#$output:bin #~(assoc-ref %outputs
> "bin"))
> may be needed.

In the case of ‘meson-build-system’, the logical fix IMO would be to
define ‘%build-inputs‘, ‘%outputs’, etc. when cross-compiling, with the
patch below.

This would be consistent with the fact that ‘meson-build-system’ defines
those variables for native builds already.

Thoughts?

Longer-term we can move away from ‘%outputs’, ‘%build-inputs’, & co.,
but that’s another story.

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index ba7441a3eb..ad604f8871 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -287,6 +287,19 @@ (define builder
       #~(begin
           (use-modules #$@(sexp->gexp modules))
 
+          (define %build-host-inputs
+            #+(input-tuples->gexp build-inputs))
+
+          (define %build-target-inputs
+            (append #$(input-tuples->gexp host-inputs)
+                    #+(input-tuples->gexp target-inputs)))
+
+          (define %build-inputs
+            (append %build-host-inputs %build-target-inputs))
+
+          (define %outputs
+            #$(outputs->gexp outputs))
+
           (define build-phases
             #$(let ((phases (if (pair? phases) (sexp->gexp phases) phases)))
                 (if glib-or-gtk?

Information forwarded to bug-guix <at> gnu.org:
bug#52574; Package guix. (Mon, 20 Dec 2021 04:56:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 52574 <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>,
 L p R n d n <guix <at> lprndn.info>
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Sun, 19 Dec 2021 23:55:40 -0500
Hi,

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

> Hi,
>
> Maxime Devos <maximedevos <at> telenet.be> skribis:
>
>> Actually, glib's build system (meson-build-system) did not support
>> cross-compilation at all before the merge. Cross-compilation support
>> was added on that branch, but glib's package broke later, presumably in
>> <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=f22f6fc3b6cc6382df3246d192a40a3951b48c37>.
>>
>> The fix would be to replace to wrap the configure flags in a #~,
>> instead of a ´,replace (assoc-ref %outputs "bin") by #$output:bin and
>> adjust the configure flags of glib-with-documentation to use #~ and #$
>> instead of ´ and ,.
>>
>> To avoid rebuilds, some
>> (if (%current-target-system) #~#$output:bin #~(assoc-ref %outputs
>> "bin"))
>> may be needed.
>
> In the case of ‘meson-build-system’, the logical fix IMO would be to
> define ‘%build-inputs‘, ‘%outputs’, etc. when cross-compiling, with the
> patch below.
>
> This would be consistent with the fact that ‘meson-build-system’ defines
> those variables for native builds already.
>
> Thoughts?
>
> Longer-term we can move away from ‘%outputs’, ‘%build-inputs’, & co.,
> but that’s another story.

Seems the proper fix; I'm just wondering; could there be other build
systems that were overlooked needing the same fix?  If so, we should fix
them now too.




Information forwarded to bug-guix <at> gnu.org:
bug#52574; Package guix. (Tue, 21 Dec 2021 09:05:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 52574 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 L p R n d n <guix <at> lprndn.info>
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Tue, 21 Dec 2021 10:04:27 +0100
Hi,

Maxime Devos <maximedevos <at> telenet.be> skribis:

> When compiling natively, we have the convenient 'with-build-variables'
> procedure. Maybe we can have a 'with-cross-build-variables' for when
> cross-compiling?
>
> That could be used in the 'gnu', etc. build systems as well, reducing
> some duplication between build systems.

Yes, that’s a good idea.

Ludo’.




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Mon, 17 Jan 2022 17:15:01 GMT) Full text and rfc822 format available.

Notification sent to L p R n d n <guix <at> lprndn.info>:
bug acknowledged by developer. (Mon, 17 Jan 2022 17:15:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 52574-done <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>,
 L p R n d n <guix <at> lprndn.info>
Subject: Re: bug#52574: Cross-compiling glib failure
Date: Mon, 17 Jan 2022 12:14:18 -0500
Hi,

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

> Hi,
>
> Maxime Devos <maximedevos <at> telenet.be> skribis:
>
>> When compiling natively, we have the convenient 'with-build-variables'
>> procedure. Maybe we can have a 'with-cross-build-variables' for when
>> cross-compiling?
>>
>> That could be used in the 'gnu', etc. build systems as well, reducing
>> some duplication between build systems.
>
> Yes, that’s a good idea.

Agreed!

In other news, closing this bug, now resolved on master via
8faa04c316fd2318708f2fcfaeea402615aafef9.

Thanks!

Maxim




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

This bug report was last modified 2 years and 62 days ago.

Previous Next


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