help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross-compiling libfido2


From: Pierre Langlois
Subject: Re: Cross-compiling libfido2
Date: Sat, 26 Mar 2022 14:38:58 +0000
User-agent: mu4e 1.6.10; emacs 27.2

Hi!

Sébastien Lerique <sl@eauchat.org> writes:

> Hello Guix!
>
> I'm trying to build a raw image for a rock64 board, from my x86_64
> laptop (using Guix on PopOS), and bumping into some
> packages seemingly not ready for cross-compilation.
>
> I am adding `(service openssh-service-type ...)` to the base
> gnu/system/images/rock64.scm (building the original rock64.scm config
> works fine), and my build fails at libfido2.
>
> My config is
> https://gitlab.com/wehlutyk/matrixbox/-/blob/eacc326b8a7d41f3113e3768302c59687402a536/config.scm
> and building libfido2 fails at the configure phase with
>
> ```
> (...)
>
> -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
> -- Checking for one of the modules 'libcbor'
> -- Checking for one of the modules 'libcrypto'
> -- Checking for one of the modules 'zlib'
> CMake Error at CMakeLists.txt:206 (message):
>   could not find zlib
>
> (...)
> ```

Doing some grepping in Guix and a quick test, I think what you need to
do is set PKG_CONFIG_EXECUTABLE to (pkg-config-for-target) when
cross-compiling.  I can see that the libgit2 package does this for example


--8<---------------cut here---------------start------------->8---
     `(#:configure-flags
       (list "-DUSE_NTLMCLIENT=OFF" ;TODO: package this
             "-DREGEX_BACKEND=pcre2"
             "-DUSE_HTTP_PARSER=system"
             ,@(if (%current-target-system)
                   `((string-append
                      "-DPKG_CONFIG_EXECUTABLE="
                      (search-input-file
                       %build-inputs
                       (string-append "/bin/" ,(%current-target-system)
                                      "-pkg-config"))))
                   '()))
       #:phases
--8<---------------cut here---------------end--------------->8---

Doing the same thing for libfido2 seems to fix it for me!

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 129b8f6122..092fe13f58 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -910,7 +910,16 @@ (define-public libfido2
        ("openssl" ,openssl)))
     (build-system cmake-build-system)
     (arguments
-     '(#:phases
+     `(#:configure-flags
+       (list ,@(if (%current-target-system)
+                   `((string-append
+                      "-DPKG_CONFIG_EXECUTABLE="
+                      (search-input-file
+                       %build-inputs
+                       (string-append "/bin/" ,(%current-target-system)
+                                      "-pkg-config"))))
+                   '()))
+       #:phases
        (modify-phases %standard-phases
          ;; regress tests enabled only for debug builds
          (delete 'check))))
--8<---------------cut here---------------end--------------->8---

Does this work for you as well?  Let us know if you want to prepare a
patch :-).

Thanks,
Pierre

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]