* [bug#54595] [PATCH 0/2] Fix cross-compilation for libfido2
@ 2022-03-27 12:28 Sébastien Lerique
2022-03-27 12:29 ` [bug#54595] [PATCH 1/2] gnu: libfido2: Use new style Sébastien Lerique
2022-03-27 13:00 ` [bug#54595] [PATCH v2 1/2] gnu: libfido2: Use new style Sébastien Lerique
0 siblings, 2 replies; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 12:28 UTC (permalink / raw)
To: 54595; +Cc: Sébastien Lerique
Hello guix!
This small patch fixes cross-compilation for libfido2, which in turn is
necessary to cross-compile openssh.
Thank you to Pierre Langlois and for help on IRC!
Sébastien Lerique (2):
gnu: libfido2: Use new style.
gnu: libfido2: Fix cross-compilation.
gnu/packages/security-token.scm | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
base-commit: cabda1197e7925f58a8532534afc1bde6c5eb377
--
2.34.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 1/2] gnu: libfido2: Use new style.
2022-03-27 12:28 [bug#54595] [PATCH 0/2] Fix cross-compilation for libfido2 Sébastien Lerique
@ 2022-03-27 12:29 ` Sébastien Lerique
2022-03-27 12:29 ` [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
2022-03-27 13:00 ` [bug#54595] [PATCH v2 1/2] gnu: libfido2: Use new style Sébastien Lerique
1 sibling, 1 reply; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 12:29 UTC (permalink / raw)
To: 54595; +Cc: Sébastien Lerique
* gnu/packages/security-token.scm (libfido2)[inputs]: Use new style.
---
gnu/packages/security-token.scm | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 129b8f6122..6853d5bc9e 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -903,11 +903,7 @@ (define-public libfido2
(file-name (git-file-name name version))
(sha256 (base32 "12zy4cnlcffcb64lsx8198y09j1dwi0bcn9rr82q6i1k950yzd3p"))))
(native-inputs (list pkg-config))
- (inputs
- `(("zlib" ,zlib)
- ("udev" ,eudev)
- ("libcbor" ,libcbor)
- ("openssl" ,openssl)))
+ (inputs (list zlib eudev libcbor openssl))
(build-system cmake-build-system)
(arguments
'(#:phases
--
2.34.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 12:29 ` [bug#54595] [PATCH 1/2] gnu: libfido2: Use new style Sébastien Lerique
@ 2022-03-27 12:29 ` Sébastien Lerique
2022-03-27 12:36 ` Maxime Devos
0 siblings, 1 reply; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 12:29 UTC (permalink / raw)
To: 54595; +Cc: Sébastien Lerique
* gnu/packages/security-token.scm (libfido2)[arguments]: Set
PKG_CONFIG_EXECUTABLE variable when cross-compiling.
---
gnu/packages/security-token.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 6853d5bc9e..903da686f9 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -906,7 +906,16 @@ (define-public libfido2
(inputs (list zlib eudev libcbor 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))))
--
2.34.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 12:29 ` [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
@ 2022-03-27 12:36 ` Maxime Devos
2022-03-27 13:01 ` Sébastien Lerique
2022-03-27 14:04 ` Pierre Langlois
0 siblings, 2 replies; 14+ messages in thread
From: Maxime Devos @ 2022-03-27 12:36 UTC (permalink / raw)
To: Sébastien Lerique, 54595
[-- Attachment #1: Type: text/plain, Size: 645 bytes --]
Sébastien Lerique schreef op zo 27-03-2022 om 21:29 [+0900]:
> + ,(%current-target-system)
> + "-pkg-config"))))
This can be simplified with 'pkg-config-for-target':
#:configure-flags
(list (string-append "-DPKG_CONFIG_EXECUTABLE="
(search-input-file %build-inputs
(string-append "/bin/" ,(pkg-config-for-target)))))
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH v2 1/2] gnu: libfido2: Use new style.
2022-03-27 12:28 [bug#54595] [PATCH 0/2] Fix cross-compilation for libfido2 Sébastien Lerique
2022-03-27 12:29 ` [bug#54595] [PATCH 1/2] gnu: libfido2: Use new style Sébastien Lerique
@ 2022-03-27 13:00 ` Sébastien Lerique
2022-03-27 13:00 ` [bug#54595] [PATCH v2 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
1 sibling, 1 reply; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 13:00 UTC (permalink / raw)
To: 54595; +Cc: Sébastien Lerique
* gnu/packages/security-token.scm (libfido2)[inputs]: Use new style.
---
gnu/packages/security-token.scm | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 129b8f6122..6853d5bc9e 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -903,11 +903,7 @@ (define-public libfido2
(file-name (git-file-name name version))
(sha256 (base32 "12zy4cnlcffcb64lsx8198y09j1dwi0bcn9rr82q6i1k950yzd3p"))))
(native-inputs (list pkg-config))
- (inputs
- `(("zlib" ,zlib)
- ("udev" ,eudev)
- ("libcbor" ,libcbor)
- ("openssl" ,openssl)))
+ (inputs (list zlib eudev libcbor openssl))
(build-system cmake-build-system)
(arguments
'(#:phases
base-commit: cabda1197e7925f58a8532534afc1bde6c5eb377
--
2.34.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH v2 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 13:00 ` [bug#54595] [PATCH v2 1/2] gnu: libfido2: Use new style Sébastien Lerique
@ 2022-03-27 13:00 ` Sébastien Lerique
2022-03-27 14:09 ` Maxime Devos
0 siblings, 1 reply; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 13:00 UTC (permalink / raw)
To: 54595; +Cc: Sébastien Lerique
* gnu/packages/security-token.scm (libfido2)[arguments]: Set
PKG_CONFIG_EXECUTABLE variable when cross-compiling.
---
gnu/packages/security-token.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 6853d5bc9e..db8a8a53d3 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -44,6 +44,7 @@ (define-module (gnu packages security-token)
#:use-module (guix build-system gnu)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system python)
+ #:use-module (guix utils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages curl)
@@ -906,7 +907,15 @@ (define-public libfido2
(inputs (list zlib eudev libcbor 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/"
+ ,(pkg-config-for-target)))))
+ '()))
+ #:phases
(modify-phases %standard-phases
;; regress tests enabled only for debug builds
(delete 'check))))
--
2.34.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 12:36 ` Maxime Devos
@ 2022-03-27 13:01 ` Sébastien Lerique
2022-03-27 14:04 ` Pierre Langlois
1 sibling, 0 replies; 14+ messages in thread
From: Sébastien Lerique @ 2022-03-27 13:01 UTC (permalink / raw)
To: Maxime Devos; +Cc: 54595
On 27 Mar 2022 at 14:36, Maxime Devos <maximedevos@telenet.be> wrote:
> This can be simplified with 'pkg-config-for-target':
>
Indeed, thanks! Just tried again with a v2.
Best,
Sébastien
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 12:36 ` Maxime Devos
2022-03-27 13:01 ` Sébastien Lerique
@ 2022-03-27 14:04 ` Pierre Langlois
2022-03-27 15:43 ` Maxime Devos
2022-03-27 15:44 ` Maxime Devos
1 sibling, 2 replies; 14+ messages in thread
From: Pierre Langlois @ 2022-03-27 14:04 UTC (permalink / raw)
To: Maxime Devos; +Cc: sl, 54595
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
Hi,
Maxime Devos <maximedevos@telenet.be> writes:
> [[PGP Signed Part:Undecided]]
> Sébastien Lerique schreef op zo 27-03-2022 om 21:29 [+0900]:
>> + ,(%current-target-system)
>> + "-pkg-config"))))
>
> This can be simplified with 'pkg-config-for-target':
>
> #:configure-flags
> (list (string-append "-DPKG_CONFIG_EXECUTABLE="
> (search-input-file %build-inputs
> (string-append "/bin/" ,(pkg-config-for-target)))))
For my own benefit trying to get better at writing gexps, I was
wondering how to write in order to remove the %build-inputs reference.
I came up with the following:
--8<---------------cut here---------------start------------->8---
(arguments
(list
#:configure-flags
#~(list #$@(if (%current-target-system)
(list
#~(string-append
"-DPKG_CONFIG_EXECUTABLE="
#+pkg-config "/bin/"
#$(pkg-config-for-target)))
'()))
#:phases
#~(modify-phases %standard-phases
;; regress tests enabled only for debug builds
(delete 'check))))
--8<---------------cut here---------------end--------------->8---
Would this a the better way to do this? It looks a bit complex to me so
I wonder if there's a simpler way. I'm also not entirely sure if it's
#+pkg-config or #$pkg-config, both seem to work, however I thought we
should be using #+ for native inputs and #$ for regular inputs.
Thanks,
Pierre
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH v2 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 13:00 ` [bug#54595] [PATCH v2 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
@ 2022-03-27 14:09 ` Maxime Devos
0 siblings, 0 replies; 14+ messages in thread
From: Maxime Devos @ 2022-03-27 14:09 UTC (permalink / raw)
To: Sébastien Lerique, 54595
[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]
Sébastien Lerique schreef op zo 27-03-2022 om 22:00 [+0900]:
> + `(#:configure-flags (list ,@(if (%current-target-system)
> + `((string-append
> + "-DPKG_CONFIG_EXECUTABLE="
> + (search-input-file %build-inputs
> + (string-append
> + "/bin/"
> + ,(pkg-config-for-target)))))
> + '()))
'pkg-config-for-target' just returns "pkg-config" when compiling
natively, so the 'if' can be dropped here and the "-
DPKG_CONFIG_EXECUTABLE=..." be made unconditional.
For clarity, I would put the 'list' on a separate line, though for
style reasons that might require removing the quasiquote and turning it
in a 'list': (arguments (list #:phases #~(foo ...) #:configure-flags
#~(bar ... #$(pkg-config-for-target)))).
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 14:04 ` Pierre Langlois
@ 2022-03-27 15:43 ` Maxime Devos
2022-03-27 17:27 ` Pierre Langlois
2022-03-27 15:44 ` Maxime Devos
1 sibling, 1 reply; 14+ messages in thread
From: Maxime Devos @ 2022-03-27 15:43 UTC (permalink / raw)
To: Pierre Langlois; +Cc: Sébastien Lerique, 54595
[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]
Pierre Langlois schreef op zo 27-03-2022 om 15:04 [+0100]:
> I'm also not entirely sure if it's
> #+pkg-config or #$pkg-config, both seem to work
#+pkg-config, given that it is a thing that needs to be run during
compilation. I'm wondering, do you have transparant QEMU emulation
enabled? If so, both seeming to work is expected since QEMU will
emulate the cross-compiled cross-compiling (IIUC a canadian cross, in
GCC terminology) pkg-config. If not, I would expect some kind of error
...
Or, to allow for package transformations:
#+(file-append (this-package-native-input (pkg-config-for-target))
"/bin/" (pkg-config-for-target))
though maybe package transformations should just transform the G-exp as
well, dunno. ('file-append' is not strictly required here.) Maybe we can
have a macro (pkg-config-binary) that expands to that thing, and
use it in other packages?
Possibly interesting or irrelevant: the following will produce an
x86_64-linux-gnu-pkg-config that can be run on a aarch64-linux-gnu
computer to find libraries for x86_64-linux-gnu.
$ guix build -e '(parameterize (((@ (guix utils) %current-target-system) "x86_64-linux-gnu")) (@ (gnu packages pkg-config) pkg-config))' --target=aarch64-linux-gnu
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 14:04 ` Pierre Langlois
2022-03-27 15:43 ` Maxime Devos
@ 2022-03-27 15:44 ` Maxime Devos
1 sibling, 0 replies; 14+ messages in thread
From: Maxime Devos @ 2022-03-27 15:44 UTC (permalink / raw)
To: Pierre Langlois; +Cc: sl, 54595
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
Pierre Langlois schreef op zo 27-03-2022 om 15:04 [+0100]:
> #~(modify-phases %standard-phases
> ;; regress tests enabled only for debug builds
> (delete 'check))))
FWIW, given that this is old code, '#:tests #false' + comment would
suffice here and is a bit simpler.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 15:43 ` Maxime Devos
@ 2022-03-27 17:27 ` Pierre Langlois
2022-03-27 18:00 ` Maxime Devos
0 siblings, 1 reply; 14+ messages in thread
From: Pierre Langlois @ 2022-03-27 17:27 UTC (permalink / raw)
To: Maxime Devos; +Cc: Pierre Langlois, Sébastien Lerique, 54595
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
Maxime Devos <maximedevos@telenet.be> writes:
> [[PGP Signed Part:Undecided]]
> Pierre Langlois schreef op zo 27-03-2022 om 15:04 [+0100]:
>> I'm also not entirely sure if it's
>> #+pkg-config or #$pkg-config, both seem to work
>
> #+pkg-config, given that it is a thing that needs to be run during
> compilation. I'm wondering, do you have transparant QEMU emulation
> enabled? If so, both seeming to work is expected since QEMU will
> emulate the cross-compiled cross-compiling (IIUC a canadian cross, in
> GCC terminology) pkg-config. If not, I would expect some kind of error
> ...
Ooooh I do have qemu emulation enabled, that must be it, thanks! I'll
need to be careful about that, seems too easy to make a mistake.
>
> Or, to allow for package transformations:
>
> #+(file-append (this-package-native-input (pkg-config-for-target))
> "/bin/" (pkg-config-for-target))
>
> though maybe package transformations should just transform the G-exp as
> well, dunno. ('file-append' is not strictly required here.) Maybe we can
> have a macro (pkg-config-binary) that expands to that thing, and
> use it in other packages?
Yeah, if we have this pattern often it sounds like a good idea.
However, better yet maybe could be to make the cmake build-system handle
it automagically. I see `PKG_CONFIG_EXECUTABLE' is part of cmake itself
so that might be OK?
https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
>
> Possibly interesting or irrelevant: the following will produce an
> x86_64-linux-gnu-pkg-config that can be run on a aarch64-linux-gnu
> computer to find libraries for x86_64-linux-gnu.
>
> $ guix build -e '(parameterize (((@ (guix utils) %current-target-system) "x86_64-linux-gnu")) (@ (gnu packages pkg-config) pkg-config))' --target=aarch64-linux-gnu
Ha! That's pretty cool :-).
Thanks,
Pierre
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 17:27 ` Pierre Langlois
@ 2022-03-27 18:00 ` Maxime Devos
2022-03-27 22:12 ` Thiago Jung Bauermann via Guix-patches via
0 siblings, 1 reply; 14+ messages in thread
From: Maxime Devos @ 2022-03-27 18:00 UTC (permalink / raw)
To: Pierre Langlois; +Cc: Sébastien Lerique, 54595
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
Pierre Langlois schreef op zo 27-03-2022 om 18:27 [+0100]:
> Yeah, if we have this pattern often it sounds like a good idea.
> However, better yet maybe could be to make the cmake build-system
> handle
> it automagically. I see `PKG_CONFIG_EXECUTABLE' is part of cmake
> itself
> so that might be OK?
>
> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
Seems reasonable to me, though it that probably needs to be on core-
updates due to many impacted packages, so that's more of a long-term
thing.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation.
2022-03-27 18:00 ` Maxime Devos
@ 2022-03-27 22:12 ` Thiago Jung Bauermann via Guix-patches via
0 siblings, 0 replies; 14+ messages in thread
From: Thiago Jung Bauermann via Guix-patches via @ 2022-03-27 22:12 UTC (permalink / raw)
To: Maxime Devos; +Cc: pierre.langlois, sl, 54595
Maxime Devos <maximedevos@telenet.be> writes:
> [[PGP Signed Part:Undecided]]
> Pierre Langlois schreef op zo 27-03-2022 om 18:27 [+0100]:
>> Yeah, if we have this pattern often it sounds like a good idea.
>> However, better yet maybe could be to make the cmake build-system
>> handle
>> it automagically. I see `PKG_CONFIG_EXECUTABLE' is part of cmake
>> itself
>> so that might be OK?
>>
>> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
>
> Seems reasonable to me, though it that probably needs to be on core-
> updates due to many impacted packages, so that's more of a long-term
> thing.
IMHO the most correct way to fix this problem is in CMake itself. If
it's cross-compiling and there's a $TARGET_PREFIX-pkg-config in path,
then it ought to use it automatically.
I'm not volunteering to champion that solution though. :-)
So of course the next best thing is to make Guix's build system do that
for us.
--
Thanks
Thiago
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-03-27 22:23 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-27 12:28 [bug#54595] [PATCH 0/2] Fix cross-compilation for libfido2 Sébastien Lerique
2022-03-27 12:29 ` [bug#54595] [PATCH 1/2] gnu: libfido2: Use new style Sébastien Lerique
2022-03-27 12:29 ` [bug#54595] [PATCH 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
2022-03-27 12:36 ` Maxime Devos
2022-03-27 13:01 ` Sébastien Lerique
2022-03-27 14:04 ` Pierre Langlois
2022-03-27 15:43 ` Maxime Devos
2022-03-27 17:27 ` Pierre Langlois
2022-03-27 18:00 ` Maxime Devos
2022-03-27 22:12 ` Thiago Jung Bauermann via Guix-patches via
2022-03-27 15:44 ` Maxime Devos
2022-03-27 13:00 ` [bug#54595] [PATCH v2 1/2] gnu: libfido2: Use new style Sébastien Lerique
2022-03-27 13:00 ` [bug#54595] [PATCH v2 2/2] gnu: libfido2: Fix cross-compilation Sébastien Lerique
2022-03-27 14:09 ` Maxime Devos
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).