Skip Menu |
 
Report information
Id: 114798
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: fperrad <francois.perrad [at] gadz.org>
Cc: JROBINSON <castaway [at] desert-island.me.uk>
AdminCc:

Operating System: Linux
PatchStatus: HasPatch
Severity: low
Type:
  • configure
  • Patch
Perl Version: 5.14.2
Fixed In: (no value)



Subject: Configure: add support of qemu
Date: Sun, 9 Sep 2012 08:51:18 +0200
To: perlbug [...] perl.org
From: François Perrad <francois.perrad [...] gadz.org>
Download (untitled) / with headers
text/plain 6.2k
This is a bug report for perl from francois.perrad@gadz.org, generated with the help of perlbug 1.39 running under perl 5.14.2. ----------------------------------------------------------------- [Please describe your issue here] my goal is the cross-compiling of Perl with Buildroot, see http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191592.html my last patch against Buildroot is http://patchwork.ozlabs.org/patch/182554/ (the recipe is in package/perl/perl.mk) So, Configure needs a support of qemu (user mode). Find below 3 patches against blead From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Tue, 4 Sep 2012 16:26:09 +0200 Subject: [PATCH 1/3] add qemu support $targetrun contains something like : qemu-arm, qemu-i386, qemu-ppc, qemu-x86_64 $qemulib is a path Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Configure b/Configure index a1ba981..c78cf77 100755 --- a/Configure +++ b/Configure @@ -2911,6 +2911,14 @@ fi $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" EOF ;; + qemu*) + to=: + from=: + cat >$run <<EOF +#!/bin/sh +$targetrun -L $qemulib "\$@" +EOF + ;; *) echo "Unknown targetrun '$targetrun'" >&4 exit 1 ;; -- 1.7.9.5 From f686dacad60a327728141efa38dee1614a875368 Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Tue, 4 Sep 2012 16:27:48 +0200 Subject: [PATCH 2/3] fix when cross-devel $run must be used Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configure b/Configure index c78cf77..6cc87af 100755 --- a/Configure +++ b/Configure @@ -5059,7 +5059,7 @@ checkccflag='check=$1; flag=$2; callback=$3; echo " "; echo "Checking if your compiler accepts $flag" 2>&1; echo "int main(void) { return 0; }" > gcctest.c; -if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then +if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then echo "Yes, it does." 2>&1; if $test -s gcctest.out ; then echo "But your platform does not like it:"; -- 1.7.9.5 From fc0278276b992191dd4d81a55a64f5b3b6922812 Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Tue, 4 Sep 2012 16:45:30 +0200 Subject: [PATCH 3/3] add a default for targethost when qemu targethost is mandatory with a ssh connection, but useless with qemu Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Configure b/Configure index 6cc87af..ff81233 100755 --- a/Configure +++ b/Configure @@ -2840,6 +2840,9 @@ $define|true|[yY]*) ;; *) echo "Using usrinc $usrinc." >&4 ;; esac + case "$targetrun" in + qemu*) targethost=dummy ;; + esac case "$targethost" in '') echo "Targethost not defined." >&4; croak=y ;; *) echo "Using targethost $targethost." >&4 -- 1.7.9.5 [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.14.2: Configured by Debian Project at Fri Aug 10 21:43:39 UTC 2012. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=linux, osvers=2.6.42-26-generic, archname=i686-linux-gnu-thread-multi-64int uname='linux roseapple 2.6.42-26-generic #41-ubuntu smp thu jun 14 17:49:24 utc 2012 i686 i686 i386 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i686-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.14 -Darchlib=/usr/lib/perl/5.14 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.14.2 -Dsitearch=/usr/local/lib/perl/5.14.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.14.2 -des' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.6.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /lib /usr/lib libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=, so=so, useshrplib=true, libperl=libperl.so.5.14.2 gnulibc_version='2.15' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector' Locally applied patches: --- @INC for perl 5.14.2: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl . --- Environment for perl 5.14.2: HOME=/home/user LANG=en_US.UTF-8 LANGUAGE=en_US:en LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PERL_BADLANG (unset) SHELL=/bin/bash
CC: perlbug-followup [...] perl.org, bugs-bitbucket [...] rt.perl.org, "Jess Robinson" <castaway [...] desert-island.me.uk>
Subject: Re: [perl #114798] Configure: add support of qemu
Date: Mon, 10 Sep 2012 09:36:19 +0200
To: perl5-porters [...] perl.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
On Sat, 08 Sep 2012 23:51:50 -0700, Francois PERRAD (via RT) <perlbug-followup@perl.org> wrote: Show quoted text
> # New Ticket Created by Francois PERRAD > # Please include the string: [perl #114798] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114798 > > > > This is a bug report for perl from francois.perrad@gadz.org, > generated with the help of perlbug 1.39 running under perl 5.14.2. > > > ----------------------------------------------------------------- > [Please describe your issue here] > my goal is the cross-compiling of Perl with Buildroot, > see http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191592.html > my last patch against Buildroot is http://patchwork.ozlabs.org/patch/182554/ > (the recipe is in package/perl/perl.mk) > > So, Configure needs a support of qemu (user mode).
I'd like to hear jess' comments on this Show quoted text
> Find below 3 patches against blead >
> >From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00 2001
> From: Francois Perrad <francois.perrad@gadz.org> > Date: Tue, 4 Sep 2012 16:26:09 +0200 > Subject: [PATCH 1/3] add qemu support > > $targetrun contains something like : qemu-arm, qemu-i386, qemu-ppc, qemu-x86_64 > $qemulib is a path > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > --- > Configure | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Configure b/Configure > index a1ba981..c78cf77 100755 > --- a/Configure > +++ b/Configure > @@ -2911,6 +2911,14 @@ fi > $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" > EOF > ;; > + qemu*) > + to=: > + from=: > + cat >$run <<EOF > +#!/bin/sh > +$targetrun -L $qemulib "\$@" > +EOF > + ;; > *) echo "Unknown targetrun '$targetrun'" >&4 > exit 1 > ;;
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.14 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.6k
Hi, I assume from your patches that you're just running a local compile, rather than the scp/ssh dance that the cross-compiling defaults to? On Sat Sep 08 23:51:49 2012, fperrad wrote: Show quoted text
> my goal is the cross-compiling of Perl with Buildroot, > see > http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191592.html > my last patch against Buildroot is > http://patchwork.ozlabs.org/patch/182554/ > (the recipe is in package/perl/perl.mk) > > So, Configure needs a support of qemu (user mode). > > Find below 3 patches against blead > > From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00 2001 > From: Francois Perrad <francois.perrad@gadz.org> > Date: Tue, 4 Sep 2012 16:26:09 +0200 > Subject: [PATCH 1/3] add qemu support > > $targetrun contains something like : qemu-arm, qemu-i386, qemu-ppc, > qemu-x86_64 > $qemulib is a path > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > --- > Configure | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Configure b/Configure > index a1ba981..c78cf77 100755 > --- a/Configure > +++ b/Configure > @@ -2911,6 +2911,14 @@ fi > $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" > EOF > ;; > + qemu*) > + to=: > + from=: > + cat >$run <<EOF > +#!/bin/sh > +$targetrun -L $qemulib "\$@" > +EOF > + ;; > *) echo "Unknown targetrun '$targetrun'" >&4 > exit 1 > ;;
Silly reply-whatsit only lists one patch. The only question I'd have is what is $qemulib? Can an existing variable be used for it? The part that uses $qemulib should first test if it has been set, and complain if not (preferably with a hint about what its for) The rest seems quite sane to me. Jes
Download (untitled) / with headers
text/plain 2.1k
On Fri Oct 19 04:52:03 2012, JROBINSON wrote: Show quoted text
> Hi, > > I assume from your patches that you're just running a local compile,
rather Show quoted text
> than the scp/ssh dance that the cross-compiling defaults to? >
Yes, I do real cross-compilation, not remote-compilation :) Show quoted text
> On Sat Sep 08 23:51:49 2012, fperrad wrote: >
> > my goal is the cross-compiling of Perl with Buildroot, > > see > > http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191592.html > > my last patch against Buildroot is > > http://patchwork.ozlabs.org/patch/182554/ > > (the recipe is in package/perl/perl.mk) > > > > So, Configure needs a support of qemu (user mode). > > > > Find below 3 patches against blead > > > > From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00 2001 > > From: Francois Perrad <francois.perrad@gadz.org> > > Date: Tue, 4 Sep 2012 16:26:09 +0200 > > Subject: [PATCH 1/3] add qemu support > > > > $targetrun contains something like : qemu-arm, qemu-i386, qemu-ppc, > > qemu-x86_64 > > $qemulib is a path > > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > > --- > > Configure | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/Configure b/Configure > > index a1ba981..c78cf77 100755 > > --- a/Configure > > +++ b/Configure > > @@ -2911,6 +2911,14 @@ fi > > $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" > > EOF > > ;; > > + qemu*) > > + to=: > > + from=: > > + cat >$run <<EOF > > +#!/bin/sh > > +$targetrun -L $qemulib "\$@" > > +EOF > > + ;; > > *) echo "Unknown targetrun '$targetrun'" >&4 > > exit 1 > > ;;
> > Silly reply-whatsit only lists one patch. > > The only question I'd have is what is $qemulib? Can an existing
variable be Show quoted text
> used for it? The part that uses $qemulib should first test if it has been > set, and complain if not (preferably with a hint about what its for) > > The rest seems quite sane to me. >
My needs have changed a bit. My use cases are now : $ ./Configure -Dusecrosscompile -Dtargetrun="qemu-arm -L path/to/cross-libs" ... $ ./Configure -Dusecrosscompile -Dtargetrun="/my/home/built/qemu-arm" ... So, I refactor my 3 patches without $qemulib. See them in attachment. Fran�ois Show quoted text
> Jes
From 3bf60a97774a5a7a456eec2fb7ab8034b7efa65b Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Fri, 19 Oct 2012 18:46:23 +0200 Subject: [PATCH 2/3] fix when cross-devel $run must be used Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configure b/Configure index 3c2f8c7..1b84736 100755 --- a/Configure +++ b/Configure @@ -5059,7 +5059,7 @@ checkccflag='check=$1; flag=$2; callback=$3; echo " "; echo "Checking if your compiler accepts $flag" 2>&1; echo "int main(void) { return 0; }" > gcctest.c; -if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then +if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then echo "Yes, it does." 2>&1; if $test -s gcctest.out ; then echo "But your platform does not like it:"; -- 1.7.9.5
From 2e7c8c54ac20ea8d5a2330102372d57bb78ed3b2 Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Fri, 19 Oct 2012 18:45:49 +0200 Subject: [PATCH 1/3] add qemu support $targetrun = "qemu-arm -L path/to/cross-libs" or $targetrun = "/my/home/built/qemu-arm" Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Configure b/Configure index a1bc835..3c2f8c7 100755 --- a/Configure +++ b/Configure @@ -2871,7 +2871,7 @@ $define|true|[yY]*) case "$targetfrom" in '') targetfrom=scp ;; esac - run=$run-$targetrun + run=$run-`basename \`echo "$targetrun" | sed -e 's/^\([^ \t]*\).*$/\1/'\`` to=$to-$targetto from=$from-$targetfrom case "$targetdir" in @@ -2911,6 +2911,14 @@ fi $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" EOF ;; + *qemu*) + to=: + from=: + cat >$run <<EOF +#!/bin/sh +$targetrun "\$@" +EOF + ;; *) echo "Unknown targetrun '$targetrun'" >&4 exit 1 ;; -- 1.7.9.5
From 18c13c8ed59d8884f6507dbe555832b008fea99f Mon Sep 17 00:00:00 2001 From: Francois Perrad <francois.perrad@gadz.org> Date: Fri, 19 Oct 2012 18:46:49 +0200 Subject: [PATCH 3/3] add a targethost default when qemu targethost is mandatory with a ssh connection, but useless with qemu Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- Configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Configure b/Configure index 1b84736..fec6dd0 100755 --- a/Configure +++ b/Configure @@ -2840,6 +2840,9 @@ $define|true|[yY]*) ;; *) echo "Using usrinc $usrinc." >&4 ;; esac + case "$targetrun" in + *qemu*) targethost=dummy ;; + esac case "$targethost" in '') echo "Targethost not defined." >&4; croak=y ;; *) echo "Using targethost $targethost." >&4 -- 1.7.9.5
RT-Send-CC: perl5-porters [...] perl.org
Gah, perlbug didn't notify me on updates, I've now added myself to the watchers list. I'm just looking at this part myself. I think what I'd like to do is: a) Add a way to cross-compile, but skip the whole "run stuff on another host" altogether, instead of changing parts of it. I'll probably have a go at this by splitting the "figure out your compiler" part from the "run on another host" part. IMO one could want to run on another host even if not cross-compiling.. b) Allow you to just provide your own value of "run", or for a hints file to override it. I'm not quite sure I understand what your patch for run=`basename ... ` line is doing, given you then have a qemu section that ignores it? On Fri Oct 19 11:51:31 2012, fperrad wrote: Show quoted text
> On Fri Oct 19 04:52:03 2012, JROBINSON wrote:
> > Hi, > > > > I assume from your patches that you're just running a local compile,
> rather
> > than the scp/ssh dance that the cross-compiling defaults to? > >
> > Yes, I do real cross-compilation, not remote-compilation :) >
> > On Sat Sep 08 23:51:49 2012, fperrad wrote: > >
> > > my goal is the cross-compiling of Perl with Buildroot, > > > see > > > http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/
msg191592.html Show quoted text
> > > my last patch against Buildroot is > > > http://patchwork.ozlabs.org/patch/182554/ > > > (the recipe is in package/perl/perl.mk) > > > > > > So, Configure needs a support of qemu (user mode). > > > > > > Find below 3 patches against blead > > > > > > From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00
2001 Show quoted text
> > > From: Francois Perrad <francois.perrad@gadz.org> > > > Date: Tue, 4 Sep 2012 16:26:09 +0200 > > > Subject: [PATCH 1/3] add qemu support > > > > > > $targetrun contains something like : qemu-arm, qemu-i386, qemu-
ppc, Show quoted text
> > > qemu-x86_64 > > > $qemulib is a path > > > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > > > --- > > > Configure | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/Configure b/Configure > > > index a1ba981..c78cf77 100755 > > > --- a/Configure > > > +++ b/Configure > > > @@ -2911,6 +2911,14 @@ fi > > > $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" > > > EOF > > > ;; > > > + qemu*) > > > + to=: > > > + from=: > > > + cat >$run <<EOF > > > +#!/bin/sh > > > +$targetrun -L $qemulib "\$@" > > > +EOF > > > + ;; > > > *) echo "Unknown targetrun '$targetrun'" >&4 > > > exit 1 > > > ;;
> > > > Silly reply-whatsit only lists one patch. > > > > The only question I'd have is what is $qemulib? Can an existing
> variable be
> > used for it? The part that uses $qemulib should first test if it
has been Show quoted text
> > set, and complain if not (preferably with a hint about what its for) > > > > The rest seems quite sane to me. > >
> > My needs have changed a bit. My use cases are now : > $ ./Configure -Dusecrosscompile -Dtargetrun="qemu-arm -L > path/to/cross-libs" ... > $ ./Configure -Dusecrosscompile -Dtargetrun="/my/home/built/qemu-
arm" ... Show quoted text
> > So, I refactor my 3 patches without $qemulib. See them in attachment. > > Fran�ois >
> > Jes
> >
Date: Fri, 31 Jan 2014 16:02:53 -0200
From: Brian Fraser <fraserbn [...] gmail.com>
CC: bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #114798] Configure: add support of qemu
To: Perl5 Porters Mailing List <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 5.8k
On Sun, Sep 9, 2012 at 3:51 AM, Francois PERRAD <perlbug-followup@perl.org> wrote:
Show quoted text
# New Ticket Created by  Francois PERRAD
# Please include the string:  [perl #114798]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114798 >


This is a bug report for perl from francois.perrad@gadz.org,
generated with the help of perlbug 1.39 running under perl 5.14.2.


-----------------------------------------------------------------
[Please describe your issue here]
my goal is the cross-compiling of Perl with Buildroot,
see http://www.nntp.perl.org/group/perl.perl5.porters/2012/09/msg191592.html
my last patch against Buildroot is http://patchwork.ozlabs.org/patch/182554/
(the recipe is in package/perl/perl.mk)

So, Configure needs a support of qemu (user mode).

Find below 3 patches against blead

>From 42abf7caea008ee7dc8a876d88e3dd4d7de3cc16 Mon Sep 17 00:00:00 2001
From: Francois Perrad <francois.perrad@gadz.org>
Date: Tue, 4 Sep 2012 16:26:09 +0200
Subject: [PATCH 1/3] add qemu support

$targetrun contains something like : qemu-arm, qemu-i386, qemu-ppc, qemu-x86_64
$qemulib is a path
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 Configure |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Configure b/Configure
index a1ba981..c78cf77 100755
--- a/Configure
+++ b/Configure
@@ -2911,6 +2911,14 @@ fi
 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
 EOF
            ;;
+       qemu*)
+           to=:
+           from=:
+           cat >$run <<EOF
+#!/bin/sh
+$targetrun -L $qemulib "\$@"
+EOF
+           ;;
        *)  echo "Unknown targetrun '$targetrun'" >&4
            exit 1
            ;;
--
1.7.9.5

>From f686dacad60a327728141efa38dee1614a875368 Mon Sep 17 00:00:00 2001
From: Francois Perrad <francois.perrad@gadz.org>
Date: Tue, 4 Sep 2012 16:27:48 +0200
Subject: [PATCH 2/3] fix when cross-devel

$run must be used

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 Configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Configure b/Configure
index c78cf77..6cc87af 100755
--- a/Configure
+++ b/Configure
@@ -5059,7 +5059,7 @@ checkccflag='check=$1; flag=$2; callback=$3;
 echo " ";
 echo "Checking if your compiler accepts $flag" 2>&1;
 echo "int main(void) { return 0; }" > gcctest.c;
-if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
+if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
     echo "Yes, it does." 2>&1;
     if $test -s gcctest.out ; then
         echo "But your platform does not like it:";
--
1.7.9.5

>From fc0278276b992191dd4d81a55a64f5b3b6922812 Mon Sep 17 00:00:00 2001
From: Francois Perrad <francois.perrad@gadz.org>
Date: Tue, 4 Sep 2012 16:45:30 +0200
Subject: [PATCH 3/3] add a default for targethost when qemu

targethost is mandatory with a ssh connection, but useless with qemu

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 Configure |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/Configure b/Configure
index 6cc87af..ff81233 100755
--- a/Configure
+++ b/Configure
@@ -2840,6 +2840,9 @@ $define|true|[yY]*)
             ;;
         *)  echo "Using usrinc $usrinc." >&4 ;;
        esac
+       case "$targetrun" in
+       qemu*) targethost=dummy ;;
+       esac
        case "$targethost" in
        '') echo "Targethost not defined." >&4; croak=y ;;
         *)  echo "Using targethost $targethost." >&4
--
1.7.9.5


Jumpstarting this ticket. Francois recently chimed in on another thread & updated the patch[0], so I applied it locally and gave it a try.
With some tweaking I was able to build a perl on my amd64 Linux box that runs on a raspberry pi without needing to access the target system in any way; additionally, with some manual hacks 'make test' for that perl managed to run in its entirely, *locally*, which is huge. So I think that there's quite a bit of worth in pursuing this.

That being said, I had a couple of problems along the way. First, for me the current $run dies with 'FATAL: kernel too old'. Some googling lead me to discover that I could pass qemu the kernel version with the -r switch, ala qemu-arm -r 3.11, and that solved the problem, so to the very least, a way of passing options to qemu is needed. Additionally, $run needs to be able to handle -cwd and -env, so locally it looks like this for me:

         cat >$run <<EOF
#!/bin/sh
env=''
case "\$1" in
-cwd)
  shift
  cwd=\$1
  shift
  ;;
esac
case "\$1" in
-env)
  shift
  env=\$1
  shift
  ;;
esac
case "\$cwd" in
'') ;;
*) cd \$cwd ;;
esac
\$env $targetrun $qemuoptions -L $sysroot "\$@"
EOF

With $qemuoptions being something like "-r 3.11".

Moving on, I too am unsure about the `basename ...` line. The intent seems to be that $run end up as run-qemu-arm when Configure is called with either -Dtargetrun=/foo/bar/qemu-arm or -Dtargetrun='qemu-arm -r 3.11'. The latter seems like the wrong way to go about it; for the former, we currently assume that whatever targetrun is, it'll be in PATH; if we're going to start accepting fulls paths to binaries in targetrun, the other options should be fixed as well.

For 'make test', I had to basically replace ./perl with a script that called ./original-perl through $run, but I also had to make it load a compat module that removed 'original-' from $^X. Which is just nasty.

Unrelated to this patch but in a similar vein, yesterday I pushed a branch that allows cross-compiling from Linux to Win32, either through ssh or wine[1]. The wine bits are unsurprisingly pretty similar to this.
From: François Perrad <francois.perrad [...] gadz.org>
CC: Perl5 Porters Mailing List <perl5-porters [...] perl.org>, bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #114798] Configure: add support of qemu
To: Brian Fraser <fraserbn [...] gmail.com>
Date: Sat, 1 Feb 2014 14:50:37 +0100
Download (untitled) / with headers
text/plain 3.1k
2014-01-31 Brian Fraser <fraserbn@gmail.com>: Show quoted text
> On Sun, Sep 9, 2012 at 3:51 AM, Francois PERRAD <perlbug-followup@perl.org> > wrote:
>> >> # New Ticket Created by Francois PERRAD >> # Please include the string: [perl #114798] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114798 > >> >>
> > Jumpstarting this ticket. Francois recently chimed in on another thread & > updated the patch[0], so I applied it locally and gave it a try. > With some tweaking I was able to build a perl on my amd64 Linux box that > runs on a raspberry pi without needing to access the target system in any > way; additionally, with some manual hacks 'make test' for that perl managed > to run in its entirely, *locally*, which is huge. So I think that there's > quite a bit of worth in pursuing this.
The use of Qemu has some limitations : 1) Qemu is not available for all CPU architecture 2) qemu-i386 is buggy, I filled this ticket https://bugs.launchpad.net/qemu/+bug/1076445 with a minimal test case which doesn't depend on Perl configure/build. For testing purpose, I copy the whole build tree on the target (Buildroot linux), and run $ cd t $ ln -s ../perl perl $ ./perl harness François Show quoted text
> > That being said, I had a couple of problems along the way. First, for me the > current $run dies with 'FATAL: kernel too old'. Some googling lead me to > discover that I could pass qemu the kernel version with the -r switch, ala > qemu-arm -r 3.11, and that solved the problem, so to the very least, a way > of passing options to qemu is needed. Additionally, $run needs to be able to > handle -cwd and -env, so locally it looks like this for me: > > cat >$run <<EOF > #!/bin/sh > env='' > case "\$1" in > -cwd) > shift > cwd=\$1 > shift > ;; > esac > case "\$1" in > -env) > shift > env=\$1 > shift > ;; > esac > case "\$cwd" in > '') ;; > *) cd \$cwd ;; > esac > \$env $targetrun $qemuoptions -L $sysroot "\$@" > EOF > > With $qemuoptions being something like "-r 3.11". > > Moving on, I too am unsure about the `basename ...` line. The intent seems > to be that $run end up as run-qemu-arm when Configure is called with either > -Dtargetrun=/foo/bar/qemu-arm or -Dtargetrun='qemu-arm -r 3.11'. The latter > seems like the wrong way to go about it; for the former, we currently assume > that whatever targetrun is, it'll be in PATH; if we're going to start > accepting fulls paths to binaries in targetrun, the other options should be > fixed as well. > > For 'make test', I had to basically replace ./perl with a script that called > ./original-perl through $run, but I also had to make it load a compat module > that removed 'original-' from $^X. Which is just nasty. > > Unrelated to this patch but in a similar vein, yesterday I pushed a branch > that allows cross-compiling from Linux to Win32, either through ssh or > wine[1]. The wine bits are unsurprisingly pretty similar to this. > > [0] > https://github.com/fperrad/br/blob/perl-castaway/package/perl/perl-configure-qemu.patch > [1] > http://perl5.git.perl.org/perl.git/shortlog/refs/heads/hugmeir/cross-compile-win32


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org