diff mbox

[v11,2/9] perl: new package

Message ID 1350652434-32020-2-git-send-email-francois.perrad@gadz.org
State Accepted
Headers show

Commit Message

Francois Perrad Oct. 19, 2012, 1:13 p.m. UTC
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/Config.in                      |    1 +
 package/perl/Config.in                 |   18 ++++++
 package/perl/perl-configure-qemu.patch |   53 +++++++++++++++++
 package/perl/perl-make-ext.patch       |   24 ++++++++
 package/perl/perl-mkppport.patch       |   37 ++++++++++++
 package/perl/perl.mk                   |   99 ++++++++++++++++++++++++++++++++
 6 files changed, 232 insertions(+)
 create mode 100644 package/perl/Config.in
 create mode 100644 package/perl/perl-configure-qemu.patch
 create mode 100644 package/perl/perl-make-ext.patch
 create mode 100644 package/perl/perl-mkppport.patch
 create mode 100644 package/perl/perl.mk

Comments

Bernd Kuhls Oct. 30, 2012, 8:20 p.m. UTC | #1
Hi,

Francois Perrad <fperrad@gmail.com> wrote in
news:1350652434-32020-2-git-send-email-francois.perrad@gadz.org: 

currently I am testing your patchset, but I found problems during 
compiling, some I could solve myself:

> +PERL_CONF_OPT = -des \

[...]

> +          -Dlibc=$(STAGING_DIR)/lib/libc.so \

I had to change this line to

             -Dlibc=$(STAGING_DIR)/usr/lib/libc.so.0 \

for usage with uClibc 0.9.33.2

[...]

> +          -Uoptimize

Here I had to add "-Ud_eaccess" to avoid a compilation bug.

Perl will still not finish to compile, stopping with this error message:

> LD_LIBRARY_PATH=/home/bernd/.fbr/build/output/build/perl-5.16.1 
/home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386 
./miniperl -Ilib make_ext.pl cpan/Archive-Extract/pm_to_blib 
MAKE=/home/bernd/.fbr/build/output/host/usr/bin/make LIBPERL_A=libperl.so
>         Making Archive::Extract (all)
> 
> Creating Makefile.PL in cpan/Archive-Extract for Archive::Extract
> 
> Running Makefile.PL in cpan/Archive-Extract
> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386 
../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none 
INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.so
> -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
> Warning: No Makefile!
> /home/bernd/.fbr/build/output/host/usr/bin/make config PERL_CORE=1 
LIBPERL_A=libperl.so failed, continuing anyway...
> Making all in cpan/Archive-Extract
> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386 
/home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1 
LIBPERL_A=libperl.so
> Unsuccessful make(cpan/Archive-Extract): code=-1 at make_ext.pl line 468.
> make[1]: *** [cpan/Archive-Extract/pm_to_blib] Fehler 22
> make[1]: Leaving directory `/home/bernd/.fbr/build/output/build/perl-
5.16.1'
> make: *** [/home/bernd/.fbr/build/output/build/perl-5.16.1/.stamp_built] 
Fehler 2

Executing the last command alone provides this error hinting at a problem 
with host-qemu, which I was able to solve yet.

$ /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386 
/home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1 
LIBPERL_A=libperl.so
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240

First I got this error message with Debian Squeeze i386 (virtualbox guest, 
Win XP host), but also on Debian wheezy amd64 running non-virtualized.

My .config can be found here: http://pastebin.com/yz1SzeB2
I am using buildroot as part of the FLI4L source package[1].

Kind regards, Bernd

[1] http://www.fli4l.de/download/tarball-version/aktuell.html
Francois Perrad Nov. 5, 2012, 4:41 p.m. UTC | #2
2012/10/30 Bernd Kuhls <berndkuhls@hotmail.com>:
> Hi,
>
> Francois Perrad <fperrad@gmail.com> wrote in
> news:1350652434-32020-2-git-send-email-francois.perrad@gadz.org:
>
> currently I am testing your patchset, but I found problems during
> compiling, some I could solve myself:
>
>> +PERL_CONF_OPT = -des \
>
> [...]
>
>> +          -Dlibc=$(STAGING_DIR)/lib/libc.so \
>
> I had to change this line to
>
>              -Dlibc=$(STAGING_DIR)/usr/lib/libc.so.0 \
>
> for usage with uClibc 0.9.33.2
>
> [...]
>
>> +          -Uoptimize
>
> Here I had to add "-Ud_eaccess" to avoid a compilation bug.
>
> Perl will still not finish to compile, stopping with this error message:
>
>> LD_LIBRARY_PATH=/home/bernd/.fbr/build/output/build/perl-5.16.1
> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
> ./miniperl -Ilib make_ext.pl cpan/Archive-Extract/pm_to_blib
> MAKE=/home/bernd/.fbr/build/output/host/usr/bin/make LIBPERL_A=libperl.so
>>         Making Archive::Extract (all)
>>
>> Creating Makefile.PL in cpan/Archive-Extract for Archive::Extract
>>
>> Running Makefile.PL in cpan/Archive-Extract
>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
> ../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none
> INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.so
>> -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
>> Warning: No Makefile!
>> /home/bernd/.fbr/build/output/host/usr/bin/make config PERL_CORE=1
> LIBPERL_A=libperl.so failed, continuing anyway...
>> Making all in cpan/Archive-Extract
>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
> LIBPERL_A=libperl.so
>> Unsuccessful make(cpan/Archive-Extract): code=-1 at make_ext.pl line 468.
>> make[1]: *** [cpan/Archive-Extract/pm_to_blib] Fehler 22
>> make[1]: Leaving directory `/home/bernd/.fbr/build/output/build/perl-
> 5.16.1'
>> make: *** [/home/bernd/.fbr/build/output/build/perl-5.16.1/.stamp_built]
> Fehler 2
>
> Executing the last command alone provides this error hinting at a problem
> with host-qemu, which I was able to solve yet.
>
> $ /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
> LIBPERL_A=libperl.so
> qemu: Unsupported syscall: 240
> qemu: Unsupported syscall: 240
>
> First I got this error message with Debian Squeeze i386 (virtualbox guest,
> Win XP host), but also on Debian wheezy amd64 running non-virtualized.
>
> My .config can be found here: http://pastebin.com/yz1SzeB2
> I am using buildroot as part of the FLI4L source package[1].
>
> Kind regards, Bernd
>

I could reproduce the lastest problem on the HEAD of Buildroot with
qemu_x86_defconfig (which is a smaller config than your FLI4L config).

François

> [1] http://www.fli4l.de/download/tarball-version/aktuell.html
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle Nov. 6, 2012, 1:05 a.m. UTC | #3
On 11/05/12 17:41, François Perrad wrote:
>> >  $/home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>> >  /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>> >  LIBPERL_A=libperl.so
>> >  qemu: Unsupported syscall: 240
>> >  qemu: Unsupported syscall: 240
>> >
>> >  First I got this error message with Debian Squeeze i386 (virtualbox guest,
>> >  Win XP host), but also on Debian wheezy amd64 running non-virtualized.
>> >
>> >  My .config can be found here:http://pastebin.com/yz1SzeB2
>> >  I am using buildroot as part of the FLI4L source package[1].
>> >
>> >  Kind regards, Bernd
>> >
> I could reproduce the lastest problem on the HEAD of Buildroot with
> qemu_x86_defconfig (which is a smaller config than your FLI4L config).

  Is it possible that this is because the target binary is created with
kernel headers 3.2, but you're running it on a host which is only 2.6.32
(squeeze)?  But then it should work on wheezy, because that has 3.2 as
well (at least since about four months IIRC).  Although...  240 on i386
is futex, which has existed already since long before 2.6.32.

  I do find this bug report:
https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/758424
but I'm not sure if it is relevant.

  Regards,
  Arnout
Thomas Petazzoni Nov. 6, 2012, 7:08 a.m. UTC | #4
On Tue, 06 Nov 2012 02:05:52 +0100, Arnout Vandecappelle wrote:

>   Is it possible that this is because the target binary is created with
> kernel headers 3.2, but you're running it on a host which is only 2.6.32
> (squeeze)?  But then it should work on wheezy, because that has 3.2 as
> well (at least since about four months IIRC).  Although...  240 on i386
> is futex, which has existed already since long before 2.6.32.

Aaah, I didn't think about this problem. This is indeed going to be
really annoying, if the kernel headers chosen for the target have to
somewhat match the kernel version running on the host :-(

I guess this whole qemu thing for Perl is going to be annoying on the
long term. We might need to start looking for a different option, i.e
seeing how to get Perl to build without needing qemu.

Best regards,

Thomas
Francois Perrad Nov. 6, 2012, 10:24 a.m. UTC | #5
2012/11/5 François Perrad <francois.perrad@gadz.org>:
> 2012/10/30 Bernd Kuhls <berndkuhls@hotmail.com>:
>> Hi,
>>
>> Francois Perrad <fperrad@gmail.com> wrote in
>> news:1350652434-32020-2-git-send-email-francois.perrad@gadz.org:
>>
>> currently I am testing your patchset, but I found problems during
>> compiling, some I could solve myself:
>>
>>> +PERL_CONF_OPT = -des \
>>
>> [...]
>>
>>> +          -Dlibc=$(STAGING_DIR)/lib/libc.so \
>>
>> I had to change this line to
>>
>>              -Dlibc=$(STAGING_DIR)/usr/lib/libc.so.0 \
>>
>> for usage with uClibc 0.9.33.2
>>
>> [...]
>>
>>> +          -Uoptimize
>>
>> Here I had to add "-Ud_eaccess" to avoid a compilation bug.
>>
>> Perl will still not finish to compile, stopping with this error message:
>>
>>> LD_LIBRARY_PATH=/home/bernd/.fbr/build/output/build/perl-5.16.1
>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>> ./miniperl -Ilib make_ext.pl cpan/Archive-Extract/pm_to_blib
>> MAKE=/home/bernd/.fbr/build/output/host/usr/bin/make LIBPERL_A=libperl.so
>>>         Making Archive::Extract (all)
>>>
>>> Creating Makefile.PL in cpan/Archive-Extract for Archive::Extract
>>>
>>> Running Makefile.PL in cpan/Archive-Extract
>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>> ../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none
>> INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.so
>>> -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
>>> Warning: No Makefile!
>>> /home/bernd/.fbr/build/output/host/usr/bin/make config PERL_CORE=1
>> LIBPERL_A=libperl.so failed, continuing anyway...
>>> Making all in cpan/Archive-Extract
>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>> LIBPERL_A=libperl.so
>>> Unsuccessful make(cpan/Archive-Extract): code=-1 at make_ext.pl line 468.
>>> make[1]: *** [cpan/Archive-Extract/pm_to_blib] Fehler 22
>>> make[1]: Leaving directory `/home/bernd/.fbr/build/output/build/perl-
>> 5.16.1'
>>> make: *** [/home/bernd/.fbr/build/output/build/perl-5.16.1/.stamp_built]
>> Fehler 2
>>
>> Executing the last command alone provides this error hinting at a problem
>> with host-qemu, which I was able to solve yet.
>>
>> $ /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>> LIBPERL_A=libperl.so
>> qemu: Unsupported syscall: 240
>> qemu: Unsupported syscall: 240
>>
>> First I got this error message with Debian Squeeze i386 (virtualbox guest,
>> Win XP host), but also on Debian wheezy amd64 running non-virtualized.
>>
>> My .config can be found here: http://pastebin.com/yz1SzeB2
>> I am using buildroot as part of the FLI4L source package[1].
>>
>> Kind regards, Bernd
>>
>
> I could reproduce the lastest problem on the HEAD of Buildroot with
> qemu_x86_defconfig (which is a smaller config than your FLI4L config).
>

first, before manually running a command in the build tree, you must
set PERL_MM_OPT
   $ export PERL_MM_OPT="PERL=`pwd`/Cross/miniperl"

the error
    -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
comes from miniperl which fails with a 'system' call.

this problem could be reproduced with a simple one-liner :

$ perl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
hello
0

$ Cross/miniperl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
-1

François

> François
>
>> [1] http://www.fli4l.de/download/tarball-version/aktuell.html
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
Alexander Khryukin Nov. 6, 2012, 10:28 a.m. UTC | #6
2012/11/6 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

>
> On Tue, 06 Nov 2012 02:05:52 +0100, Arnout Vandecappelle wrote:
>
> >   Is it possible that this is because the target binary is created with
> > kernel headers 3.2, but you're running it on a host which is only 2.6.32
> > (squeeze)?  But then it should work on wheezy, because that has 3.2 as
> > well (at least since about four months IIRC).  Although...  240 on i386
> > is futex, which has existed already since long before 2.6.32.
>
> Aaah, I didn't think about this problem. This is indeed going to be
> really annoying, if the kernel headers chosen for the target have to
> somewhat match the kernel version running on the host :-(
>
> I guess this whole qemu thing for Perl is going to be annoying on the
> long term. We might need to start looking for a different option, i.e
> seeing how to get Perl to build without needing qemu.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>


I'm working in chroot. that includes headers from 3.6, but host-system is
CentOS 6.2
Francois Perrad Nov. 6, 2012, 4:23 p.m. UTC | #7
2012/11/6 François Perrad <francois.perrad@gadz.org>:
> 2012/11/5 François Perrad <francois.perrad@gadz.org>:
>> 2012/10/30 Bernd Kuhls <berndkuhls@hotmail.com>:
>>> Hi,
>>>
>>> Francois Perrad <fperrad@gmail.com> wrote in
>>> news:1350652434-32020-2-git-send-email-francois.perrad@gadz.org:
>>>
>>> currently I am testing your patchset, but I found problems during
>>> compiling, some I could solve myself:
>>>
>>>> +PERL_CONF_OPT = -des \
>>>
>>> [...]
>>>
>>>> +          -Dlibc=$(STAGING_DIR)/lib/libc.so \
>>>
>>> I had to change this line to
>>>
>>>              -Dlibc=$(STAGING_DIR)/usr/lib/libc.so.0 \
>>>
>>> for usage with uClibc 0.9.33.2
>>>
>>> [...]
>>>
>>>> +          -Uoptimize
>>>
>>> Here I had to add "-Ud_eaccess" to avoid a compilation bug.
>>>
>>> Perl will still not finish to compile, stopping with this error message:
>>>
>>>> LD_LIBRARY_PATH=/home/bernd/.fbr/build/output/build/perl-5.16.1
>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>> ./miniperl -Ilib make_ext.pl cpan/Archive-Extract/pm_to_blib
>>> MAKE=/home/bernd/.fbr/build/output/host/usr/bin/make LIBPERL_A=libperl.so
>>>>         Making Archive::Extract (all)
>>>>
>>>> Creating Makefile.PL in cpan/Archive-Extract for Archive::Extract
>>>>
>>>> Running Makefile.PL in cpan/Archive-Extract
>>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>> ../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none
>>> INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.so
>>>> -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
>>>> Warning: No Makefile!
>>>> /home/bernd/.fbr/build/output/host/usr/bin/make config PERL_CORE=1
>>> LIBPERL_A=libperl.so failed, continuing anyway...
>>>> Making all in cpan/Archive-Extract
>>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>>> LIBPERL_A=libperl.so
>>>> Unsuccessful make(cpan/Archive-Extract): code=-1 at make_ext.pl line 468.
>>>> make[1]: *** [cpan/Archive-Extract/pm_to_blib] Fehler 22
>>>> make[1]: Leaving directory `/home/bernd/.fbr/build/output/build/perl-
>>> 5.16.1'
>>>> make: *** [/home/bernd/.fbr/build/output/build/perl-5.16.1/.stamp_built]
>>> Fehler 2
>>>
>>> Executing the last command alone provides this error hinting at a problem
>>> with host-qemu, which I was able to solve yet.
>>>
>>> $ /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>>> LIBPERL_A=libperl.so
>>> qemu: Unsupported syscall: 240
>>> qemu: Unsupported syscall: 240
>>>
>>> First I got this error message with Debian Squeeze i386 (virtualbox guest,
>>> Win XP host), but also on Debian wheezy amd64 running non-virtualized.
>>>
>>> My .config can be found here: http://pastebin.com/yz1SzeB2
>>> I am using buildroot as part of the FLI4L source package[1].
>>>
>>> Kind regards, Bernd
>>>
>>
>> I could reproduce the lastest problem on the HEAD of Buildroot with
>> qemu_x86_defconfig (which is a smaller config than your FLI4L config).
>>
>
> first, before manually running a command in the build tree, you must
> set PERL_MM_OPT
>    $ export PERL_MM_OPT="PERL=`pwd`/Cross/miniperl"
>
> the error
>     -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
> comes from miniperl which fails with a 'system' call.
>
> this problem could be reproduced with a simple one-liner :
>
> $ perl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
> hello
> 0
>
> $ Cross/miniperl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
> -1
>
> François
>

after an installation on the target, this 'miniperl' works fine.
so, the problem comes from Qemu.

I write a small C example :

$ cat sys.c
#include <stdio.h>
#include <stdlib.h>

int main()
{
 	int ret = system("echo hello");
	printf("%d\n", ret);
}

$ ../../host/usr/bin/i686-buildroot-linux-uclibc-gcc -o sys sys.c
$ file sys
sys: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
$ ../../host/usr/bin/qemu-i386 ./sys
-1

I also try on various architecture.
I build Perl successfully with qemu-arm and qemu-mips,
the problem occurs with qemu-i386 and qemu-x86_64,
with a qemu-i386 version 1.2.0 built with Buildroot and with a
qemu-i386 version 1.0.50 which comes my distro Ubuntu 12.04 LTS.

Other bad new, these days, the homepage of Qemu (http://wiki.qemu.org) is down.

François

>> François
>>
>>> [1] http://www.fli4l.de/download/tarball-version/aktuell.html
>>>
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot@busybox.net
>>> http://lists.busybox.net/mailman/listinfo/buildroot
Bernd Kuhls Nov. 6, 2012, 9:03 p.m. UTC | #8
Arnout Vandecappelle <arnout@mind.be> wrote in 
news:50986270.4070804@mind.be:

>   Is it possible that this is because the target binary is created with
> kernel headers 3.2, but you're running it on a host which is only 2.6.32
> (squeeze)?  But then it should work on wheezy, because that has 3.2 as
> well (at least since about four months IIRC).  Although...  240 on i386
> is futex, which has existed already since long before 2.6.32.

Hi,

on wheezy I am using kernel 3.5.5.

$ LC_ALL=C apt-cache policy linux-image-3.5-trunk-amd64
linux-image-3.5-trunk-amd64:
  Installed: 3.5.5-1~experimental.1
  Candidate: 3.5.5-1~experimental.1

Kind regards, Bernd
Bernd Kuhls Nov. 6, 2012, 9:09 p.m. UTC | #9
Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
@public.gmane.org> wrote in news:20121106080812.4e7bd01a@skate:

> I guess this whole qemu thing for Perl is going to be annoying on the
> long term. We might need to start looking for a different option, i.e
> seeing how to get Perl to build without needing qemu.

Hi,

maybe this can be of help: http://perlcross.berlios.de/

Kind regards, Bernd

PS: The reason I am fiddling around with Perl is to compile 
Mail::Spamassassin which needs a lot of other modules.
Arnout Vandecappelle Nov. 6, 2012, 10:59 p.m. UTC | #10
On 06/11/12 22:09, Bernd Kuhls wrote:
> Thomas Petazzoni<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
> @public.gmane.org>  wrote in news:20121106080812.4e7bd01a@skate:
>
>> I guess this whole qemu thing for Perl is going to be annoying on the
>> long term. We might need to start looking for a different option, i.e
>> seeing how to get Perl to build without needing qemu.
>
> Hi,
>
> maybe this can be of help: http://perlcross.berlios.de/

  That sounds like a terrific idea!  Do you feel up to integrating this in
buildroot and sending a patch?

  Regards,
  Arnout
Bernd Kuhls Nov. 7, 2012, 7:32 p.m. UTC | #11
Arnout Vandecappelle <arnout@mind.be> wrote in 
news:50999637.1090305@mind.be:

>> maybe this can be of help: http://perlcross.berlios.de/
> 
>   That sounds like a terrific idea!  Do you feel up to integrating this in
> buildroot and sending a patch?

Unfortunately not due to lack of skill :(
Arnout Vandecappelle Nov. 8, 2012, 3:04 p.m. UTC | #12
On 11/07/12 20:32, Bernd Kuhls wrote:
> Arnout Vandecappelle<arnout@mind.be>  wrote in
> news:50999637.1090305@mind.be:
>
>>> maybe this can be of help: http://perlcross.berlios.de/
>>
>>    That sounds like a terrific idea!  Do you feel up to integrating this in
>> buildroot and sending a patch?
>
> Unfortunately not due to lack of skill :(

  In that case, I'll try to take a look at it this evening.

  We really need to get this perl mess fixed for the 2012.11 release...

  (Francois, with that I don't want to imply that you did a bad job. On the
contrary, getting the build with qemu running was an important step even if
it will have to be replaced eventually.)

  Regards,
  Arnout
Francois Perrad Nov. 8, 2012, 6:02 p.m. UTC | #13
2012/11/6 François Perrad <francois.perrad@gadz.org>:
> 2012/11/6 François Perrad <francois.perrad@gadz.org>:
>> 2012/11/5 François Perrad <francois.perrad@gadz.org>:
>>> 2012/10/30 Bernd Kuhls <berndkuhls@hotmail.com>:
>>>> Hi,
>>>>
>>>> Francois Perrad <fperrad@gmail.com> wrote in
>>>> news:1350652434-32020-2-git-send-email-francois.perrad@gadz.org:
>>>>
>>>> currently I am testing your patchset, but I found problems during
>>>> compiling, some I could solve myself:
>>>>
>>>>> +PERL_CONF_OPT = -des \
>>>>
>>>> [...]
>>>>
>>>>> +          -Dlibc=$(STAGING_DIR)/lib/libc.so \
>>>>
>>>> I had to change this line to
>>>>
>>>>              -Dlibc=$(STAGING_DIR)/usr/lib/libc.so.0 \
>>>>
>>>> for usage with uClibc 0.9.33.2
>>>>
>>>> [...]
>>>>
>>>>> +          -Uoptimize
>>>>
>>>> Here I had to add "-Ud_eaccess" to avoid a compilation bug.
>>>>
>>>> Perl will still not finish to compile, stopping with this error message:
>>>>
>>>>> LD_LIBRARY_PATH=/home/bernd/.fbr/build/output/build/perl-5.16.1
>>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>>> ./miniperl -Ilib make_ext.pl cpan/Archive-Extract/pm_to_blib
>>>> MAKE=/home/bernd/.fbr/build/output/host/usr/bin/make LIBPERL_A=libperl.so
>>>>>         Making Archive::Extract (all)
>>>>>
>>>>> Creating Makefile.PL in cpan/Archive-Extract for Archive::Extract
>>>>>
>>>>> Running Makefile.PL in cpan/Archive-Extract
>>>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>>> ../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none
>>>> INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.so
>>>>> -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
>>>>> Warning: No Makefile!
>>>>> /home/bernd/.fbr/build/output/host/usr/bin/make config PERL_CORE=1
>>>> LIBPERL_A=libperl.so failed, continuing anyway...
>>>>> Making all in cpan/Archive-Extract
>>>>> /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>>>> LIBPERL_A=libperl.so
>>>>> Unsuccessful make(cpan/Archive-Extract): code=-1 at make_ext.pl line 468.
>>>>> make[1]: *** [cpan/Archive-Extract/pm_to_blib] Fehler 22
>>>>> make[1]: Leaving directory `/home/bernd/.fbr/build/output/build/perl-
>>>> 5.16.1'
>>>>> make: *** [/home/bernd/.fbr/build/output/build/perl-5.16.1/.stamp_built]
>>>> Fehler 2
>>>>
>>>> Executing the last command alone provides this error hinting at a problem
>>>> with host-qemu, which I was able to solve yet.
>>>>
>>>> $ /home/bernd/.fbr/build/output/build/perl-5.16.1/Cross/run-qemu-i386
>>>> /home/bernd/.fbr/build/output/host/usr/bin/make all PERL_CORE=1
>>>> LIBPERL_A=libperl.so
>>>> qemu: Unsupported syscall: 240
>>>> qemu: Unsupported syscall: 240
>>>>
>>>> First I got this error message with Debian Squeeze i386 (virtualbox guest,
>>>> Win XP host), but also on Debian wheezy amd64 running non-virtualized.
>>>>
>>>> My .config can be found here: http://pastebin.com/yz1SzeB2
>>>> I am using buildroot as part of the FLI4L source package[1].
>>>>
>>>> Kind regards, Bernd
>>>>
>>>
>>> I could reproduce the lastest problem on the HEAD of Buildroot with
>>> qemu_x86_defconfig (which is a smaller config than your FLI4L config).
>>>
>>
>> first, before manually running a command in the build tree, you must
>> set PERL_MM_OPT
>>    $ export PERL_MM_OPT="PERL=`pwd`/Cross/miniperl"
>>
>> the error
>>     -1 from cpan/Archive-Extract's Makefile.PL at make_ext.pl line 409.
>> comes from miniperl which fails with a 'system' call.
>>
>> this problem could be reproduced with a simple one-liner :
>>
>> $ perl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
>> hello
>> 0
>>
>> $ Cross/miniperl -e "my \$code = system( q(echo), q(hello) ); print(\$code);"
>> -1
>>
>> François
>>
>
> after an installation on the target, this 'miniperl' works fine.
> so, the problem comes from Qemu.
>
> I write a small C example :
>
> $ cat sys.c
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
>         int ret = system("echo hello");
>         printf("%d\n", ret);
> }
>
> $ ../../host/usr/bin/i686-buildroot-linux-uclibc-gcc -o sys sys.c
> $ file sys
> sys: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
> dynamically linked (uses shared libs), not stripped
> $ ../../host/usr/bin/qemu-i386 ./sys
> -1
>
> I also try on various architecture.
> I build Perl successfully with qemu-arm and qemu-mips,
> the problem occurs with qemu-i386 and qemu-x86_64,
> with a qemu-i386 version 1.2.0 built with Buildroot and with a
> qemu-i386 version 1.0.50 which comes my distro Ubuntu 12.04 LTS.
>
> Other bad new, these days, the homepage of Qemu (http://wiki.qemu.org) is down.
>

bug report filled, see https://bugs.launchpad.net/qemu/+bug/1076445

François

> François
>
>>> François
>>>
>>>> [1] http://www.fli4l.de/download/tarball-version/aktuell.html
>>>>
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot@busybox.net
>>>> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index f308de7..00a79ab 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -262,6 +262,7 @@  source "package/wsapi/Config.in"
 source "package/xavante/Config.in"
 endmenu
 endif
+source "package/perl/Config.in"
 source "package/microperl/Config.in"
 source "package/php/Config.in"
 source "package/python/Config.in"
diff --git a/package/perl/Config.in b/package/perl/Config.in
new file mode 100644
index 0000000..0a41a97
--- /dev/null
+++ b/package/perl/Config.in
@@ -0,0 +1,18 @@ 
+config BR2_PACKAGE_PERL
+	bool "perl"
+	depends on !BR2_avr32
+	depends on !BR2_bfin
+	depends on !BR2_sh2
+	depends on !BR2_sh2a
+	depends on !BR2_sh3
+	depends on !BR2_sh3eb
+	depends on !BR2_sh64
+	help
+	  Larry Wall's Practical Extraction and Report Language
+	  An interpreted scripting language, known among some as "Unix's Swiss
+	  Army Chainsaw".
+
+	  http://www.perl.org/
+
+comment "perl requires an architecture supported by qemu"
+	depends on BR2_avr32 || BR2_bfin || BR2_sh2 || BR2_sh2a || BR2_sh3 || BR2_sh3eb || BR2_sh64
diff --git a/package/perl/perl-configure-qemu.patch b/package/perl/perl-configure-qemu.patch
new file mode 100644
index 0000000..c2d6b92
--- /dev/null
+++ b/package/perl/perl-configure-qemu.patch
@@ -0,0 +1,53 @@ 
+Add qemu support
+
+see https://rt.perl.org/rt3//Public/Bug/Display.html?id=114798
+
+Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+
+Index: b/Configure
+===================================================================
+--- a/Configure
++++ b/Configure
+@@ -2837,6 +2837,9 @@
+             ;;
+         *)  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
+@@ -2868,7 +2871,7 @@
+ 	case "$targetfrom" in
+ 	'') targetfrom=scp ;;
+ 	esac
+-    	run=$run-$targetrun
++    	run=$run-`basename $targetrun`
+     	to=$to-$targetto
+     	from=$from-$targetfrom
+ 	case "$targetdir" in
+@@ -2908,6 +2911,14 @@
+ $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
+ 	    ;;
+@@ -5048,7 +5059,7 @@
+ 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:";
diff --git a/package/perl/perl-make-ext.patch b/package/perl/perl-make-ext.patch
new file mode 100644
index 0000000..e0195e7
--- /dev/null
+++ b/package/perl/perl-make-ext.patch
@@ -0,0 +1,24 @@ 
+Don't use RUN with make (only for perl)
+
+Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+
+Index: b/make_ext.pl
+===================================================================
+--- a/make_ext.pl
++++ b/make_ext.pl
+@@ -458,11 +458,13 @@
+ 	# Give makefile an opportunity to rewrite itself.
+ 	# reassure users that life goes on...
+ 	my @args = ('config', @$pass_through);
+-	system(@run, @make, @args) and print "@run @make @args failed, continuing anyway...\n";
++#	system(@run, @make, @args) and print "@run @make @args failed, continuing anyway...\n";
++	system(@make, @args) and print "@make @args failed, continuing anyway...\n";
+     }
+     my @targ = ($target, @$pass_through);
+     print "Making $target in $ext_dir\n@run @make @targ\n";
+-    my $code = system(@run, @make, @targ);
++#    my $code = system(@run, @make, @targ);
++    my $code = system(@make, @targ);
+     die "Unsuccessful make($ext_dir): code=$code" if $code != 0;
+ 
+     chdir $return_dir || die "Cannot cd to $return_dir: $!";
diff --git a/package/perl/perl-mkppport.patch b/package/perl/perl-mkppport.patch
new file mode 100644
index 0000000..97f27a2
--- /dev/null
+++ b/package/perl/perl-mkppport.patch
@@ -0,0 +1,37 @@ 
+Add RUN
+
+Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+
+Index: b/mkppport
+===================================================================
+--- a/mkppport
++++ b/mkppport
+@@ -1,6 +1,7 @@
+ use strict;
+ use warnings;
+ 
++use Config;
+ use Getopt::Long;
+ use File::Spec;
+ use File::Compare qw( compare );
+@@ -136,14 +137,18 @@
+ #----------------------------------------------
+ sub run
+ {
++  my @run = $Config{run};
++  @run = () if not defined $run[0] or $run[0] eq '';
+   my @args = ("-I" . File::Spec->catdir((File::Spec->updir) x 2, 'lib'), @_);
+   my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;
+   for (@args) {
+     $_ = qq("$_") if $^O eq 'VMS' && /^[^"]/;
+     $run .= " $_";
+   }
+-  print "running $run\n";
+-  system $run and die "$run failed: $?\n";
++#  print "running $run\n";
++#  system $run and die "$run failed: $?\n";
++  print "running ", join(' ', @run, $run), "\n";
++  system join(' ', @run, $run) and die "@run $run failed: $?\n";
+ }
+ 
+ __END__
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
new file mode 100644
index 0000000..7ac1aed
--- /dev/null
+++ b/package/perl/perl.mk
@@ -0,0 +1,99 @@ 
+#############################################################
+#
+# perl
+#
+#############################################################
+
+PERL_VERSION_MAJOR = 16
+PERL_VERSION = 5.$(PERL_VERSION_MAJOR).1
+PERL_SITE = http://www.cpan.org/src/5.0
+PERL_SOURCE = perl-$(PERL_VERSION).tar.bz2
+PERL_LICENSE = Artistic
+PERL_LICENSE_FILES = Artistic
+PERL_INSTALL_STAGING = YES
+PERL_DEPENDENCIES = host-qemu
+
+PERL_CONF_OPT = -des \
+		-Dusecrosscompile \
+		-Dtargetrun=$(QEMU_USER) \
+		-Dqemulib=$(STAGING_DIR) \
+		-Dar="$(TARGET_AR)" \
+		-Dcc="$(TARGET_CC)" \
+		-Dcpp="$(TARGET_CC)" \
+		-Dld="$(TARGET_LD)" \
+		-Dnm="$(TARGET_NM)" \
+		-Dranlib="$(TARGET_RANLIB)" \
+		-Dccflags="$(TARGET_CFLAGS)" \
+		-Dldflags="$(TARGET_LDFLAGS) -lgcc_s -lm" \
+		-Dlddlflags="-shared" \
+		-Dlibc=$(STAGING_DIR)/lib/libc.so \
+		-Duseshrplib \
+		-Dprefix=/usr \
+		-Uoptimize
+
+ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
+    PERL_CONF_OPT += -Dusedevel
+endif
+
+ifneq ($(BR2_LARGEFILE),y)
+    PERL_CONF_OPT += -Uuselargefiles
+endif
+
+define PERL_CONFIGURE_CMDS
+	rm -f $(@D)/config.sh
+	(cd $(@D); ./Configure $(PERL_CONF_OPT))
+	echo "# patched values"                                 >>$(@D)/config.sh
+	$(SED) '/^myarchname=/d' \
+		-e '/^mydomain=/d' \
+		-e '/^myhostname=/d' \
+		-e '/^myuname=/d' \
+		-e '/^osname=/d' \
+		-e '/^osvers=/d' \
+		-e '/^perladmin=/d' \
+		$(@D)/config.sh
+	echo "myarchname='$(GNU_TARGET_NAME)'"                  >>$(@D)/config.sh
+	echo "mydomain=''"                                      >>$(@D)/config.sh
+	echo "myhostname='$(BR2_TARGET_GENERIC_HOSTNAME)'"      >>$(@D)/config.sh
+	echo "myuname='Buildroot $(BR2_VERSION_FULL)'"          >>$(@D)/config.sh
+	echo "osname='linux'"                                   >>$(@D)/config.sh
+	echo "osvers='$(BR2_LINUX_KERNEL_VERSION)'"             >>$(@D)/config.sh
+	echo "perladmin='root'"                                 >>$(@D)/config.sh
+	(cd $(@D); ./Configure -S)
+	cp $(@D)/config.h $(@D)/xconfig.h
+	$(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
+endef
+
+define PERL_BUILD_CMDS
+	echo "#!/bin/sh"                                > $(@D)/Cross/miniperl
+	echo "$(QEMU_USER) $(@D)/miniperl \"\$$@\""     >>$(@D)/Cross/miniperl
+	chmod +x $(@D)/Cross/miniperl
+	PERL_MM_OPT="PERL=$(@D)/Cross/miniperl" \
+		$(MAKE) -C $(@D) all
+endef
+
+define PERL_INSTALL_STAGING_CMDS
+	$(MAKE) INSTALL_DEPENDENCE= \
+		INSTALLFLAGS= \
+		DESTDIR="$(STAGING_DIR)" \
+		-C $(@D) install.perl
+endef
+
+PERL_RUN_PERL = $(QEMU_USER) $(@D)/perl -Ilib
+PERL_ARCHNAME = $(shell $(PERL_RUN_PERL) -MConfig -e "print Config->{archname}")
+PERL_LIB = $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)
+PERL_ARCHLIB = $(PERL_LIB)/$(PERL_ARCHNAME)
+
+define PERL_INSTALL_TARGET_CMDS
+	$(MAKE) INSTALL_DEPENDENCE= \
+		INSTALLFLAGS=-p \
+		DESTDIR="$(TARGET_DIR)" \
+		-C $(@D) install.perl
+	rm -f $(PERL_ARCHLIB)/CORE/*.h
+	find $(PERL_ARCHLIB) -type f -name *.bs -exec rm -f {} \;
+endef
+
+define PERL_CLEAN_CMDS
+	-$(MAKE) -C $(@D) clean
+endef
+
+$(eval $(generic-package))