unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
@ 2021-02-23 20:07 Christopher Baines
  2021-02-24  7:58 ` Leo Prikler
  2021-02-24  8:37 ` Christopher Baines
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher Baines @ 2021-02-23 20:07 UTC (permalink / raw)
  To: 46725

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





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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-02-23 20:07 [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation Christopher Baines
@ 2021-02-24  7:58 ` Leo Prikler
  2021-02-24  8:45   ` Christopher Baines
  2021-02-24  8:37 ` Christopher Baines
  1 sibling, 1 reply; 9+ messages in thread
From: Leo Prikler @ 2021-02-24  7:58 UTC (permalink / raw)
  To: Christopher Baines, 46725

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





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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-02-23 20:07 [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation Christopher Baines
  2021-02-24  7:58 ` Leo Prikler
@ 2021-02-24  8:37 ` Christopher Baines
  2021-03-02 19:20   ` Ludovic Courtès
  1 sibling, 1 reply; 9+ messages in thread
From: Christopher Baines @ 2021-02-24  8:37 UTC (permalink / raw)
  To: 46725

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





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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-02-24  7:58 ` Leo Prikler
@ 2021-02-24  8:45   ` Christopher Baines
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Baines @ 2021-02-24  8:45 UTC (permalink / raw)
  To: Leo Prikler; +Cc: 46725

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


Leo Prikler <leo.prikler@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-02-24  8:37 ` Christopher Baines
@ 2021-03-02 19:20   ` Ludovic Courtès
  2021-03-04 13:16     ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2021-03-02 19:20 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 46725

Hi!

Christopher Baines <mail@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’.




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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-03-02 19:20   ` Ludovic Courtès
@ 2021-03-04 13:16     ` Maxim Cournoyer
  2021-03-08 14:22       ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2021-03-04 13:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 46725, Christopher Baines

Hi Ludovic,

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

> Hi!
>
> Christopher Baines <mail@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




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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-03-04 13:16     ` Maxim Cournoyer
@ 2021-03-08 14:22       ` Ludovic Courtès
  2021-03-08 22:11         ` bug#46725: " Christopher Baines
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2021-03-08 14:22 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 46725, Christopher Baines

Hi,

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

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi!
>>
>> Christopher Baines <mail@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’.




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

* bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-03-08 14:22       ` Ludovic Courtès
@ 2021-03-08 22:11         ` Christopher Baines
  2021-03-11 21:01           ` [bug#46725] " Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Baines @ 2021-03-08 22:11 UTC (permalink / raw)
  To: 46725-done; +Cc: Ludovic Courtès, Maxim Cournoyer

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


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

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hi!
>>>
>>> Christopher Baines <mail@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
  2021-03-08 22:11         ` bug#46725: " Christopher Baines
@ 2021-03-11 21:01           ` Maxim Cournoyer
  0 siblings, 0 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2021-03-11 21:01 UTC (permalink / raw)
  To: Christopher Baines; +Cc: Ludovic Courtès, 46725-done

Hi Chris,

Christopher Baines <mail@cbaines.net> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>> Hi!
>>>>
>>>> Christopher Baines <mail@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




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

end of thread, other threads:[~2021-03-11 21:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-23 20:07 [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation Christopher Baines
2021-02-24  7:58 ` Leo Prikler
2021-02-24  8:45   ` Christopher Baines
2021-02-24  8:37 ` Christopher Baines
2021-03-02 19:20   ` Ludovic Courtès
2021-03-04 13:16     ` Maxim Cournoyer
2021-03-08 14:22       ` Ludovic Courtès
2021-03-08 22:11         ` bug#46725: " Christopher Baines
2021-03-11 21:01           ` [bug#46725] " 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).