[PATCH]: gnu: vpnc: Fix cross-compilation.

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • Jean Pierre De Jesus DIAZ
Owner
unassigned
Submitted by
Jean Pierre De Jesus DIAZ
Severity
normal
J
J
Jean Pierre De Jesus DIAZ wrote on 27 Jun 2022 12:52
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
FLlgKC6siW3VOq_B4lWQxjFA3AAfEeBHTzV6qw0FIAP_isJ8bLu0QF0hr3LNVzfW2lre7jAAb3AHD4UgIpGfGQDdGhtSSYwQ386OVu_U5tE=@jeandudey.tech
Fix cross-compilation for `vpnc'.

The error was because the `Makefile' tried to execute the resulting binary and
failed as a result. This is done to generate the manpage.

The solution I found was to compile twice the binary, one for the host and the
other for the target, this way the manpage is generated and installed first and
the binary for the target is built later. When not cross-compiling this is not
done.

The error can be seen by executing:

guix build vpnc \
--target=aarch64-linux-gnu

I'm not entirely sure that I've made a correct git message, so feel free to
modify it if doesn't match the standards.


Jean-Pierre De Jesus DIAZ
M
M
Maxime Devos wrote on 27 Jun 2022 13:27
e0cdb67c368e01d028063d9e9d824735031f8c00.camel@telenet.be
Jean Pierre De Jesus DIAZ via Guix-patches via schreef op ma 27-06-2022
om 10:52 [+0000]:
Toggle quote (15 lines)
> +               (replace 'build
> +                 (lambda* (#:key inputs make-flags parallel-build?
> target
> +                           #:allow-other-keys)
> +                   ;; When cross-compiling, the bash script
> 'libgcrypt-config'
> +                   ;; must be accessible during the configure phase.
> +                   (when target
> +                     (setenv "PATH"
> +                             (string-append
> +                               (dirname
> +                                 (search-input-file inputs
> +                                                    "bin/libgcrypt-
> config"))

It would be simpler to replace 'libgcrypt-config --libs' by 'pkg-config
--libs' (with a substitute*, post-unpack) and likewise for
'libgcrypt-config --libs', to avoid executing a script compiled for
another architecture locally (it works because of a preceding $(shell
..., though doesn't seem great to me).

(Additionally, maybe upstream would be interested in pkg-config which
mostly just works when cross-compiling, in constrast to ...-config
scripts?)

Toggle quote (2 lines)
> + #~(let ((out (assoc-ref %outputs "out")))

If you're using G-exps, you might as well replace (assoc-ref %outputs
"out") by #$output. Also, there's no configure phase, it has been
removed.


Toggle quote (12 lines)
>+ ;; manpage. This step is not necessary when the target is
>+ ;; the host.
>+ (when target
>+ (apply invoke "make" "vpnc.8" "CC=gcc"
>+ (if parallel-build?
>+ (list "-j" (number->string (parallel-job-count)))
>+ '()))
>+ (install-file "vpnc.8"
>+ (string-append (assoc-ref outputs "out")
>+ "/share/man/man8"))
>+ (invoke "make" "clean"))))

You can simplify this by adding vpnc itself to the native-inputs (conditional
on %current-target-system to avoid a cycle) and when cross-compiling, copy the
man page from the native input to vpnc.8 (pre-build, instead of replacing build,
then you don't needd to fiddle with parallelism flags or the install phase).

Toggle quote (1 lines)
>+ ;; Remove installation of COPYING as 'install-
license-files
Toggle quote (4 lines)
>+ ;; phase does it with a proper version number.
>+ (substitute* "Makefile"
>+ (("install -m644 COPYING.*") "")))))))

Independent change, so for a separate commit. Also, I don't think it's
worth it to remove the double installation -- we would be deviating
from upstream and at most some KB would be saved but we have automated
depulication. Or maybe it's nice for consistency, dunno.

Toggle quote (7 lines)
>+ (license (list license:gpl2+
>+ ;; dh.c
>+ ;; dh.h
>+ ;; math_group.c
>+ ;; math_group.h
>+ license:bsd-2))

Again independent change -- I don't think it was necessary to mention
the file names (but I don't think they have to be removed either). More
precise license information looks nice.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYrmUHxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pZnAQD2W4SlMUm3Iwi8elCBxCpA2OHj
+fZ2uwRWHpfPCrykowEAs2NcSBjerhkOdcL31Qk/ePh83HlM8ctqBNWC/3vSswU=
=pAPA
-----END PGP SIGNATURE-----


J
J
Jean Pierre De Jesus DIAZ wrote on 29 Jun 2022 13:04
[PATCH]: gnu: vpnc: Fix cross-compilation.
(name . 56253@debbugs.gnu.org)(address . 56253@debbugs.gnu.org)
GLlJUa75SYS6xoV29rej4ulOY7ojlZM7_CrnbERoAxpINvvOytcrLYkp6BWh8ABerbqWLR1pc41-yg5Ru5eNTFknSiHxLL2UL6fQD5p9Nww=@jeandudey.tech
Thanks for the review!

Did not know that packages could have themselves as an input.
Added it and modified the phases accordingly and made the use
of `pkg-config' in the build.

Made a separate patch for the license change.

And, I will try to push of `pkg-config' usage on upstream by
sending a patch (and hopefully reduce substitutions on the
package).

Jean-Pierre De Jesus DIAZ
From 7fdc511ecb23a79a6b701f972864349db5247467 Mon Sep 17 00:00:00 2001
Message-Id: <7fdc511ecb23a79a6b701f972864349db5247467.1656500364.git.me@jeandudey.tech>
In-Reply-To: <e4c1daacb42b56099ccee3f80ec022980f19efc1.1656500364.git.me@jeandudey.tech>
References: <e4c1daacb42b56099ccee3f80ec022980f19efc1.1656500364.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Wed, 29 Jun 2022 12:57:02 +0200
Subject: [PATCH 2/2] gnu: vpnc: Add bsd-2 license.

* gnu/packages/vpn.scm (vpnc)[license]: Add bsd-2.
---
gnu/packages/vpn.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index c4399f232b..19c2837a71 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -547,7 +547,7 @@ (define-public vpnc
shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
- (license license:gpl2+) ; some file are bsd-2, see COPYING
+ (license (list license:gpl2+ license:bsd-2))
(home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
(define-public vpnc-scripts
--
2.36.1
M
M
Maxime Devos wrote on 29 Jun 2022 13:09
f7660ac1ea35596650f9f5dbc22d784b0775bab8.camel@telenet.be
Maxime Devos schreef op ma 27-06-2022 om 13:27 [+0200]:
Toggle quote (4 lines)
> (Additionally, maybe upstream would be interested in pkg-config which
> mostly just works when cross-compiling, in constrast to ...-config
> scripts?)

TBC: those scripts can work, but things go messy if you both have a
native libgcrypt and a cross-compiled libgcrypt.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYrwy6RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7n/HAP4u65tHQDPCx2YPSG3HOWrccdAN
efFY07QnGbAEYjLGHQEAwbZ+Qh3HBGqh8Rf23i0X1b0k1rSf9xSujrqN3OxSVwg=
=Iu2V
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 29 Jun 2022 13:09
2e110844647d5ec64be97b3460210cc7f60a741b.camel@telenet.be
Jean Pierre De Jesus DIAZ via Guix-patches via schreef op wo 29-06-2022
om 11:04 [+0000]:
Toggle quote (4 lines)
> +                          (cflags (string-append pkg-config
> +                                                 " --cflags"
> +                                                 " liggcrypt"))

liggcrypt -> libgcrypt?
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYrwy+BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jHYAP9u5lMjGDXWeTIrZKASA0ECjT79
R+IZ5VR3IX9JB/FHRQD/ZQSfzjAivgi3JjcX1XG+k4jm61LeXgdewqqjZEsnAg4=
=K88z
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 29 Jun 2022 20:35
(name . Jean Pierre De Jesus DIAZ)(address . me@jeandudey.tech)(name . 56253@debbugs.gnu.org)(address . 56253@debbugs.gnu.org)
34a13962a3091732e55861f32666c40339b8e8de.camel@telenet.be
Jean Pierre De Jesus DIAZ schreef op wo 29-06-2022 om 11:15 [+0000]:
Toggle quote (3 lines)
> Sorry, fixed the typo and re-built again to verify and everything is
> in order.

Was just a typo, no need for apologies :).

It looks good to me (though TBC: didn't compile it myself) but you seem
to have forgotten to keep 56253@debbugs.gnu.org in CC, so people that
can actually commit it haven't seen it, so you'll have to resend it.
(FWIW, reportedly the ‘reply all’ options of e-mail clients take care
of that)

Greeitngs,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYrybVhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uTrAQCojoFZ3jxtCaG8QVDF3oVAGplc
4HTL39wJM6upe9JqpAD/aknSgvHuwixX4CwcxoCrPhl9DGFLdf7oIsL1oi+oZwc=
=0igJ
-----END PGP SIGNATURE-----


J
J
Jean Pierre De Jesus DIAZ wrote on 29 Jun 2022 21:01
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . 56253@debbugs.gnu.org)(address . 56253@debbugs.gnu.org)
-NeN31Z3ZgphCpQMB6ZQBTc1zZD0Tujp0TnZr4EYreaQpMPRWBw5U2HHQlg9DJqtiQS3YMNR_Lgq2wgloWBfaTVcCCqRqDIgRdynhsYSOIw=@jeandudey.tech
Has happened multiple times, always using normal Reply despite
getting same results :D.

Added patches again.

Jean-Pierre De Jesus DIAZ


------- Original Message -------
On Wednesday, June 29th, 2022 at 8:35 PM, Maxime Devos <maximedevos@telenet.be> wrote:


Toggle quote (16 lines)
> Jean Pierre De Jesus DIAZ schreef op wo 29-06-2022 om 11:15 [+0000]:
>
> > Sorry, fixed the typo and re-built again to verify and everything is
> > in order.
>
>
> Was just a typo, no need for apologies :).
>
> It looks good to me (though TBC: didn't compile it myself) but you seem
> to have forgotten to keep 56253@debbugs.gnu.org in CC, so people that
> can actually commit it haven't seen it, so you'll have to resend it.
> (FWIW, reportedly the ‘reply all’ options of e-mail clients take care
> of that)
>
> Greeitngs,
> Maxime.
From d94babd41579d19d9cbbb2cca2285e0f3c8c1e77 Mon Sep 17 00:00:00 2001
Message-Id: <d94babd41579d19d9cbbb2cca2285e0f3c8c1e77.1656501265.git.me@jeandudey.tech>
In-Reply-To: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
References: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Wed, 29 Jun 2022 12:57:02 +0200
Subject: [PATCH 2/2] gnu: vpnc: Add bsd-2 license.

* gnu/packages/vpn.scm (vpnc)[license]: Add bsd-2.
---
gnu/packages/vpn.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index 807e741bc0..259d21cb01 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -547,7 +547,7 @@ (define-public vpnc
shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
- (license license:gpl2+) ; some file are bsd-2, see COPYING
+ (license (list license:gpl2+ license:bsd-2))
(home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
(define-public vpnc-scripts
--
2.36.1
L
L
Ludovic Courtès wrote on 4 Jul 2022 12:28
Re: bug#56253: [PATCH]: gnu: vpnc: Fix cross-compilation.
(name . Jean Pierre De Jesus DIAZ)(address . me@jeandudey.tech)
877d4tf9ys.fsf_-_@gnu.org
Hi,

Jean Pierre De Jesus DIAZ <me@jeandudey.tech> skribis:

Toggle quote (14 lines)
> From 3d3cb006c249a303c59300f8760e7f7b103b1037 Mon Sep 17 00:00:00 2001
> Message-Id: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
> From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
> Date: Wed, 29 Jun 2022 12:51:55 +0200
> Subject: [PATCH 1/2] gnu: vpnc: Fix cross-compilation.
>
> * gnu/packages/vpn.scm (vpnc): Fix cross-compilation.
> [native-inputs]: Add conditional input of `this-package' (vpnc)
> to reuse the man page and add `pkg-config'.
> [arguments]: Use G-Expressions.
> [arguments]: Make use of `make-flags' instead of using substitutions.
> [arguments]: Remove unneeded deletion of `configure'.
> [arguments]: Use `pkg-config' to search for libgcrypt.

[...]

Toggle quote (10 lines)
> From d94babd41579d19d9cbbb2cca2285e0f3c8c1e77 Mon Sep 17 00:00:00 2001
> Message-Id: <d94babd41579d19d9cbbb2cca2285e0f3c8c1e77.1656501265.git.me@jeandudey.tech>
> In-Reply-To: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
> References: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
> From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
> Date: Wed, 29 Jun 2022 12:57:02 +0200
> Subject: [PATCH 2/2] gnu: vpnc: Add bsd-2 license.
>
> * gnu/packages/vpn.scm (vpnc)[license]: Add bsd-2.

Applied, thanks, and thanks Maxime for reviewing!

Ludo’.
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 56253
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