Subject: Install guix system on Raspberry Pi

From: phodina <[email-masked]>
Date: Wed, 17 Nov 2021 14:00:20 +0000

Hi Stefan,

I've attempted to cross compile the system on x86_64 machine and I must report here are still several issue.

- Firstly it has to be attempted off the branch core-updates as there is the latest packaged meson build system which allows cross compilation.

guix system: error: gnu/packages/glib.scm:172:2: [email-masked]: build system `meson' does not support cross builds

Note that a minor issue happens when applying your patches on top of core-updates is patch-04 failing due to collision in the header with your email address.
- Secondly there are some packages that need to be patched. See the attached file.

- Thirdly there is some issue in the optional test cases in the package lsof which fail if executed on btrfs (unfortunately that's my case so I disabled them, just the optional part).

If I apply all the changes I can build the system.

- However, that brings me to the last issue. There is a package efivar which does not build. The issue there is described here [1].

Then again I haven't actually ran the system on Raspberry Pi itself. I'll attempt to setup Debian and build it natively as you suggested.

Kind regards
Petr

PS: Sorry Stefan for the late answer

[1]: https://github.com/rhboot/efivar/issues/186

From 48ccde0b13a471040eccd87e409ae0cfe29fbc79 Mon Sep 17 00:00:00 2001
From: Petr Hodina <[email-masked]>
Date: Tue, 16 Nov 2021 14:16:16 +0100
Subject: [PATCH] Fixes to cross compile system for aarch64.

diff --git a/gnu/packages/certs.scm b/gnu/packages/certs.scm
index 39c3ebd128..311d5d4974 100644
--- a/gnu/packages/certs.scm
+++ b/gnu/packages/certs.scm
@@ -158,7 +158,7 @@ that was originally contributed to Debian.")
                 '(set-paths install-locale unpack))
          (add-after 'unpack 'install
            (lambda _
-             (let ((certsdir (string-append %output "/etc/ssl/certs/")))
+             (let ((certsdir (string-append (assoc-ref %outputs "out") "/etc/ssl/certs/")))
                (with-directory-excursion "nss/lib/ckfw/builtins/"
                  (unless (file-exists? "blacklist.txt")
                    (call-with-output-file "blacklist.txt" (const #t)))
@@ -206,7 +206,7 @@ taken from the NSS package and thus ultimately from the Mozilla project.")
 
            ;; Create hash symlinks suitable for OpenSSL ('SSL_CERT_DIR' and
            ;; similar.)
-           (chdir (string-append %output "/etc/ssl/certs"))
+           (chdir (string-append (assoc-ref %outputs "out") "/etc/ssl/certs"))
            (invoke (string-append perl "/bin/perl")
                    (string-append openssl "/bin/c_rehash")
                    ".")))))
diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index 7d6f3811dd..fe30f0c08c 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -447,7 +447,7 @@ to recover data more efficiently by only reading the necessary blocks.")
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags (list "--enable-compat-symlinks")
-       #:make-flags (list (string-append "PREFIX=" %output)
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
                           "CC=gcc")))
     (native-inputs
      `(("autoconf" ,autoconf)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index f8db781446..5910647e7a 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2851,7 +2851,7 @@ external rate conversion.")
     (arguments
      '(#:tests? #f       ; no test suite
        #:configure-flags ; add $libdir to the RUNPATH of executables
-       (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))))
+       (list (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib"))))
     (home-page "https://www.netfilter.org/projects/iptables/index.html")
     (synopsis "Programs to configure Linux IP packet filtering rules")
     (description
@@ -4323,9 +4323,9 @@ dm-thin, dm-cache and dm-era device-mapper targets.")
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags
-       (list (string-append "PREFIX=" %output)
-             (string-append "INSTALL_MAN=" %output "/share/man")
-             (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib")
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             (string-append "INSTALL_MAN=" (assoc-ref %outputs "out") "/share/man")
+             (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib")
              "BUILD_STATIC=")
        #:phases
        (modify-phases %standard-phases
@@ -5343,7 +5343,7 @@ Linux Device Mapper multipathing driver:
     (arguments
      `(#:make-flags
        (let ((target ,(%current-target-system)))
-         (list (string-append "prefix=" %output)
+         (list (string-append "prefix=" (assoc-ref %outputs "out"))
                (string-append
                 "CC=" (if target
                           (string-append (assoc-ref %build-inputs "cross-gcc")
@@ -6791,10 +6791,12 @@ under OpenGL graphics workloads.")
     (arguments
      `(;; Tests require a UEFI system and is not detected in the chroot.
        #:tests? #f
-       #:make-flags (list (string-append "prefix=" %output)
-                          (string-append "libdir=" %output "/lib")
+       #:make-flags (list (string-append "prefix=" (assoc-ref %outputs
+	   "out"))
+                          (string-append "libdir=" (assoc-ref %outputs "out") "/lib")
                           (string-append "CC_FOR_BUILD=" ,(cc-for-target))
-                          (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
+                          (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref
+						  %outputs "out") "/lib"))
        #:phases
        (modify-phases %standard-phases
          (delete 'configure))))
@@ -6825,8 +6827,8 @@ interface to the variable facility of UEFI boot firmware.")
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f ;no tests
-       #:make-flags (list (string-append "prefix=" %output)
-                          (string-append "libdir=" %output "/lib")
+       #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
+                          (string-append "libdir=" (assoc-ref %outputs "out") "/lib")
                           ;; EFIDIR denotes a subdirectory relative to the
                           ;; EFI System Partition where the loader will be
                           ;; installed (known as OS_VENDOR in the code).
diff --git a/gnu/packages/lsof.scm b/gnu/packages/lsof.scm
index b317902ee7..519f7f15b2 100644
--- a/gnu/packages/lsof.scm
+++ b/gnu/packages/lsof.scm
@@ -90,7 +90,10 @@
                 (invoke "./Add2TestDB")
 
                 ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
-                (invoke "make" "standard" "optional")))
+				;; optional test fail on BTRFS
+				;; https://www.spinics.net/lists/linux-btrfs/msg09044.html
+				;; https://githubmemory.com/repo/lsof-org/lsof/issues/152?page=2
+                (invoke "make" "standard" )));"optional")))
             #t))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm
index b4431e5b08..ac4920d836 100644
--- a/gnu/packages/man.scm
+++ b/gnu/packages/man.scm
@@ -183,9 +183,9 @@ a flexible and convenient way.")
                        (string-append "--with-col=" util "/bin/col")
                        ;; The default systemd directories ignore --prefix.
                        (string-append "--with-systemdsystemunitdir="
-                                      %output "/lib/systemd/system")
+                                      (assoc-ref %outputs "out") "/lib/systemd/system")
                        (string-append "--with-systemdtmpfilesdir="
-                                      %output "/lib/tmpfiles.d"))
+                                      (assoc-ref %outputs "out") "/lib/tmpfiles.d"))
                  (map (lambda (prog)
                         (string-append "--with-" prog "=" groff-minimal
                                        "/bin/" prog))
diff --git a/gnu/packages/ntp.scm b/gnu/packages/ntp.scm
index 55b9a73b22..0d8c409b6e 100644
--- a/gnu/packages/ntp.scm
+++ b/gnu/packages/ntp.scm
@@ -159,7 +159,8 @@ time-stamping or reference clock, sub-microsecond accuracy is possible.")
             `(("libcap" ,libcap))
             '())))
    (arguments
-    `(#:phases
+    `(#:configure-flags (list "--with-yielding-select=yes")
+	  #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-network-test
                    (lambda _
-- 
2.33.1