unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation
@ 2018-09-03 14:10 Raphaël Mélotte
  2018-09-03 21:48 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Raphaël Mélotte @ 2018-09-03 14:10 UTC (permalink / raw)
  To: 32624

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

This patch adds support for cross-compilation for perl.
I only applied the suggestion made by Chris here:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31221

I tested it by running the following command, which builds perl successfully:

sudo -E ./pre-inst-env guix build --target=i686-pc-linux-gnu perl



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-perl-Add-support-for-cross-compilation.patch --]
[-- Type: text/x-diff, Size: 1887 bytes --]

From 1aa61436c6c85ebfdea9aceeb3949ac97fdbe289 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@posteo.net>
Date: Mon, 3 Sep 2018 10:20:06 +0200
Subject: [PATCH] gnu: perl: Add support for cross-compilation

* gnu/packages/perl.scm (perl): use cross-libc when cross-compiling
---
 gnu/packages/perl.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 4d70e019b..b10be9567 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -48,6 +48,7 @@
   #:use-module (guix utils) ;substitute-keyword-arguments for perl-5.26.2
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-web)
@@ -79,7 +80,7 @@
                        "perl-reproducible-build-date.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f
+     `(#:tests? #f
        #:configure-flags
        (let ((out  (assoc-ref %outputs "out"))
              (libc (assoc-ref %build-inputs "libc")))
@@ -128,7 +129,10 @@
          (add-after 'install 'remove-extra-references
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out     (assoc-ref outputs "out"))
-                    (libc    (assoc-ref inputs "libc"))
+                    (libc (assoc-ref inputs
+                             (if ,(%current-target-system)
+                                  "cross-libc"
+                                  "libc")))
                     (config1 (car (find-files (string-append out "/lib/perl5")
                                               "^Config_heavy\\.pl$")))
                     (config2 (find-files (string-append out "/lib/perl5")
-- 
2.11.0


[-- Attachment #3: Type: text/plain, Size: 26 bytes --]


-- 
Raphaël Mélotte

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation
  2018-09-03 14:10 [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation Raphaël Mélotte
@ 2018-09-03 21:48 ` Ludovic Courtès
  2018-09-04 10:13   ` Raphaël Mélotte
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2018-09-03 21:48 UTC (permalink / raw)
  To: Raphaël Mélotte; +Cc: 32624

Hi,

"Raphaël Mélotte" <raphael.melotte@gmail.com> skribis:

> This patch adds support for cross-compilation for perl.
> I only applied the suggestion made by Chris here:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31221
>
> I tested it by running the following command, which builds perl successfully:
>
> sudo -E ./pre-inst-env guix build --target=i686-pc-linux-gnu perl
>
>
> From 1aa61436c6c85ebfdea9aceeb3949ac97fdbe289 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@posteo.net>
> Date: Mon, 3 Sep 2018 10:20:06 +0200
> Subject: [PATCH] gnu: perl: Add support for cross-compilation
>
> * gnu/packages/perl.scm (perl): use cross-libc when cross-compiling

I tested a variant of this patch with --target=arm-linux-gnueabihf.
During the ‘configure’ phase, I see:

--8<---------------cut here---------------start------------->8---
Checking for cross-compile
No targethost for running compiler tests against defined, running locally
--8<---------------cut here---------------end--------------->8---

Then the build completes but the result is a set of x86_64 (native)
binaries.

So I suppose some more work in needed to really cross-compile.  Maybe we
need to pass specific configure flags?

(BTW, I think I already wrote this but you don’t need to cross-compile
if all you want is 32-bit binaries.  Simply use “-s i686-linux” for
that.)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation
  2018-09-03 21:48 ` Ludovic Courtès
@ 2018-09-04 10:13   ` Raphaël Mélotte
  2018-09-05  9:57     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Raphaël Mélotte @ 2018-09-04 10:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32624


Ludovic Courtès writes:

> I tested a variant of this patch with --target=arm-linux-gnueabihf.
> During the ‘configure’ phase, I see:
>
> --8<---------------cut here---------------start------------->8---
> Checking for cross-compile
> No targethost for running compiler tests against defined, running locally
> --8<---------------cut here---------------end--------------->8---
>
> Then the build completes but the result is a set of x86_64 (native)
> binaries.
>
> So I suppose some more work in needed to really cross-compile.  Maybe we
> need to pass specific configure flags?

Ok, thanks for checking.
After some web searching and according to the following page, cross-compiling perl isn't an easy
task:
https://arsv.github.io/perl-cross/index.html

Do you think it would be a good idea to package perl-cross and use it
when cross-compiling ?

The other option (giving -Dtargethost to the configure script) seems to require
a target host to be available with an ssh
server running.


> (BTW, I think I already wrote this but you don’t need to cross-compile
> if all you want is 32-bit binaries.  Simply use “-s i686-linux” for
> that.)

Yes you mentioned it a few month ago, and that helped me a lot back
then :-)
I wanted to come back to trying to cross-compile some packages because
I find it interesting (the idea of remotely building packages for other architectures
is so cool).


Thanks,

Raphaël.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation
  2018-09-04 10:13   ` Raphaël Mélotte
@ 2018-09-05  9:57     ` Ludovic Courtès
  2018-09-07 12:58       ` Raphaël Mélotte
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2018-09-05  9:57 UTC (permalink / raw)
  To: Raphaël Mélotte; +Cc: 32624

Hi Raphaël,

Raphaël Mélotte <raphael.melotte@gmail.com> skribis:

> Ok, thanks for checking.
> After some web searching and according to the following page, cross-compiling perl isn't an easy
> task:
> https://arsv.github.io/perl-cross/index.html
>
> Do you think it would be a good idea to package perl-cross and use it
> when cross-compiling ?

I would prefer to rely on Perl’s build system, assuming it supports cross-compilation.

Now, I see that Buildroot uses perl-cross, so maybe it’s a sign that
it’s unavoidable:

  https://git.busybox.net/buildroot/tree/package/perl/perl.mk

Besides I personally don’t consider cross-compilation of Perl a
priority, so unless you have a need for it, you can choose a different
task to work on.  ;-)

> Yes you mentioned it a few month ago, and that helped me a lot back
> then :-)

Great.  :-)

> I wanted to come back to trying to cross-compile some packages because
> I find it interesting (the idea of remotely building packages for other architectures
> is so cool).

It is!  It’s usually a lot easier with packages that use the GNU build
system than with packages that use custom build tools such as Perl.

Let me know if you want to pursue the Perl cross-compilation endeavor
and if not, we can close this issue.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation
  2018-09-05  9:57     ` Ludovic Courtès
@ 2018-09-07 12:58       ` Raphaël Mélotte
  2018-09-07 14:17         ` bug#32624: " Raphaël Mélotte
  0 siblings, 1 reply; 6+ messages in thread
From: Raphaël Mélotte @ 2018-09-07 12:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32624


Ludovic Courtès writes:

> I would prefer to rely on Perl’s build system, assuming it supports cross-compilation.

I understand.

> Now, I see that Buildroot uses perl-cross, so maybe it’s a sign that
> it’s unavoidable:
>
>   https://git.busybox.net/buildroot/tree/package/perl/perl.mk
>
> Besides I personally don’t consider cross-compilation of Perl a
> priority, so unless you have a need for it, you can choose a different
> task to work on.  ;-)

I guess writing a package recipy for perl-cross wouldn't be too hard,
but forcing it's use when cross-compiling or even adapting Perl's build
system requires knowledge I don't have (yet?).

> Let me know if you want to pursue the Perl cross-compilation endeavor
> and if not, we can close this issue.

I don't need it so much either so I'll try to focus on smaller packages definitions that I find useful. 

(I just closed the issue)


Thanks!

Raphaël.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#32624: [PATCH] gnu: perl: Add support for cross-compilation
  2018-09-07 12:58       ` Raphaël Mélotte
@ 2018-09-07 14:17         ` Raphaël Mélotte
  0 siblings, 0 replies; 6+ messages in thread
From: Raphaël Mélotte @ 2018-09-07 14:17 UTC (permalink / raw)
  To: Raphaël Mélotte; +Cc: 32624-done


Raphaël Mélotte writes:

> (I just closed the issue)

Whoops, I forgot to add "-done" to close it. Sorry for the noise.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-07 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 14:10 [bug#32624] [PATCH] gnu: perl: Add support for cross-compilation Raphaël Mélotte
2018-09-03 21:48 ` Ludovic Courtès
2018-09-04 10:13   ` Raphaël Mélotte
2018-09-05  9:57     ` Ludovic Courtès
2018-09-07 12:58       ` Raphaël Mélotte
2018-09-07 14:17         ` bug#32624: " Raphaël Mélotte

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