diff mbox series

[bug#51198] gnu: Add b2sum.

Message ID YYLHs6Wx6EuaQuBR@jasmine.lan
State Accepted
Headers show
Series [bug#51198] gnu: Add b2sum. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Leo Famulari Nov. 3, 2021, 5:32 p.m. UTC
On Wed, Oct 27, 2021 at 05:56:31PM +0200, Ludovic Courtès wrote:
> It’s okay but not entirely sufficient: on a cluster setup, you typically
> talk to a daemon that’s on another machine, so the CPU features it’ll
> detect there may be different from those you’ll use.  Likewise, as
> discussed on IRC, you’d also need #:local-build? #t.

It seems that #:local-build? is not available in gnu-build-system. Is
that correct?

Using the attached patch, building fails with "Unrecognized keyword:
#:local-build?".

Is there a way to turn it on for packages using gnu-build-system?
From 77a063e797849332b784decab32f29be3d13f031 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Wed, 27 Oct 2021 11:29:40 -0400
Subject: [PATCH] gnu: b2sum: Build on the local machine.

* gnu/packages/crypto.scm (b2sum)[arguments]: Set '#:substitutable? #f' and
'#:local-build? #t'.
---
 gnu/packages/crypto.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès Nov. 6, 2021, 4:45 p.m. UTC | #1
Hi,

Leo Famulari <leo@famulari.name> skribis:

> On Wed, Oct 27, 2021 at 05:56:31PM +0200, Ludovic Courtès wrote:
>> It’s okay but not entirely sufficient: on a cluster setup, you typically
>> talk to a daemon that’s on another machine, so the CPU features it’ll
>> detect there may be different from those you’ll use.  Likewise, as
>> discussed on IRC, you’d also need #:local-build? #t.
>
> It seems that #:local-build? is not available in gnu-build-system. Is
> that correct?

Oh right, it’s missing from (guix build-system gnu).  We could easily
add it.

Though again, it would remain an approximation of what we really want.

HTH!

Ludo’.
Leo Famulari Nov. 27, 2021, 11:36 p.m. UTC | #2
On Sat, Nov 06, 2021 at 05:45:01PM +0100, Ludovic Courtès wrote:
> Leo Famulari <leo@famulari.name> skribis:
> > It seems that #:local-build? is not available in gnu-build-system. Is
> > that correct?
> 
> Oh right, it’s missing from (guix build-system gnu).  We could easily
> add it.

I've sent patches to make this change. I checked that the derivation of
'hello' is unchanged when building without cross-compilation.

https://issues.guix.gnu.org/51198#12
diff mbox series

Patch

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index f48fc23c1f..7ef8504eb7 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -858,9 +858,19 @@  (define-public b2sum
                  (base32 "04z631v0vzl52g73v390ask5fnzi5wg83lcjkjhpmmymaz0jn152"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
-                            (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       `(;; By default, b2sum uses the compiler to generate instructions
+         ;; tailored to the CPU of the running machine, using "-march=native".
+         ;; This gives a ~1.5x speedup on a Core i5-6300U with a large dataset
+         ;; paged in, whereas compilation of b2sum takes ~1.5 seconds.
+         ;; b2sum does not support run-time feature detection:
+         ;; https://github.com/BLAKE2/BLAKE2/issues/1
+         ;; For more information, see the discussion beginning here:
+         ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51198#13
+         #:substitutable? #f
+         #:local-build? #t
          #:tests? #f ; No test suite
+         #:make-flags (list (string-append "CC=" ,(cc-for-target))
+                            (string-append "PREFIX=" (assoc-ref %outputs "out")))
          #:phases
          (modify-phases %standard-phases
            (add-before 'build 'change-directory