GNU bug report logs - #56253
[PATCH]: gnu: vpnc: Fix cross-compilation.

Previous Next

Package: guix-patches;

Reported by: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>

Date: Mon, 27 Jun 2022 10:54:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56253 in the body.
You can then email your comments to 56253 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Mon, 27 Jun 2022 10:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 27 Jun 2022 10:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>
To: "guix-patches <at> gnu.org" <guix-patches <at> gnu.org>
Subject: [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Mon, 27 Jun 2022 10:52:53 +0000
[Message part 1 (text/plain, inline)]
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
[0001-gnu-vpnc-Fix-cross-compilation.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Mon, 27 Jun 2022 11:28:01 GMT) Full text and rfc822 format available.

Message #8 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>, 56253 <at> debbugs.gnu.org
Subject: Re: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Mon, 27 Jun 2022 13:27:27 +0200
[Message part 1 (text/plain, inline)]
Jean Pierre De Jesus DIAZ via Guix-patches via schreef op ma 27-06-2022
om 10:52 [+0000]:
> +               (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?)

> +           #~(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.


>+                   ;; 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).

>+                   ;; Remove installation of COPYING as 'install-
license-files
>+                   ;; 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.

>+   (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.

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Wed, 29 Jun 2022 11:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>
To: "56253 <at> debbugs.gnu.org" <56253 <at> debbugs.gnu.org>
Subject: [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 11:04:49 +0000
[Message part 1 (text/plain, inline)]
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
[0002-gnu-vpnc-Add-bsd-2-license.patch (text/x-patch, attachment)]
[0001-gnu-vpnc-Fix-cross-compilation.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Wed, 29 Jun 2022 11:10:02 GMT) Full text and rfc822 format available.

Message #14 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>, 56253 <at> debbugs.gnu.org
Subject: Re: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 13:09:29 +0200
[Message part 1 (text/plain, inline)]
Maxime Devos schreef op ma 27-06-2022 om 13:27 [+0200]:
> (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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Wed, 29 Jun 2022 11:10:03 GMT) Full text and rfc822 format available.

Message #17 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>, "56253 <at> debbugs.gnu.org"
 <56253 <at> debbugs.gnu.org>
Subject: Re: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 13:09:44 +0200
[Message part 1 (text/plain, inline)]
Jean Pierre De Jesus DIAZ via Guix-patches via schreef op wo 29-06-2022
om 11:04 [+0000]:
> +                          (cflags (string-append pkg-config
> +                                                 " --cflags"
> +                                                 " liggcrypt"))

liggcrypt -> libgcrypt?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Wed, 29 Jun 2022 18:36:02 GMT) Full text and rfc822 format available.

Message #20 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>
Cc: "56253 <at> debbugs.gnu.org" <56253 <at> debbugs.gnu.org>
Subject: Re: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 20:35:02 +0200
[Message part 1 (text/plain, inline)]
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 <at> 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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56253; Package guix-patches. (Wed, 29 Jun 2022 19:03:01 GMT) Full text and rfc822 format available.

Message #23 received at 56253 <at> debbugs.gnu.org (full text, mbox):

From: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: "56253 <at> debbugs.gnu.org" <56253 <at> debbugs.gnu.org>
Subject: Re: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 19:01:53 +0000
[Message part 1 (text/plain, inline)]
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 <at> telenet.be> wrote:


> 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 <at> 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.
[0001-gnu-vpnc-Fix-cross-compilation.patch (text/x-patch, attachment)]
[0002-gnu-vpnc-Add-bsd-2-license.patch (text/x-patch, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 04 Jul 2022 10:29:01 GMT) Full text and rfc822 format available.

Notification sent to Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>:
bug acknowledged by developer. (Mon, 04 Jul 2022 10:29:02 GMT) Full text and rfc822 format available.

Message #28 received at 56253-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Jean Pierre De Jesus DIAZ <me <at> jeandudey.tech>
Cc: Maxime Devos <maximedevos <at> telenet.be>,
 "56253 <at> debbugs.gnu.org" <56253-done <at> debbugs.gnu.org>
Subject: Re: bug#56253: [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Mon, 04 Jul 2022 12:28:27 +0200
Hi,

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

> From 3d3cb006c249a303c59300f8760e7f7b103b1037 Mon Sep 17 00:00:00 2001
> Message-Id: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me <at> jeandudey.tech>
> From: Jean-Pierre De Jesus DIAZ <me <at> 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.

[...]

> From d94babd41579d19d9cbbb2cca2285e0f3c8c1e77 Mon Sep 17 00:00:00 2001
> Message-Id: <d94babd41579d19d9cbbb2cca2285e0f3c8c1e77.1656501265.git.me <at> jeandudey.tech>
> In-Reply-To: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me <at> jeandudey.tech>
> References: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me <at> jeandudey.tech>
> From: Jean-Pierre De Jesus DIAZ <me <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 01 Aug 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.