unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52574: Cross-compiling glib failure
@ 2021-12-17 12:51 L p R n d n
  2021-12-17 21:40 ` Maxime Devos
  0 siblings, 1 reply; 7+ messages in thread
From: L p R n d n @ 2021-12-17 12:51 UTC (permalink / raw)
  To: 52574


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   




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

* bug#52574: Cross-compiling glib failure
  2021-12-17 12:51 bug#52574: Cross-compiling glib failure L p R n d n
@ 2021-12-17 21:40 ` Maxime Devos
  2021-12-18  4:34   ` Maxim Cournoyer
  2021-12-19 22:12   ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Maxime Devos @ 2021-12-17 21:40 UTC (permalink / raw)
  To: L p R n d n, 52574

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.





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

* bug#52574: Cross-compiling glib failure
  2021-12-17 21:40 ` Maxime Devos
@ 2021-12-18  4:34   ` Maxim Cournoyer
  2021-12-19 22:12   ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2021-12-18  4:34 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 52574, L p R n d n

Maxime Devos <maximedevos@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




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

* bug#52574: Cross-compiling glib failure
  2021-12-17 21:40 ` Maxime Devos
  2021-12-18  4:34   ` Maxim Cournoyer
@ 2021-12-19 22:12   ` Ludovic Courtès
  2021-12-20  4:55     ` Maxim Cournoyer
       [not found]     ` <c39f3277b9e7c71a2d710b81e9468db640f47b63.camel@telenet.be>
  1 sibling, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-12-19 22:12 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 52574, Maxim Cournoyer, L p R n d n

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

Hi,

Maxime Devos <maximedevos@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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 839 bytes --]

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?

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

* bug#52574: Cross-compiling glib failure
  2021-12-19 22:12   ` Ludovic Courtès
@ 2021-12-20  4:55     ` Maxim Cournoyer
       [not found]     ` <c39f3277b9e7c71a2d710b81e9468db640f47b63.camel@telenet.be>
  1 sibling, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2021-12-20  4:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 52574, L p R n d n

Hi,

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

> Hi,
>
> Maxime Devos <maximedevos@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.




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

* bug#52574: Cross-compiling glib failure
       [not found]     ` <c39f3277b9e7c71a2d710b81e9468db640f47b63.camel@telenet.be>
@ 2021-12-21  9:04       ` Ludovic Courtès
  2022-01-17 17:14         ` Maxim Cournoyer
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2021-12-21  9:04 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 52574, Maxim Cournoyer, L p R n d n

Hi,

Maxime Devos <maximedevos@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’.




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

* bug#52574: Cross-compiling glib failure
  2021-12-21  9:04       ` Ludovic Courtès
@ 2022-01-17 17:14         ` Maxim Cournoyer
  0 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2022-01-17 17:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 52574-done, L p R n d n

Hi,

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

> Hi,
>
> Maxime Devos <maximedevos@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




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

end of thread, other threads:[~2022-01-17 17:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-17 12:51 bug#52574: Cross-compiling glib failure L p R n d n
2021-12-17 21:40 ` Maxime Devos
2021-12-18  4:34   ` Maxim Cournoyer
2021-12-19 22:12   ` Ludovic Courtès
2021-12-20  4:55     ` Maxim Cournoyer
     [not found]     ` <c39f3277b9e7c71a2d710b81e9468db640f47b63.camel@telenet.be>
2021-12-21  9:04       ` Ludovic Courtès
2022-01-17 17:14         ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).