unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 46725-done@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Maxim Cournoyer" <maxim.cournoyer@gmail.com>
Subject: bug#46725: [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Mon, 08 Mar 2021 22:11:02 +0000	[thread overview]
Message-ID: <87k0qhb8jt.fsf@cbaines.net> (raw)
In-Reply-To: <874khld8to.fsf@gnu.org>

[-- 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 --]

  reply	other threads:[~2021-03-08 22:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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         ` Christopher Baines [this message]
2021-03-11 21:01           ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0qhb8jt.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=46725-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).