[PATCH 0/2] libsmbios: Restrict to only supported systems.

  • Done
  • quality assurance status badge
Details
3 participants
  • Efraim Flashner
  • Mathieu Othacehe
  • Simon South
Owner
unassigned
Submitted by
Simon South
Severity
normal

Debbugs page

Simon South wrote 1 years ago
(address . guix-patches@gnu.org)
cover.1704463873.git.simon@simonsouth.net
Here are a couple patches that fix build failures of libsmbios, a library for
accessing System Management BIOS[0] data, by restricting its package to only
platforms the library supports (Linux on x86 and x86-64).

They also make libsmbios an optional input to fwupd (its only dependent),
allowing fwupd to build successfully on non-Intel/AMD platforms.

I've tested this on AArch64 and x86-64 and everything appears fine. I've been
unable to test cross-building fwupd, though, as this fails with

guix build: error: gnu/packages/gnome.scm:3504:2: librsvg@2.56.4: build
system `cargo' does not support cross builds

By way of justification for these changes: libsmbios is intended for PCs and
expects[1] to find a sys/io.h header file on the host. This is supplied by
glibc only for architectures that support peripheral I/O via ports: x86,
x86-64 and DEC Alpha using Linux; and i386 using the Hurd[2].

Of these Guix does not support Linux on Alpha, while libsmbios does not
support the Hurd at all[3].

--
Simon South
simon@simonsouth.net



[2] "find -type f -name 'io.h'" at the top level of glibc's source tree makes
this apparent.



Simon South (2):
gnu: libsmbios: Restrict to only supported systems.
gnu: fwupd: Depend on libsmbios only on supported systems.

gnu/packages/firmware.scm | 34 +++++++++++++++++++---------------
gnu/packages/hardware.scm | 1 +
2 files changed, 20 insertions(+), 15 deletions(-)


base-commit: ac69b423865f12310cef5662d9c303aa4b90c869
--
2.41.0
Simon South wrote 1 years ago
[PATCH 2/2] gnu: fwupd: Depend on libsmbios only on supported systems.
(address . 68263@debbugs.gnu.org)
45f369ba488116d0845966373c8ef03752dbc624.1704463873.git.simon@simonsouth.net
* gnu/packages/firmware.scm (fwupd)[inputs]: Add libsmbios conditionally.

Change-Id: Id34135b180f5ee6e7abd2fd4eb10e0d3c6308e06
---
gnu/packages/firmware.scm | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 5cebf515bf..c3e6d20987 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -283,21 +283,25 @@ (define-public fwupd
`(,glib "bin")
help2man
gettext-minimal))
- (inputs (list bash-completion
- libgudev
- libxmlb
- sqlite
- polkit
- eudev
- libelf
- tpm2-tss
- cairo
- efivar
- pango
- protobuf-c
- mingw-w64-tools
- libsmbios
- gnu-efi))
+ (inputs (append (list bash-completion
+ libgudev
+ libxmlb
+ sqlite
+ polkit
+ eudev
+ libelf
+ tpm2-tss
+ cairo
+ efivar
+ pango
+ protobuf-c
+ mingw-w64-tools
+ gnu-efi)
+ (if (supported-package? libsmbios
+ (or (%current-target-system)
+ (%current-system)))
+ (list libsmbios)
+ '())))
;; In Requires of fwupd*.pc.
(propagated-inputs (list curl
gcab
--
2.41.0
Simon South wrote 1 years ago
[PATCH 1/2] gnu: libsmbios: Restrict to only supported systems.
(address . 68263@debbugs.gnu.org)
f5de9e8531cd7b7eb9159dc57ac7572149e57e3a.1704463873.git.simon@simonsouth.net
* gnu/packages/hardware.scm (libsmbios)[supported-systems]: New field.

Change-Id: I8d813f496b7d2ffa8b0af2a6c814d1b09d731387
---
gnu/packages/hardware.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 59b95ab7c8..4765d1c55d 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -806,6 +806,7 @@ (define-public libsmbios
also provides extensions for proprietary methods of interfacing with Dell
specific SMBIOS tables.")
(home-page "https://github.com/dell/libsmbios")
+ (supported-systems (list "i686-linux" "x86_64-linux"))
(license
(list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
--
2.41.0
Mathieu Othacehe wrote 1 years ago
Re: [bug#68263] [PATCH 0/2] libsmbios: Restrict to only supported systems.
(name . Simon South)(address . simon@simonsouth.net)
87y1d0rki4.fsf@gnu.org
Hello,

Toggle quote (3 lines)
> guix build: error: gnu/packages/gnome.scm:3504:2: librsvg@2.56.4: build
> system `cargo' does not support cross builds

That is no longer the case, there is however a new error:

Toggle snippet (35 lines)
In guix/packages.scm:
1618:16 19 (package->bag _ _ _ #:graft? _)
1719:48 18 (thunk)
1512:25 17 (inputs _)
In srfi/srfi-1.scm:
586:29 16 (map1 (("coreutils" #<package coreutils@9.1 guix/b…>) …))
586:29 15 (map1 (("grep" #<package grep@3.8 gnu/packages/com…>) …))
586:29 14 (map1 (("xz" #<package xz@5.2.8 gnu/packages/comme…>) …))
586:29 13 (map1 (("locales" #<package glibc-utf8-locales@2.3…>) …))
586:29 12 (map1 (("bash" #<package bash-minimal@5.1.16 gnu/p…>) …))
586:17 11 (map1 (("gcc" #<package gcc@11.3.0 gnu/packages/co…>) …))
In guix/packages.scm:
1469:20 10 (rewrite ("gcc" #<package gcc@11.3.0 gnu/packages/com…>))
In guix/memoization.scm:
101:0 9 (_ #<hash-table 7f049b80cbc0 14/31> #<package gcc@11.3…> …)
In guix/packages.scm:
1483:13 8 (_)
In guix/build-system/gnu.scm:
158:33 7 (cut? _)
In gnu/packages/commencement.scm:
3241:36 6 (arguments #<package gcc@11.3.0 gnu/packages/commenceme…>)
In gnu/packages/gcc.scm:
748:34 5 (arguments #<package gcc@11.3.0 gnu/packages/gcc.scm:73…>)
218:48 4 (arguments #<package gcc@4.8.5 gnu/packages/gcc.scm:398…>)
In gnu/packages/bootstrap.scm:
338:11 3 (_)
In ice-9/boot-9.scm:
1685:16 2 (raise-exception _ #:continuable? _)
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
dynamic linker name not known for this system "aarch64-linux-gnu"

preventing fwupd from cross-compiling.

Mathieu
Efraim Flashner wrote 1 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
ZZsC71955kEjgPK4@3900XT
On Sun, Jan 07, 2024 at 08:50:11PM +0100, Mathieu Othacehe wrote:
Toggle quote (46 lines)
>
> Hello,
>
> > guix build: error: gnu/packages/gnome.scm:3504:2: librsvg@2.56.4: build
> > system `cargo' does not support cross builds
>
> That is no longer the case, there is however a new error:
>
> --8<---------------cut here---------------start------------->8---
> In guix/packages.scm:
> 1618:16 19 (package->bag _ _ _ #:graft? _)
> 1719:48 18 (thunk)
> 1512:25 17 (inputs _)
> In srfi/srfi-1.scm:
> 586:29 16 (map1 (("coreutils" #<package coreutils@9.1 guix/b…>) …))
> 586:29 15 (map1 (("grep" #<package grep@3.8 gnu/packages/com…>) …))
> 586:29 14 (map1 (("xz" #<package xz@5.2.8 gnu/packages/comme…>) …))
> 586:29 13 (map1 (("locales" #<package glibc-utf8-locales@2.3…>) …))
> 586:29 12 (map1 (("bash" #<package bash-minimal@5.1.16 gnu/p…>) …))
> 586:17 11 (map1 (("gcc" #<package gcc@11.3.0 gnu/packages/co…>) …))
> In guix/packages.scm:
> 1469:20 10 (rewrite ("gcc" #<package gcc@11.3.0 gnu/packages/com…>))
> In guix/memoization.scm:
> 101:0 9 (_ #<hash-table 7f049b80cbc0 14/31> #<package gcc@11.3…> …)
> In guix/packages.scm:
> 1483:13 8 (_)
> In guix/build-system/gnu.scm:
> 158:33 7 (cut? _)
> In gnu/packages/commencement.scm:
> 3241:36 6 (arguments #<package gcc@11.3.0 gnu/packages/commenceme…>)
> In gnu/packages/gcc.scm:
> 748:34 5 (arguments #<package gcc@11.3.0 gnu/packages/gcc.scm:73…>)
> 218:48 4 (arguments #<package gcc@4.8.5 gnu/packages/gcc.scm:398…>)
> In gnu/packages/bootstrap.scm:
> 338:11 3 (_)
> In ice-9/boot-9.scm:
> 1685:16 2 (raise-exception _ #:continuable? _)
> 1685:16 1 (raise-exception _ #:continuable? _)
> 1685:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> dynamic linker name not known for this system "aarch64-linux-gnu"
> --8<---------------cut here---------------end--------------->8---
>
> preventing fwupd from cross-compiling.

I'm not seeing that error, I'm getting json-glib failing to
cross-compile. Is it possible you have some stale .go files? (guix
platforms) changed recently.

--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmWbAuwACgkQQarn3Mo9
g1HwfhAAmx/1LwxU21lbLRmQDry0kgtOFAAdf24dfobtRIPmQNMpvMpUFtlkF+BQ
qhEAobTjT+IxKb/phd88JCdWFaFbX0g7dxvD5onD6JWjkFT9RK9LxWlW5rcz2gwh
PGpKIWRc/oLvNQp3Kc7XZ5VxMfcHKzwnlFFG3K1LT5VqJnYLozwnJEOxr0J2kLRP
EPyiY97iWRihoNMFVzPDaH0FBErR3w8bTfHUxsnSwB2nDEs0RnuIfgZMStPDZXPr
zjKUommKzC5umMU9AYupvwMuhEKurRNCHSAqpYH6rNXQtvcs33xeLK2OLewTqnly
s4v8JXUKlmnQd+CE3a1FTouANdsmFCEund+nst2PI9MUihRKJViUktTdOtR/Dc3t
OR9W6qUu369tPdC/WkrvEYePGM3/nSvOkl4brwfm2ABsnVGvYkgPXKovAJdNZ8k4
uJzNodXmn0t46nPhPdohUQcENO5GLS3cdtf9qDBTAPfi80nbtdSi2015r3SF9BwC
rbXJks6SUnxbke6QGqX/TJIFujhWsmMFHA2EPdrFR6rFtEDVKycBZY72pxgq2fVN
C7yQZLgwIsEwXkTAf6fP8qleqcMu81q8fA85GUahiey4srkDXNhvx6EcNF5N+r+D
i4Ed0N8ltQPplTe8LuibIA2yc0LIQKnhqhmLNjV52A5f7Tt3mJs=
=w5Yf
-----END PGP SIGNATURE-----


Mathieu Othacehe wrote 1 years ago
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87jzok87y3.fsf@gnu.org
Hello,

Toggle quote (4 lines)
> I'm not seeing that error, I'm getting json-glib failing to
> cross-compile. Is it possible you have some stale .go files? (guix
> platforms) changed recently.

That was the issue! I have a new error, but this this in gnupg:

Toggle snippet (8 lines)
%exception #<&invoke-error program: "/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" arguments: ("./configure" "CC_FOR_BUILD=gcc" "CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "--prefix=/gnu/store/0ksgybn4n10j0b3wcqfl1jpcjr79xq8l-gnupg-2.2.39" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=aarch64-linux-gnu" "--enable-gnupg-builddir-envvar" "--enable-all-tests") exit-status: 1 term-signal: #f stop-signal: #f>
phase `configure' failed after 9.4 seconds
command "/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "./configure" "CC_FOR_BUILD=gcc" "CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "--prefix=/gnu/store/0ksgybn4n10j0b3wcqfl1jpcjr79xq8l-gnupg-2.2.39" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=aarch64-linux-gnu" "--enable-gnupg-builddir-envvar" "--enable-all-tests" failed with status 1
note: keeping build directory `/tmp/guix-build-gnupg-2.2.39.drv-1'
builder for `/gnu/store/qac9bix1331g6f12dgyrk4wvn2dpgp3k-gnupg-2.2.39.drv' failed with exit code 1
build of /gnu/store/qac9bix1331g6f12dgyrk4wvn2dpgp3k-gnupg-2.2.39.drv failed

I fixed it with the attached patch. Now libsmbios itself fails to
cross-compile:

Toggle snippet (6 lines)
src/libsmbios_c/cmos/cmos_linux.c:25:10: fatal error: sys/io.h: No such file or directory
25 | #include <sys/io.h>
| ^~~~~~~~~~
compilation terminated.

Thanks,

Mathieu
From c9424c606e0cfcdb9bf10447bb655ab65a3a2056 Mon Sep 17 00:00:00 2001
Message-ID: <c9424c606e0cfcdb9bf10447bb655ab65a3a2056.1704707713.git.othacehe@gnu.org>
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Mon, 8 Jan 2024 10:54:27 +0100
Subject: [PATCH] gnu: gnupg: Fix cross-compilation.

* gnu/packages/gnupg.scm (gnupg)[arguments]: Pass libraries prefixes when
cross-crompiling.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Change-Id: I461ba02ddf5bb23277bd6685c2106e4ad37e2184
---
gnu/packages/gnupg.scm | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index a6ba57d7f3..f1e171036b 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -345,11 +345,30 @@ (define-public gnupg
zlib))
(arguments
(list
- #:configure-flags #~'(;; Otherwise, the test suite looks for the `gpg`
- ;; executable in its installation directory in
- ;; /gnu/store before it has been installed.
- "--enable-gnupg-builddir-envvar"
- "--enable-all-tests")
+ #:configure-flags
+ #~'(#$@(if (%current-target-system)
+ #~(list
+ (string-append
+ "--with-libgpg-error-prefix="
+ #$(this-package-input "libgpg-error"))
+ (string-append
+ "--with-libgcrypt-prefix="
+ #$(this-package-input "libgcrypt"))
+ (string-append
+ "--with-libassuan-prefix="
+ #$(this-package-input "libassuan"))
+ (string-append
+ "--with-ksba-prefix="
+ #$(this-package-input "libksba"))
+ (string-append
+ "--with-npth-prefix="
+ #$(this-package-input "npth")))
+ '())
+ ;; Otherwise, the test suite looks for the `gpg`
+ ;; executable in its installation directory in
+ ;; /gnu/store before it has been installed.
+ "--enable-gnupg-builddir-envvar"
+ "--enable-all-tests")
#:phases
#~(modify-phases %standard-phases
(add-before 'configure 'patch-paths

base-commit: 728d471d73c3731b86cbf5f3dee22229d3a92d4b
--
2.41.0
Simon South wrote 1 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
87cyub7llv.fsf@simonsouth.net
Mathieu Othacehe <othacehe@gnu.org> writes:
Toggle quote (6 lines)
>> I'm not seeing that error, I'm getting json-glib failing to
>> cross-compile. Is it possible you have some stale .go files? (guix
>> platforms) changed recently.
>
> That was the issue!

How exactly did you get past this? I have the same issue myself now,
even after running "make distclean" and "git clean -fxd" and rebuilding:

[env]$ ./pre-inst-env guix build --dry-run --target=x86_64-linux-gnu --verbosity=2 fwupd
Backtrace:
In guix/packages.scm:
1618:16 19 (package->bag _ _ _ #:graft? _)
1719:48 18 (thunk)
1512:25 17 (inputs _)
In srfi/srfi-1.scm:
586:29 16 (map1 (("coreutils" #<package coreutils@9.1 guix/b?>) ?))
586:29 15 (map1 (("grep" #<package grep@3.8 gnu/packages/com?>) ?))
586:29 14 (map1 (("xz" #<package xz@5.2.8 gnu/packages/comme?>) ?))
586:29 13 (map1 (("locales" #<package glibc-utf8-locales@2.3?>) ?))
586:29 12 (map1 (("bash" #<package bash-minimal@5.1.16 gnu/p?>) ?))
586:17 11 (map1 (("gcc" #<package gcc@11.3.0 gnu/packages/co?>) ?))
In guix/packages.scm:
1469:20 10 (rewrite ("gcc" #<package gcc@11.3.0 gnu/packages/com?>))
In guix/memoization.scm:
101:0 9 (_ #<hash-table ffffa8b4ba80 14/31> #<package gcc@11.3?> ?)
In guix/packages.scm:
1483:13 8 (_)
In guix/build-system/gnu.scm:
158:33 7 (cut? _)
In gnu/packages/commencement.scm:
3241:36 6 (arguments #<package gcc@11.3.0 gnu/packages/commenceme?>)
In gnu/packages/gcc.scm:
748:34 5 (arguments #<package gcc@11.3.0 gnu/packages/gcc.scm:73?>)
218:48 4 (arguments #<package gcc@4.8.5 gnu/packages/gcc.scm:398?>)
In gnu/packages/bootstrap.scm:
338:11 3 (_)
In ice-9/boot-9.scm:
1685:16 2 (raise-exception _ #:continuable? _)
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
dynamic linker name not known for this system "x86_64-linux-gnu"

--
Simon South
simon@simonsouth.net
Efraim Flashner wrote 1 years ago
(name . Simon South)(address . simon@simonsouth.net)
ZZw6VRerye8UDphw@3900XT
On Mon, Jan 08, 2024 at 12:58:52PM -0500, Simon South wrote:
Toggle quote (46 lines)
> Mathieu Othacehe <othacehe@gnu.org> writes:
> >> I'm not seeing that error, I'm getting json-glib failing to
> >> cross-compile. Is it possible you have some stale .go files? (guix
> >> platforms) changed recently.
> >
> > That was the issue!
>
> How exactly did you get past this? I have the same issue myself now,
> even after running "make distclean" and "git clean -fxd" and rebuilding:
>
> [env]$ ./pre-inst-env guix build --dry-run --target=x86_64-linux-gnu --verbosity=2 fwupd
> Backtrace:
> In guix/packages.scm:
> 1618:16 19 (package->bag _ _ _ #:graft? _)
> 1719:48 18 (thunk)
> 1512:25 17 (inputs _)
> In srfi/srfi-1.scm:
> 586:29 16 (map1 (("coreutils" #<package coreutils@9.1 guix/b?>) ?))
> 586:29 15 (map1 (("grep" #<package grep@3.8 gnu/packages/com?>) ?))
> 586:29 14 (map1 (("xz" #<package xz@5.2.8 gnu/packages/comme?>) ?))
> 586:29 13 (map1 (("locales" #<package glibc-utf8-locales@2.3?>) ?))
> 586:29 12 (map1 (("bash" #<package bash-minimal@5.1.16 gnu/p?>) ?))
> 586:17 11 (map1 (("gcc" #<package gcc@11.3.0 gnu/packages/co?>) ?))
> In guix/packages.scm:
> 1469:20 10 (rewrite ("gcc" #<package gcc@11.3.0 gnu/packages/com?>))
> In guix/memoization.scm:
> 101:0 9 (_ #<hash-table ffffa8b4ba80 14/31> #<package gcc@11.3?> ?)
> In guix/packages.scm:
> 1483:13 8 (_)
> In guix/build-system/gnu.scm:
> 158:33 7 (cut? _)
> In gnu/packages/commencement.scm:
> 3241:36 6 (arguments #<package gcc@11.3.0 gnu/packages/commenceme?>)
> In gnu/packages/gcc.scm:
> 748:34 5 (arguments #<package gcc@11.3.0 gnu/packages/gcc.scm:73?>)
> 218:48 4 (arguments #<package gcc@4.8.5 gnu/packages/gcc.scm:398?>)
> In gnu/packages/bootstrap.scm:
> 338:11 3 (_)
> In ice-9/boot-9.scm:
> 1685:16 2 (raise-exception _ #:continuable? _)
> 1685:16 1 (raise-exception _ #:continuable? _)
> 1685:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> dynamic linker name not known for this system "x86_64-linux-gnu"

Taking what you've written exactly for the moment, did you rerun
bootstrap and configure and make first? the pre-inst-env script needs to
get regenerated after cleaning the repo.

I always do my building with --no-grafts. Also, are you building
x86_64-linux -> x86_64-linux-gnu? I often get weird errors when I try to
do things like that.

--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmWcOlIACgkQQarn3Mo9
g1F7sA/+NSLL4BCGRGKlBLp4vMkORStFKs7lKAxTxeGXOU37U0fSe4S0d6V8YuB9
gBoZA/n9rvUlV4G0whPsaFRNdl6VD/3rVoQvmMAtlYbVSQzRYn6d7FmE75hf+cyk
NLfq5xnnAn8oa7cA2v3Li8Js8F5X/nPaecEa+0EsaPw2q+lJHWJGAcLW8qIbXojw
vMfsuh5K06cOswuvjm1tobdovLMwcdAyf2hH7nS2wr+mtzeQGE0tW571YDh4K/fs
8D0uYU3RuE10/RbdvahATz7HKzqZCaqz8ICh7bTbK72dQDIc2ELzZu/oxrFLQVKi
GE9OLVRwKksKk1PUG6B7ugLBhx5kj1wgCJa/2SaikU1tIR583c1J0TmtmDhEGSSs
owUz0ToVphKEETEVI+RAzEh/95KPFecTuWi7Q2rru8ZQ84y6cyqb8pt2o5wk7uRF
I3Km12QRkn9t0eVUu6uIMAA4nFwZkpaosqPHop9sT6devlVDdlEnetpiVSlADR0A
+TsUZ+cxhCucGjUiaZB7+F5lSRgP3j9FdO44CXc0xYImUcXxecUUEBF0I4ThKsY6
fxpf0dWIb2ClbGIb/bV4SFyQ6XMaluaX8WNIP7d+17sY9SSSLzVBdxUBOzZpgnJR
JvP69r2X35Kdyfcva6Jhmq5Y6wdcGFIB8EA1OKjyNCSChKxZrc4=
=Uh2/
-----END PGP SIGNATURE-----


Simon South wrote 1 years ago
(name . Efraim Flashner)(address . efraim@flashner.co.il)
871qar7k7n.fsf@simonsouth.net
Efraim Flashner <efraim@flashner.co.il> writes:
Toggle quote (3 lines)
> Taking what you've written exactly for the moment, did you rerun
> bootstrap and configure and make first?

I did, yes:

./bootstrap && ./configure --localstatedir=/var --sysconfdir=/etc && make -j6

after cleaning out the source tree.

I get the same result also whether I run "./pre-inst-env guix build
--target=..." outside of a "guix shell --pure --development guix"
environment, inside of one using the system instance of Guix, or inside
of one invoked from the built source tree (i.e. "./pre-inst-env guix
shell...") before rebuilding with "./bootstrap..." again.

I'm really at a loss. What else could cause this error? I seem to
recall this working a short while ago so I may try bisecting the source
tree if nothing else comes to mind.

Toggle quote (2 lines)
> Also, are you building x86_64-linux -> x86_64-linux-gnu?

No, I'm on AArch64, but trying to cross-build from my x86-64 machine to
aarch64-linux-gnu produces the same (well, equivalent) error, even after
the same steps above.

--
Simon South
simon@simonsouth.net
Mathieu Othacehe wrote 1 years ago
(name . Simon South)(address . simon@simonsouth.net)
875y038twa.fsf@gnu.org
Hello,

So, here is what happens:

You are adding
Toggle snippet (3 lines)
(supported-systems (list "i686-linux" "x86_64-linux"))

to libsmbios. That is fine, it prints:

Toggle snippet (3 lines)
package libsmbios@2.4.3 does not support aarch64-linux

when running `guix build -s aarch64-linux libsmbios`. It doesn't print
anything when cross-compiling this way: `guix build
--target=aarch64-linux-gnu libsmbios`, tries to cross-compile and fails
because of the <sys/io.h> header as you noticed.

It makes me think that we should turn `supported-systems` into
`supported-platforms` so that we get the same kind of warning when
trying to cross-compile. But that's another topic.

Now regarding your second patch, this part:

Toggle snippet (5 lines)
(if (supported-package? libsmbios
(or (%current-target-system)
(%current-system)))

will actually call (supported-package? libsmbios "aarch64-linux-gnu")
when cross-compiling, which prints this error message:

Toggle snippet (4 lines)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
dynamic linker name not known for this system "aarch64-linux-gnu"

It has nothing to do with ABI break and .go files. It is just that
supported-package? is expecting a system not a target.

What you could do is rewriting this part as:

Toggle snippet (7 lines)
(if (supported-package? libsmbios
(if (%current-target-system)
(platform-target->system
(%current-target-system))
(%current-system)))

which works as expected because the target is translated into a
system. A better fix would be to have supported-package? deal with
both systems and targets internally.

Then fwupd cross-compilation fails because other dependencies such as
gts fail to cross-compile, but that irrelevant here.

Thanks,

Mathieu
Simon South wrote 1 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
87h6jnzieu.fsf@simonsouth.net
Mathieu Othacehe <othacehe@gnu.org> writes:
Toggle quote (3 lines)
> It has nothing to do with ABI break and .go files. It is just that
> supported-package? is expecting a system not a target.

Ah, that makes perfect sense. Thank you for the explanation. It never
occurred to me (%current-system) and (%current-target-system) would be
returning different types.

I'll submit an updated patchset shortly.

--
Simon South
simon@simonsouth.net
Simon South wrote 1 years ago
[PATCH v2 2/2] gnu: fwupd: Depend on libsmbios only on supported systems.
(address . 68263@debbugs.gnu.org)
2ee10a7ee9f4a6b2eea6cfa85e1d613538b33c8e.1704906299.git.simon@simonsouth.net
* gnu/packages/firmware.scm (fwupd)[inputs]: Add libsmbios conditionally.

Change-Id: Id34135b180f5ee6e7abd2fd4eb10e0d3c6308e06
---
gnu/packages/firmware.scm | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)

Toggle diff (57 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index e691bf33da..75294fadf4 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -31,6 +31,7 @@ (define-module (gnu packages firmware)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix memoization)
#:use-module (guix packages)
+ #:use-module (guix platform)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix utils)
@@ -283,21 +284,27 @@ (define-public fwupd
`(,glib "bin")
help2man
gettext-minimal))
- (inputs (list bash-completion
- libgudev
- libxmlb
- sqlite
- polkit
- eudev
- libelf
- tpm2-tss
- cairo
- efivar
- pango
- protobuf-c
- mingw-w64-tools
- libsmbios
- gnu-efi))
+ (inputs (append
+ (list bash-completion
+ libgudev
+ libxmlb
+ sqlite
+ polkit
+ eudev
+ libelf
+ tpm2-tss
+ cairo
+ efivar
+ pango
+ protobuf-c
+ mingw-w64-tools
+ gnu-efi)
+ (if (supported-package? libsmbios
+ (or (and=> (%current-target-system)
+ platform-target->system)
+ (%current-system)))
+ (list libsmbios)
+ '())))
;; In Requires of fwupd*.pc.
(propagated-inputs (list curl
gcab
--
2.41.0
Simon South wrote 1 years ago
[PATCH v2 1/2] gnu: libsmbios: Restrict to only supported systems.
(address . 68263@debbugs.gnu.org)
f960d145f0d03f7e2a7817779754a6758fc1d9e8.1704906299.git.simon@simonsouth.net
* gnu/packages/hardware.scm (libsmbios)[supported-systems]: New field.

Change-Id: I8d813f496b7d2ffa8b0af2a6c814d1b09d731387
---
gnu/packages/hardware.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 59b95ab7c8..4765d1c55d 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -806,6 +806,7 @@ (define-public libsmbios
also provides extensions for proprietary methods of interfacing with Dell
specific SMBIOS tables.")
(home-page "https://github.com/dell/libsmbios")
+ (supported-systems (list "i686-linux" "x86_64-linux"))
(license
(list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
--
2.41.0
Simon South wrote 1 years ago
[PATCH v2 0/2] libsmbios: Restrict to only supported systems.
(address . 68263@debbugs.gnu.org)
cover.1704906299.git.simon@simonsouth.net
Here's a revised version of this patchset, incorporating Mathieu Othacehe's
advice regarding the use of %current-target-system with supported-package?
(but using and=> for compactness and efficiency).

I've tested cross-building fwupd from AArch64 to x86-64 and vice-versa and
things now work as expected, apart from the nspr package failing to build due
to what appears to be a limitation of its own build script.

The original cover letter follows.

--------------------

Here are a couple patches that fix build failures of libsmbios, a library for
accessing System Management BIOS[0] data, by restricting its package to only
platforms the library supports (Linux on x86 and x86-64).

They also make libsmbios an optional input to fwupd (its only dependent),
allowing fwupd to build successfully on non-Intel/AMD platforms.

I've tested this on AArch64 and x86-64 and everything appears fine. I've been
unable to test cross-building fwupd, though, as this fails with

guix build: error: gnu/packages/gnome.scm:3504:2: librsvg@2.56.4: build
system `cargo' does not support cross builds

By way of justification for these changes: libsmbios is intended for PCs and
expects[1] to find a sys/io.h header file on the host. This is supplied by
glibc only for architectures that support peripheral I/O via ports: x86,
x86-64 and DEC Alpha using Linux; and i386 using the Hurd[2].

Of these Guix does not support Linux on Alpha, while libsmbios does not
support the Hurd at all[3].

--
Simon South
simon@simonsouth.net



[2] "find -type f -name 'io.h'" at the top level of glibc's source tree makes
this apparent.



Simon South (2):
gnu: libsmbios: Restrict to only supported systems.
gnu: fwupd: Depend on libsmbios only on supported systems.

gnu/packages/firmware.scm | 37 ++++++++++++++++++++++---------------
gnu/packages/hardware.scm | 1 +
2 files changed, 23 insertions(+), 15 deletions(-)


base-commit: 5c0f77f4241c9beac0c82deae946bfdc70b49ff0
--
2.41.0
Mathieu Othacehe wrote 1 years ago
(name . Simon South)(address . simon@simonsouth.net)
87ply6r12s.fsf@gnu.org
Hello,

Toggle quote (8 lines)
> Here's a revised version of this patchset, incorporating Mathieu Othacehe's
> advice regarding the use of %current-target-system with supported-package?
> (but using and=> for compactness and efficiency).
>
> I've tested cross-building fwupd from AArch64 to x86-64 and vice-versa and
> things now work as expected, apart from the nspr package failing to build due
> to what appears to be a limitation of its own build script.

Thanks for the v2. Applied!

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 68263@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68263
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help