guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Maxim Cournoyer
Subject: [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Thu, 04 Mar 2021 08:16:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]