diff mbox series

[bug#56872,v2] gnu: mu: Update to 1.8.7.

Message ID 87o7x2mplu.fsf@muradm.net
State Accepted
Headers show
Series [bug#56872,v2] gnu: mu: Update to 1.8.7. | expand

Commit Message

muradm Aug. 2, 2022, 7:03 p.m. UTC
Hi,

This patch worked for me in my host.
I don't have any environment to see if working when
actually cross-compiling.

For the comment on coreutils, yeah missed update when removed.
Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
>
> On 01-08-2022 15:41, muradm wrote:
>> +             (substitute* '("lib/utils/mu-utils.cc"
>> +                            "lib/tests/bench-indexer.cc")
>> +               (("/bin/rm") (which "rm")))))
>
> The lib/utils/mu-utils.cc + 'which' looks wrong when 
> cross-compiling
> -- try using search-input-file on 'inputs' instead (which looks 
> in
> native-inputs (which happens to be merged with inputs when 
> compiling
> natively))).
>
> (If it does not end up in the binary, then 'which' should be 
> fine)
>
>> [inputs]: Removed guile added coreutils (for /bin/rm command).
> I'm not seeing coreutils in there.
>
> Greetings,
> Maxime
>
> [2. OpenPGP public key --- application/pgp-keys; 
> OpenPGP_0x49E3EE22191725EE.asc]...
>
> [[End of PGP Signed Part]]

Comments

\( Aug. 2, 2022, 7:14 p.m. UTC | #1
On Tue Aug 2, 2022 at 8:03 PM BST, muradm wrote:
> I don't have any environment to see if working when
> actually cross-compiling.
You can cross-compile to any architecture you want if you add
`qemu-binfmt-service-type` to your system config and specify
the architectures you want. Then you just need to do something
like:

ʃ guix build --system=aarch64-linux mu
ʃ guix build --system=riscv64-linux mu

Also, on x86-64, you can cross-compile to x86-32 without any
emulation:

ʃ guix build --system=i686-linux mu

    -- (
muradm Aug. 2, 2022, 7:27 p.m. UTC | #2
Thanks, I know.
My laptop won't survive, to be correct.
That what I ment :)

"(" <paren@disroot.org> writes:

> On Tue Aug 2, 2022 at 8:03 PM BST, muradm wrote:
>> I don't have any environment to see if working when
>> actually cross-compiling.
> You can cross-compile to any architecture you want if you add
> `qemu-binfmt-service-type` to your system config and specify
> the architectures you want. Then you just need to do something
> like:
>
> ʃ guix build --system=aarch64-linux mu
> ʃ guix build --system=riscv64-linux mu
>
> Also, on x86-64, you can cross-compile to x86-32 without any
> emulation:
>
> ʃ guix build --system=i686-linux mu
>
>     -- (
M Aug. 2, 2022, 7:53 p.m. UTC | #3
On 02-08-2022 21:14, ( wrote:
> On Tue Aug 2, 2022 at 8:03 PM BST, muradm wrote:
>> I don't have any environment to see if working when
>> actually cross-compiling.
> You can cross-compile to any architecture you want if you add
> `qemu-binfmt-service-type` to your system config and specify
> the architectures you want. Then you just need to do something
> like:
>
> ʃ guix build --system=aarch64-linux mu
> ʃ guix build --system=riscv64-linux mu
>
> Also, on x86-64, you can cross-compile to x86-32 without any
> emulation:
>
> ʃ guix build --system=i686-linux mu
>
>      -- (

This is 'QEMU transparent emulation' -- from Guix' perspective, this is 
not cross-compilation (see: transparent), but rather it is as-if you 
were compiling natively on a aarch64 or riscv64 instead of 
cross-compiling from a <insert your CPU type> to aarch64 or riscv64.

Instead, try:

$ guix build --target=aarch64-linux-gnu mu
$ guix build --target=aarch64-linux-gnu mu

, which exercises Guix' cross-compilation codepaths.

--system: system to run the compilation process on (possibly emulated)

--target: system to cross-compile _to_/system on which the _result_ of 
compilation will be run.

Also, you don't need a aarch64 or riscv64 to check the references (try 
"guix graph --type=references $(./pre-inst-env guix build mu 
--target=..." or "guix gc --references $(./pre-inst-env guix build mu 
--target=...)") and check that the 'mu' doesn't point to coreutils).

Greetings,
Maxime.
M Aug. 2, 2022, 7:59 p.m. UTC | #4
On 02-08-2022 21:27, muradm wrote:
>
> Thanks, I know.
> My laptop won't survive, to be correct.
> That what I ment :)

The build farm has substitutes for the cross-compiler and the 
cross-compiled glib (at least if you are cross-compiling from 
x86_64-linux), so except for downloading some additional substitutes, 
cross-compiling mu should not take much longer than compiling natively 
(assuming the substitute server is authorised).

In fact, for me it finished after a few seconds because of dependency 
pth fails to cross-compile:

> checking size of short... grep: /usr/include/features.h: No such file 
> or directory
> [...]
>
> ./libtool --mode=compile --quiet aarch64-linux-gnu-gcc -c -I. -O2 
> -pipe pth_mctx.c
> pth_mctx.c: In function '__pth_mctx_set':
> pth_mctx.c:480:2: error: #error "Unsupported Linux (g)libc version 
> and/or platform"
>   480 | #error "Unsupported Linux (g)libc version and/or platform"
>       |  ^~~~~
> make: *** [Makefile:155: pth_mctx.lo] Error 1
> error: in phase 'build': uncaught exception:
>
Greetings,
Maxime.
muradm Aug. 2, 2022, 8:13 p.m. UTC | #5
From below error I see that it is pth package failing to build.
Most likely there are others that are not getting built.
Does it mean that it was never built before mu-1.8.7?
Does it mean that we sould restrict mu-1.8.7 by platform?

Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
>
> On 02-08-2022 21:27, muradm wrote:
>>
>> Thanks, I know.
>> My laptop won't survive, to be correct.
>> That what I ment :)
>
> The build farm has substitutes for the cross-compiler and the
> cross-compiled glib (at least if you are cross-compiling from
> x86_64-linux), so except for downloading some additional 
> substitutes,
> cross-compiling mu should not take much longer than compiling 
> natively
> (assuming the substitute server is authorised).
>
> In fact, for me it finished after a few seconds because of 
> dependency
> pth fails to cross-compile:
>
>> checking size of short... grep: /usr/include/features.h: No 
>> such
>> file or directory
>> [...]
>>
>> ./libtool --mode=compile --quiet aarch64-linux-gnu-gcc -c -I. 
>> -O2
>> -pipe pth_mctx.c
>> pth_mctx.c: In function '__pth_mctx_set':
>> pth_mctx.c:480:2: error: #error "Unsupported Linux (g)libc 
>> version
>> and/or platform"
>>   480 | #error "Unsupported Linux (g)libc version and/or 
>> platform"
>>       |  ^~~~~
>> make: *** [Makefile:155: pth_mctx.lo] Error 1
>> error: in phase 'build': uncaught exception:
>>
> Greetings,
> Maxime.
>
> [2. OpenPGP public key --- application/pgp-keys; 
> OpenPGP_0x49E3EE22191725EE.asc]...
>
> [[End of PGP Signed Part]]
M Aug. 2, 2022, 8:19 p.m. UTC | #6
On 02-08-2022 22:13, muradm wrote:
> From below error I see that it is pth package failing to build.
> Most likely there are others that are not getting built.
> Does it mean that it was never built before mu-1.8.7?
> Does it mean that we sould restrict mu-1.8.7 by platform?
>
It fails to cross-compile to aarch64-linux (--target), but it compiles 
fine natively (--system without --target), so I don't think adjusting 
'supported-systems' is necessary.  Rather, it seems to me that pth' 
configure script should eventually be tweaked to support 
aarch64-linux-gnu not only when compiling natively, but also when 
cross-compiling.

Greetings,
Maxime.
diff mbox series

Patch

From b688acbb5b9d6d65606edf2164cad09c9cf06225 Mon Sep 17 00:00:00 2001
From: muradm <mail@muradm.net>
Date: Tue, 2 Aug 2022 21:57:57 +0300
Subject: [PATCH] gnu: mu: Fix cross-compiling.
To: Maxime Devos <maximedevos@telenet.be>,
    56872@debbugs.gnu.org

* gnu/packages/mail.scm (mu)[arguments]: Use search-input-file
to find /bin/sh and /bin/rm from inputs.
---
 gnu/packages/mail.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index ca4b3e819e..3776157c0b 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1189,15 +1189,15 @@  (define-public mu
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-bin-references
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
              (substitute* '("guile/tests/test-mu-guile.cc"
                             "mu/tests/test-mu-cmd.cc"
                             "mu/tests/test-mu-cmd-cfind.cc"
                             "mu/tests/test-mu-query.cc")
-               (("/bin/sh") (which "sh")))
+               (("/bin/sh") (search-input-file inputs "/bin/sh")))
              (substitute* '("lib/tests/bench-indexer.cc"
                             "lib/utils/mu-utils.cc")
-               (("/bin/rm") (which "rm")))))
+               (("/bin/rm") (search-input-file inputs "/bin/rm")))))
          (add-after 'install 'install-emacs-autoloads
            (lambda* (#:key outputs #:allow-other-keys)
              (emacs-generate-autoloads
-- 
2.37.1