GNU bug report logs - #46725
[PATCH] gnu: guile-lib: Fix cross compilation.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Tue, 23 Feb 2021 20:09:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

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 46725 in the body.
You can then email your comments to 46725 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#46725; Package guix-patches. (Tue, 23 Feb 2021 20:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 23 Feb 2021 20:09:02 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Tue, 23 Feb 2021 20:07:55 +0000
These changes were sent upstream as
https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html

Without this change, the .go files are built for the host architecture, rather
than the target. I noticed this when cross building the
guix-build-coordinator (for which guile-lib is an input) to the Hurd.

* gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
'patch-for-cross-compilation phase.
[native-inputs]: Add autoconf, automake and gettext.
---
 gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index ce5aad8ec7..e9dfc6cc8d 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2194,6 +2194,20 @@ library.")
        '("GUILE_AUTO_COMPILE=0")        ; to prevent guild errors
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-for-cross-compilation
+           (lambda _
+             (substitute* "configure.ac"
+               (("GUILE_FLAGS")
+                "GUILE_FLAGS
+if test \"$cross_compiling\" != no; then
+   GUILE_TARGET=\"--target=$host_alias\"
+   AC_SUBST([GUILE_TARGET])
+fi
+"))
+             (substitute* "am/guile.mk"
+               (("guild compile") "guild compile $(GUILE_TARGET)"))
+             (invoke "autoreconf" "-vif")
+             #t))
          (add-before 'configure 'patch-module-dir
            (lambda _
              (substitute* "src/Makefile.in"
@@ -2204,7 +2218,10 @@ library.")
 $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
              #t)))))
     (native-inputs
-     `(("guile" ,guile-3.0)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)
+       ("guile" ,guile-3.0)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("guile" ,guile-3.0)))
-- 
2.30.0





Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Wed, 24 Feb 2021 07:59:01 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Christopher Baines <mail <at> cbaines.net>, 46725 <at> debbugs.gnu.org
Subject: Re: [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Wed, 24 Feb 2021 08:58:24 +0100
Hello,

Am Dienstag, den 23.02.2021, 20:07 +0000 schrieb Christopher Baines:
> These changes were sent upstream as
> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
> 
> Without this change, the .go files are built for the host
> architecture, rather
> than the target. I noticed this when cross building the
> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
> 
> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
> 'patch-for-cross-compilation phase.
> [native-inputs]: Add autoconf, automake and gettext.
> ---
>  gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
> index ce5aad8ec7..e9dfc6cc8d 100644
> --- a/gnu/packages/guile-xyz.scm
> +++ b/gnu/packages/guile-xyz.scm
> @@ -2194,6 +2194,20 @@ library.")
>         '("GUILE_AUTO_COMPILE=0")        ; to prevent guild errors
>         #:phases
>         (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-for-cross-compilation
> +           (lambda _
> +             (substitute* "configure.ac"
> +               (("GUILE_FLAGS")
> +                "GUILE_FLAGS
> +if test \"$cross_compiling\" != no; then
> +   GUILE_TARGET=\"--target=$host_alias\"
> +   AC_SUBST([GUILE_TARGET])
> +fi
> +"))
> +             (substitute* "am/guile.mk"
> +               (("guild compile") "guild compile $(GUILE_TARGET)"))
> +             (invoke "autoreconf" "-vif")
Invoking autoreconf seems a bit overkill for a "patch-<something>"
phase.  Wouldn't it be regenerated in bootstrap if you (delete-file
"configure")?
> +             #t))
>           (add-before 'configure 'patch-module-dir
>             (lambda _
>               (substitute* "src/Makefile.in"
> @@ -2204,7 +2218,10 @@ library.")
>  $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
>               #t)))))
>      (native-inputs
> -     `(("guile" ,guile-3.0)
> +     `(("autoconf" ,autoconf)
> +       ("automake" ,automake)
> +       ("gettext" ,gettext-minimal)
> +       ("guile" ,guile-3.0)
>         ("pkg-config" ,pkg-config)))
>      (inputs
>       `(("guile" ,guile-3.0)))
Otherwise LGTM, but I haven't checked cross-compiling.  From your
message I'll assume you did.

Regards,
Leo





Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Wed, 24 Feb 2021 08:38:01 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: 46725 <at> debbugs.gnu.org
Subject: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Wed, 24 Feb 2021 08:37:09 +0000
These changes were sent upstream as
https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html

Without this change, the .go files are built for the host architecture, rather
than the target. I noticed this when cross building the
guix-build-coordinator (for which guile-lib is an input) to the Hurd.

* gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
'patch-for-cross-compilation phase.
[native-inputs]: Add autoconf, automake and gettext.
(guile2.0-lib): Adjust to use alist-replace.
(guile2.2-lib): Adjust to use alist-replace.
---
 gnu/packages/guile-xyz.scm | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index ce5aad8ec7..07f81bcc1b 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -116,6 +116,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system guile)
   #:use-module (guix utils)
+  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:select (alist-delete)))
 
@@ -2194,6 +2195,21 @@ library.")
        '("GUILE_AUTO_COMPILE=0")        ; to prevent guild errors
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-for-cross-compilation
+           (lambda _
+             (substitute* "configure.ac"
+               (("GUILE_FLAGS")
+                "GUILE_FLAGS
+if test \"$cross_compiling\" != no; then
+   GUILE_TARGET=\"--target=$host_alias\"
+   AC_SUBST([GUILE_TARGET])
+fi
+"))
+             (substitute* "am/guile.mk"
+               (("guild compile") "guild compile $(GUILE_TARGET)"))
+             (delete-file "configure")  ; trigger the bootstrap phase to run
+                                        ; autoreconf
+             #t))
          (add-before 'configure 'patch-module-dir
            (lambda _
              (substitute* "src/Makefile.in"
@@ -2204,7 +2220,10 @@ library.")
 $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
              #t)))))
     (native-inputs
-     `(("guile" ,guile-3.0)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)
+       ("guile" ,guile-3.0)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("guile" ,guile-3.0)))
@@ -2225,15 +2244,23 @@ for Guile\".")
   (package
     (inherit guile-lib)
     (name "guile2.0-lib")
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("guile" ,guile-2.0)))))
+    (native-inputs
+     (alist-replace "guile" (list guile-2.0)
+                    (package-native-inputs guile-lib)))
+    (inputs
+     (alist-replace "guile" (list guile-2.0)
+                    (package-inputs guile-lib)))))
 
 (define-public guile2.2-lib
   (package
     (inherit guile-lib)
     (name "guile2.2-lib")
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("guile" ,guile-2.2)))))
+    (native-inputs
+     (alist-replace "guile" (list guile-2.2)
+                    (package-native-inputs guile-lib)))
+    (inputs
+     (alist-replace "guile" (list guile-2.2)
+                    (package-inputs guile-lib)))))
 
 (define-public guile3.0-lib
   (deprecated-package "guile3.0-lib" guile-lib))
-- 
2.30.0





Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Wed, 24 Feb 2021 08:46:01 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 46725 <at> debbugs.gnu.org
Subject: Re: [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Wed, 24 Feb 2021 08:45:48 +0000
[Message part 1 (text/plain, inline)]
Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Am Dienstag, den 23.02.2021, 20:07 +0000 schrieb Christopher Baines:
>> These changes were sent upstream as
>> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>> 
>> Without this change, the .go files are built for the host
>> architecture, rather
>> than the target. I noticed this when cross building the
>> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>> 
>> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
>> 'patch-for-cross-compilation phase.
>> [native-inputs]: Add autoconf, automake and gettext.
>> ---
>>  gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
>> index ce5aad8ec7..e9dfc6cc8d 100644
>> --- a/gnu/packages/guile-xyz.scm
>> +++ b/gnu/packages/guile-xyz.scm
>> @@ -2194,6 +2194,20 @@ library.")
>>         '("GUILE_AUTO_COMPILE=0")        ; to prevent guild errors
>>         #:phases
>>         (modify-phases %standard-phases
>> +         (add-after 'unpack 'patch-for-cross-compilation
>> +           (lambda _
>> +             (substitute* "configure.ac"
>> +               (("GUILE_FLAGS")
>> +                "GUILE_FLAGS
>> +if test \"$cross_compiling\" != no; then
>> +   GUILE_TARGET=\"--target=$host_alias\"
>> +   AC_SUBST([GUILE_TARGET])
>> +fi
>> +"))
>> +             (substitute* "am/guile.mk"
>> +               (("guild compile") "guild compile $(GUILE_TARGET)"))
>> +             (invoke "autoreconf" "-vif")
>
> Invoking autoreconf seems a bit overkill for a "patch-<something>"
> phase.  Wouldn't it be regenerated in bootstrap if you (delete-file
> "configure")?

Yeah, this works as well. I've changed this phase to delete the
configure file instead.

>> +             #t))
>>           (add-before 'configure 'patch-module-dir
>>             (lambda _
>>               (substitute* "src/Makefile.in"
>> @@ -2204,7 +2218,10 @@ library.")
>>  $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
>>               #t)))))
>>      (native-inputs
>> -     `(("guile" ,guile-3.0)
>> +     `(("autoconf" ,autoconf)
>> +       ("automake" ,automake)
>> +       ("gettext" ,gettext-minimal)
>> +       ("guile" ,guile-3.0)
>>         ("pkg-config" ,pkg-config)))
>>      (inputs
>>       `(("guile" ,guile-3.0)))
>
> Otherwise LGTM, but I haven't checked cross-compiling.  From your
> message I'll assume you did.

Turns out I broke guile2.0-lib and guile2.2-lib, so I've sent another
patch which fixes that.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Tue, 02 Mar 2021 19:21:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 46725 <at> debbugs.gnu.org
Subject: Re: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Tue, 02 Mar 2021 20:20:44 +0100
Hi!

Christopher Baines <mail <at> cbaines.net> skribis:

> These changes were sent upstream as
> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>
> Without this change, the .go files are built for the host architecture, rather
> than the target. I noticed this when cross building the
> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>
> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
> 'patch-for-cross-compilation phase.
> [native-inputs]: Add autoconf, automake and gettext.
> (guile2.0-lib): Adjust to use alist-replace.
> (guile2.2-lib): Adjust to use alist-replace.

[...]

> +             (substitute* "configure.ac"
> +               (("GUILE_FLAGS")
> +                "GUILE_FLAGS
> +if test \"$cross_compiling\" != no; then
> +   GUILE_TARGET=\"--target=$host_alias\"
> +   AC_SUBST([GUILE_TARGET])
> +fi

You could even set ‘GUILE_TARGET’ unconditionally.

Otherwise LGTM.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Thu, 04 Mar 2021 13:18:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 46725 <at> debbugs.gnu.org, Christopher Baines <mail <at> cbaines.net>
Subject: Re: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Thu, 04 Mar 2021 08:16:49 -0500
Hi Ludovic,

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

> Hi!
>
> Christopher Baines <mail <at> cbaines.net> skribis:
>
>> These changes were sent upstream as
>> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>>
>> Without this change, the .go files are built for the host architecture, rather
>> than the target. I noticed this when cross building the
>> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>>
>> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
>> 'patch-for-cross-compilation phase.
>> [native-inputs]: Add autoconf, automake and gettext.
>> (guile2.0-lib): Adjust to use alist-replace.
>> (guile2.2-lib): Adjust to use alist-replace.
>
> [...]
>
>> +             (substitute* "configure.ac"
>> +               (("GUILE_FLAGS")
>> +                "GUILE_FLAGS
>> +if test \"$cross_compiling\" != no; then
>> +   GUILE_TARGET=\"--target=$host_alias\"
>> +   AC_SUBST([GUILE_TARGET])
>> +fi
>
> You could even set ‘GUILE_TARGET’ unconditionally.

It seems a conditional is needed, because info
'(autoconf)Canonicalizing' says:

    The variables ‘build_alias’, ‘host_alias’, and ‘target_alias’ are
    always exactly the arguments of ‘--build’, ‘--host’, and ‘--target’; in
    particular, they are left empty if the user did not use them, even if
    the corresponding ‘AC_CANONICAL’ macro was run.

I.e. without the condition '--target=' could be passed to guild, which
probably wouldn't work.

But in another part of the autoconf manual (Hosts and
Cross-Compilation), it says:

      The relationship between build, host, and target have been cleaned
    up: the chain of default is now simply: target defaults to host, host to
    build, and build to the result of ‘config.guess’.  Nevertheless, in
    order to ease the transition from 2.13 to 2.50, the following transition
    scheme is implemented.  _Do not rely on it_, as it will be completely
    disabled in a couple of releases (we cannot keep it, as it proves to
    cause more problems than it cures).

       They all default to the result of running ‘config.guess’, unless you
    specify either ‘--build’ or ‘--host’.  In this case, the default becomes
    the system type you specified.  If you specify both, and they’re
    different, ‘configure’ enters cross compilation mode, so it doesn’t run
    any tests that require execution.

       Hint: if you mean to override the result of ‘config.guess’, prefer
    ‘--build’ over ‘--host’.

So it seems that nowadays the build, host, and target would take default
values as guessed by config.guess, and that the earlier section of the
manual should be updated?

Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Mon, 08 Mar 2021 14:23:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 46725 <at> debbugs.gnu.org, Christopher Baines <mail <at> cbaines.net>
Subject: Re: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Mon, 08 Mar 2021 15:22:11 +0100
Hi,

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

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hi!
>>
>> Christopher Baines <mail <at> cbaines.net> skribis:
>>
>>> These changes were sent upstream as
>>> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>>>
>>> Without this change, the .go files are built for the host architecture, rather
>>> than the target. I noticed this when cross building the
>>> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>>>
>>> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
>>> 'patch-for-cross-compilation phase.
>>> [native-inputs]: Add autoconf, automake and gettext.
>>> (guile2.0-lib): Adjust to use alist-replace.
>>> (guile2.2-lib): Adjust to use alist-replace.
>>
>> [...]
>>
>>> +             (substitute* "configure.ac"
>>> +               (("GUILE_FLAGS")
>>> +                "GUILE_FLAGS
>>> +if test \"$cross_compiling\" != no; then
>>> +   GUILE_TARGET=\"--target=$host_alias\"
>>> +   AC_SUBST([GUILE_TARGET])
>>> +fi
>>
>> You could even set ‘GUILE_TARGET’ unconditionally.
>
> It seems a conditional is needed, because info
> '(autoconf)Canonicalizing' says:
>
>     The variables ‘build_alias’, ‘host_alias’, and ‘target_alias’ are
>     always exactly the arguments of ‘--build’, ‘--host’, and ‘--target’; in
>     particular, they are left empty if the user did not use them, even if
>     the corresponding ‘AC_CANONICAL’ macro was run.
>
> I.e. without the condition '--target=' could be passed to guild, which
> probably wouldn't work.

Ah true.  In Guile-{Gcrypt,zlib,…}, ‘--target’ is passed conditionally.
Apologies for the confusion!

> So it seems that nowadays the build, host, and target would take default
> values as guessed by config.guess, and that the earlier section of the
> manual should be updated?

Dunno; but in hindsight, what Chris did seemed right.

Thanks,
Ludo’.




Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Mon, 08 Mar 2021 22:12:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Mon, 08 Mar 2021 22:12:02 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: 46725-done <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Mon, 08 Mar 2021 22:11:02 +0000
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>
>>> Hi!
>>>
>>> Christopher Baines <mail <at> cbaines.net> skribis:
>>>
>>>> These changes were sent upstream as
>>>> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>>>>
>>>> Without this change, the .go files are built for the host architecture, rather
>>>> than the target. I noticed this when cross building the
>>>> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>>>>
>>>> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
>>>> 'patch-for-cross-compilation phase.
>>>> [native-inputs]: Add autoconf, automake and gettext.
>>>> (guile2.0-lib): Adjust to use alist-replace.
>>>> (guile2.2-lib): Adjust to use alist-replace.
>>>
>>> [...]
>>>
>>>> +             (substitute* "configure.ac"
>>>> +               (("GUILE_FLAGS")
>>>> +                "GUILE_FLAGS
>>>> +if test \"$cross_compiling\" != no; then
>>>> +   GUILE_TARGET=\"--target=$host_alias\"
>>>> +   AC_SUBST([GUILE_TARGET])
>>>> +fi
>>>
>>> You could even set ‘GUILE_TARGET’ unconditionally.
>>
>> It seems a conditional is needed, because info
>> '(autoconf)Canonicalizing' says:
>>
>>     The variables ‘build_alias’, ‘host_alias’, and ‘target_alias’ are
>>     always exactly the arguments of ‘--build’, ‘--host’, and ‘--target’; in
>>     particular, they are left empty if the user did not use them, even if
>>     the corresponding ‘AC_CANONICAL’ macro was run.
>>
>> I.e. without the condition '--target=' could be passed to guild, which
>> probably wouldn't work.
>
> Ah true.  In Guile-{Gcrypt,zlib,…}, ‘--target’ is passed conditionally.
> Apologies for the confusion!
>
>> So it seems that nowadays the build, host, and target would take default
>> values as guessed by config.guess, and that the earlier section of the
>> manual should be updated?
>
> Dunno; but in hindsight, what Chris did seemed right.

I don't really get the change I'm making, but I'm confident it has the
desired effect, I just copied it other Guile libraries. Anyway, I think
this is still useful, so I've gone ahead and pushed as
a0b24d5f8c5813329986b1bd690ed50b5308cc78.

If there are better ways to get the cross compiling to work, then that
can be put in place upstream, and then these changes removed.

Thanks,

Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46725; Package guix-patches. (Thu, 11 Mar 2021 21:02:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Christopher Baines <mail <at> cbaines.net>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 46725-done <at> debbugs.gnu.org
Subject: Re: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Thu, 11 Mar 2021 16:01:49 -0500
Hi Chris,

Christopher Baines <mail <at> cbaines.net> writes:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hi,
>>
>> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>>
>>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>>
>>>> Hi!
>>>>
>>>> Christopher Baines <mail <at> cbaines.net> skribis:
>>>>
>>>>> These changes were sent upstream as
>>>>> https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
>>>>>
>>>>> Without this change, the .go files are built for the host architecture, rather
>>>>> than the target. I noticed this when cross building the
>>>>> guix-build-coordinator (for which guile-lib is an input) to the Hurd.
>>>>>
>>>>> * gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
>>>>> 'patch-for-cross-compilation phase.
>>>>> [native-inputs]: Add autoconf, automake and gettext.
>>>>> (guile2.0-lib): Adjust to use alist-replace.
>>>>> (guile2.2-lib): Adjust to use alist-replace.
>>>>
>>>> [...]
>>>>
>>>>> +             (substitute* "configure.ac"
>>>>> +               (("GUILE_FLAGS")
>>>>> +                "GUILE_FLAGS
>>>>> +if test \"$cross_compiling\" != no; then
>>>>> +   GUILE_TARGET=\"--target=$host_alias\"
>>>>> +   AC_SUBST([GUILE_TARGET])
>>>>> +fi
>>>>
>>>> You could even set ‘GUILE_TARGET’ unconditionally.
>>>
>>> It seems a conditional is needed, because info
>>> '(autoconf)Canonicalizing' says:
>>>
>>>     The variables ‘build_alias’, ‘host_alias’, and ‘target_alias’ are
>>>     always exactly the arguments of ‘--build’, ‘--host’, and ‘--target’; in
>>>     particular, they are left empty if the user did not use them, even if
>>>     the corresponding ‘AC_CANONICAL’ macro was run.
>>>
>>> I.e. without the condition '--target=' could be passed to guild, which
>>> probably wouldn't work.
>>
>> Ah true.  In Guile-{Gcrypt,zlib,…}, ‘--target’ is passed conditionally.
>> Apologies for the confusion!
>>
>>> So it seems that nowadays the build, host, and target would take default
>>> values as guessed by config.guess, and that the earlier section of the
>>> manual should be updated?
>>
>> Dunno; but in hindsight, what Chris did seemed right.
>
> I don't really get the change I'm making, but I'm confident it has the
> desired effect, I just copied it other Guile libraries. Anyway, I think
> this is still useful, so I've gone ahead and pushed as
> a0b24d5f8c5813329986b1bd690ed50b5308cc78.
>
> If there are better ways to get the cross compiling to work, then that
> can be put in place upstream, and then these changes removed.
>
> Thanks,
>
> Chris

FYI, I have sent to the Guile patches tracker commits (keeping original
authorship) of all the Guix-specific changes to guile-lib; the version
of your patch is slightly modified to test the value about to be used,
but otherwise it behaves the same.

Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 09 Apr 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 15 days ago.

Previous Next


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