MMaxime Devos wrote on 17 Mar 2021 22:58
(name . Ludovic Courtès)(address . email@example.com)(address . firstname.lastname@example.org)
(In response to bug#47027, but opened as a new bug.)
On Wed, 2021-03-17 at 21:52 +0100, Ludovic Courtès wrote:
Toggle quote (9 lines)
> Maxime Devos <email@example.com> skribis:
> > Shouldn't the "guile" input be included in the native-inputs
> > as well (perhaps only native-inputs suffices), for cross-compilation?
> Yes it should, good point.
FWIW, I tried to write a linter to catch these kind of issues.
(If there's a "guile" input, then there usually should also be
a "guile" native-input.) Currently, it has too many false positives
for my taste. I most likely won't be working on it in the near future
though. (Preliminary patch attached)
Toggle quote (2 lines)
> ./pre-int-env guix lint -t "check-inputs-should-also-be-native"
Some suspicious things:
* guile-config & others are missing a "guile" in the native-inputs
* clipmenu & others use "wrap-script" to define wrapper scripts
(in this case "guile" does not have to be in native-inputs).
The "wrap-script" procedure from (guix build utils) uses the
"which" procedure to determine where guile is located ...
but this is incorrect when cross-compiling!
(It is possible to override the "guile" binary used with a
(I assume inputs in "inputs" do not contribute to the $PATH
in a cross-compilation environment; only "native-inputs" should
contribute to $PATH)
idk if it is feasible or if there are complications, but
IMHO the inputs in "inputs" shouldn't contribute to $PATH
at all (not even when not cross-compilation), only inputs
There seems to be plenty of low-hanging cross-compilation fruit here!
From c4798e6154275a2de41c1d5a35bc723091d4e1a4 Mon Sep 17 00:00:00 2001
From: Maxime Devos <firstname.lastname@example.org>
Date: Wed, 17 Mar 2021 22:56:26 +0100
Subject: [PATCH] lint: Check whether guile should be in native-inputs.
TODO less false positives (or negatives?)
TODO proper message
(%local-checkers)[inputs-should-also-be-native]: New ???.
guix/lint.scm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
Toggle diff (70 lines)
diff --git a/guix/lint.scm b/guix/lint.scm
index 311bc94cc3..d0cde23665 100644
@@ -11,6 +11,7 @@
;;; Copyright © 2018, 2019 Arun Isaac <email@example.com>
;;; Copyright © 2020 Chris Marusich <firstname.lastname@example.org>
;;; Copyright © 2020 Timothy Sample <email@example.com>
+;;; Copyright © 2021 Maxime Devos <firstname.lastname@example.org>
;;; This file is part of GNU Guix.
@@ -75,6 +76,7 @@
#:use-module (ice-9 rdelim)
@@ -347,6 +349,36 @@ of a package, and INPUT-NAMES, a list of package specifications such as
(package-input-intersection inputs input-names))))
+(define (suspect-input->native-names package)
+ ;; Guile's compiled .go code is architecture
+ `(,@(if (string-prefix? "guile" (package-name package))
+(define (check-inputs-should-also-be-native package)
+ ;; Emit a warning if some inputs of PACKAGE are likely to belong to its
+ ;; native inputs as well.
+ (guard (c ((package-cross-build-system-error? c) '()))
+ (let ((inputs (package-inputs package))
+ ;; Pretend we're cross-compiling,
+ ;; as some packages only add the "guile" input
+ ;; to native-inputs when %current-target-system is not #f.
+ (parameterize ((%current-target-system (%current-system)))
+ (package-native-inputs package)))
+ (filter-map (lambda (input)
+ (and (not (assoc input native-inputs))
+ (G_ "'~a' should probably also be a native input")
+ (list input)
+ #:field 'inputs)))
+ (package-input-intersection inputs input-names)))))
(define (check-inputs-should-not-be-an-input-at-all package)
;; Emit a warning if some inputs of PACKAGE are likely to should not be
;; an input at all.
@@ -1449,6 +1481,10 @@ them for PACKAGE."
(description "Validate package descriptions")
+ (name 'inputs-should-also-be-native)
+ (description "Identify inputs that should aso be native inputs")
+ (check check-inputs-should-also-be-native))
(description "Identify inputs that should be native inputs")