1 (edited by frol 2008-03-21 06:20:45)

Topic: Full Perl packages avail for testing

I built full-blown Perl distribution for OpenWrt/mipsel.
Prebuilt packages (tested on WR RC4) for anyone interested:

ftp://ftp.riss-telecom.ru/pub/openwrt/l … ages/perl/

Edit: You probably will want to install perl_5.8.7-1_mipsel.ipk and perlbase-essential_5.8.7-1_mipsel.ipk in the first place

Package sources (including packages for some perl modules):

ftp://ftp.riss-telecom.ru/pub/openwrt/l … 117.tar.gz

To build from sources using OpenWrt SDK:

tar xjvf OpenWrt-SDK-Linux-i686-1.tar.bz2
tar xzvf package-20060117.tar.gz
mv openwrt/package/perl* openwrt/package/libdb openwrt/package/libgdbm OpenWrt-SDK-Linux-i686-1/package/
cd OpenWrt-SDK-Linux-i686-1
make libdb-compile libgdbm-compile perl-compile

Package sources currently lack Config.in files and doesn't generate dependencies.
Suggestions, bug reports and patches are welcome.

Update: Read this: ftp://ftp.riss-telecom.ru/pub/openwrt/local/README.perl

Update: LWP, URI and HTML modules by Peter Colberg: http://www.cip.ifi.lmu.de/~colberg/OpenWRT/package/  http://www.cip.ifi.lmu.de/~colberg/Open … /packages/

[s]Update: Want to maintain perl for openwrt? Email me using E-Mail link on the left.[/s]

Update: Packages at ftp.riss-telecom.ru are obsolete. Use packages from Peter Colberg: http://forum.openwrt.org/viewtopic.php?pid=52600#p52600

Re: Full Perl packages avail for testing

Good timing. I was just thinking about this this morning. I was trying to figure out how to use Kismet::Client and Net::Kismet with microperl.

Re: Full Perl packages avail for testing

Nice...

I will try to compile owperl (a module to the owfs-package) and see if I have any comments or suggestions to your package.
So far I have compiled the extensions owphp and owtcl with success.

/Christian

Re: Full Perl packages avail for testing

frol wrote:

I built full-blown Perl distribution for OpenWrt/mipsel.
Prebuilt packages (tested on WR RC4) for anyone interested:

Works great on WRTSL54GS. Took a bit of trail and error to get just the right batch of the modules installed.
I needed the newer Math::Trig and Math::Complex so I just copied CPAN over frol's.

http://gpsd.davisnetworks.com/bin/view/ … tWRTSL54GS

Thanks!
Mike

Re: Full Perl packages avail for testing

Help!
  I've been trying to get Perl running on OpenWRT.  I've installed all the packages above.  When I try to use CPAN to grab a module I get:

Untagged opnames: ne i_le scalar pushmark print vec trans regcreset substcont gnetent fttext i_predec dofile ftsize stat entereval setpriority backtick eof bit_or tied ehostent i_subtract system shmget time custom ftbinary ftrwrite getpriority enterwrite leaveeval readline enterloop ord concat sservent gsbyport bless wait seekdir ftdir exists ghostent ftfile ftewrite flop substr kill lineseq readdir stringify gprotoent seq exp ioctl gpwnam values eservent negate subst shift hex add sprotoent msgctl gv postdec msgrcv modulo epwent aelem rv2av goto accept ftrexec lc schomp i_postdec atan2 regcmaybe fcntl sysread closedir study list semctl setstate ref match abs pushre tell rcatline repeat leave sysopen int rv2hv fteowned flip syswrite glob pos i_modulo gservent gnbyaddr bit_xor syscall chr ftblk shmctl semop gnbyname orassign subtract mkdir ftzero leavewrite lstat regcomp lock multiply getc fileno leavesub msgget ftsock prototype exec sselect srand sockpair defined telldir ftsgid enter cond_expr reverse entersub aassign setpgrp send rv2sv gsockopt crypt symlink gpwuid log dbmopen hslice ftrowned i_ncmp leavetry return pow enetent msgsnd ftmtime dbmclose seek anoncode sqrt le anonhash getppid rename ghbyaddr sge chop i_preinc snetent caller schop wantarray each undef ftctime open ggrnam flock scmp qr delete i_lt rindex and getpeername ge quotemeta aslice i_ge tms divide die unshift ftchr open_dir uc warn helem last truncate predec i_gt ncmp ftsvtx threadsv getlogin length index sort xor chdir gt shmwrite prtf require next shmread ggrent exit ggrgid ftis egrent unlink ghbyname padav split right_shift null sin push gelem dbstate sle pack getpgrp padhv gsbyname pipe_op andassign keys gpbyname grepstart close ftrread lslice unstack select ssockopt formline leaveloop i_eq leavesublv gmtime chmod i_negate fork splice rewinddir postinc ftlink spwent refgen sgt sassign entertry not getsockname i_ne padsv listen mapwhile eq scope localtime lcfirst enteriter sgrent chown join const av2arylen ftsuid sne nextstate fttty shostent rv2cv range untie unpack method_named gvsv padany alarm method oct rv2gv tie fteread binmode i_add waitpid semget ucfirst pop bit_and redo fteexec ftpipe rmdir sysseek or shutdown eprotoent read gpwent i_multiply iter chroot stub i_divide readlink bind socket lt srefgen preinc utime recv anonlist grepwhile dump cos reset left_shift sprintf connect link aelemfast rand ftatime gpbynumber slt i_postinc complement chomp mapstart umask sleep

I answer all the prompts and then get the error:

Can't locate object method "maybe_command" via package "MM" at /usr/lib/perl5/5.8/CPAN/FirstTime.pm line 517, <STDIN> line 9.

Any thoughts?

Re: Full Perl packages avail for testing

Well I rebuilt Perl using the package files above, and the whiterussian RC5 SDK.  Rather than reinstall the packages, I just tarred and copied over the whole output directory.  Things seem to be working now . . . sort of.  I need more modules.  : )

7 (edited by frol 2006-05-13 07:52:02)

Re: Full Perl packages avail for testing

Here are some common questions and answers:

ftp://ftp.riss-telecom.ru/pub/openwrt/local/README.perl

If anyone wants to take maintainership over perl packages, mail me using "E-Mail" link on the left.

8 (edited by ggp81 2007-05-16 16:59:24)

Re: Full Perl packages avail for testing

Problem concerning Perl, and not strictly OpenWrt.
I installed frol's Perl on WRT54GL with WhiteRussian and works great.
I am trying now to install it on Compex WP54 main board (so under Kamikaze)

At first Perl didn't work.
On WRT54GL i had both usr/bin/perl5.8.7 and usr/bin/perl files (I think the second to be just a link). But on WP54 I had just /usr/bin/perl5.8.7. So I typed

root@OpenWrt:~# cd /usr/bin/
root@OpenWrt:/usr/bin# ln perl5.8.7 perl

And Perl now works right.
I installed also the following modules:

perlbase-autoloader - 5.8.7-1 -
perlbase-config - 5.8.7-1 -
perlbase-cpan - 5.8.7-1 -
perlbase-dynaloader - 5.8.7-1 -
perlbase-errno - 5.8.7-1 -
perlbase-essential - 5.8.7-1 -
perlbase-getopt - 5.8.7-1 -
perlbase-io - 5.8.7-1 -
perlbase-selectsaver - 5.8.7-1 -
perlbase-socket - 5.8.7-1 -
perlbase-symbol - 5.8.7-1 -
perlbase-time - 5.8.7-1 -
perlbase-xsloader - 5.8.7-1 -

But they seem not to work, because I am getting errors like:

Can't locate loadable object for module Time::HiRes in @INC (@INC contains: /usr/lib/perl5/5.8 .) at FILE_NAME line 13

I am a newbie of Perl, I would like to know how Perl loads its modules. Maybe it would be enough for me to solve my problem.
Thanks

9 (edited by ggp81 2007-05-17 11:57:40)

Re: Full Perl packages avail for testing

root@OpenWrt:~# perl -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=mipsel-linux, osvers=, archname=mipsel-linux-uclibc
    uname='linux wrtdev 2.4.27-1-386 #1 fri sep 3 06:24:46 utc 2004 i686 gnulinux '
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc', ccflags ='-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time  -DUSE_CROSS_COMPILE -I/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include -I/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include',
    optimize='-O',
    cppflags='-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time  -DUSE_CROSS_COMPILE -I/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include -I/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include'
    ccversion='', gccversion='3.4.4', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc', ldflags ='-rdynamic -L/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib -L/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib'
    libpth=/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib /home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib
    libs=-lgdbm -ldb -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/home/frol/openwrt/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-shared -rdynamic -L/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib -L/home/frol/openwrt/WR-RC4/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under mipsel-linux
  Compiled at May  8 2007 13:20:38
  @INC:
    /usr/lib/perl5/5.8
    .
root@OpenWrt:~# cd /usr/lib/perl5/5.8/
root@OpenWrt:/usr/lib/perl5/5.8# ls
AutoLoader.pm    Carp.pm          Errno.pm         HiRes.pm         Socket.pm        auto             newgetopt.pl     vars.pm
CPAN             Config.pm        Exporter         IO               Symbol.pm        constant.pm      overload.pm      warnings
CPAN.pm          Config_heavy.pl  Exporter.pm      IO.pm            Time             lib.pm           strict.pm        warnings.pm
Carp             DynaLoader.pm    Getopt           SelectSaver.pm   XSLoader.pm      locale.pm        subs.pm
root@OpenWrt:/usr/lib/perl5/5.8# ls Time/
HiRes.pm      Local.pm      gmtime.pm     localtime.pm  tm.pm
root@OpenWrt:/usr/lib/perl5/5.8# uname -a
Linux OpenWrt 2.6.19.2 #1 Mon May 7 11:08:29 SGT 2007 mips unknown

I compiled Perl for 2.4 Kernel and now i'm using a 2.6, but I don't think that's a problem. Interpreter seems to run correctly pl scripts without "use" directive

Re: Full Perl packages avail for testing

Well, it was a kernel problem!

Re: Full Perl packages avail for testing

Is the package simple.pm available?

Re: Full Perl packages avail for testing

I have managed to compile the owperl-module (a part of OWFS) with your perl packages.

The owfs and perl-packages are available at: http://owfs.sourceforge.net/openwrt/packages
if someone wants to try it.  (I have only tried it on a WRT54G with whiterussian 0.9.)



root@repeater3:~# ipkg install owfs

root@repeater3:~# ipkg install owperl
Installing owperl (2.6p5-14) to root...
Downloading http://home.mag.cx/openwrt/packages/./owperl_2.6p5-14_mipsel.ipk
Installing perl (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perl_5.8.7-1_mipsel.ipk
Installing perlbase-autoloader (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perlbase-autoloader_5.8.7-1_mipsel.ipk
Installing perlbase-config (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perlbase-config_5.8.7-1_mipsel.ipk
Installing perlbase-dynaloader (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perlbase-dynaloader_5.8.7-1_mipsel.ipk
Installing perlbase-essential (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perlbase-essential_5.8.7-1_mipsel.ipk
Installing perlbase-io (5.8.7-1) to root...
Downloading http://home.mag.cx/openwrt/packages/./perlbase-io_5.8.7-1_mipsel.ipk
Configuring owperl
Configuring perl
Configuring perlbase-autoloader
Configuring perlbase-config
Configuring perlbase-dynaloader
Configuring perlbase-essential
Configuring perlbase-io
Successfully terminated.
root@repeater3:~#


root@repeater3:~# echo 'OPTIONS="-p 3002 --fake 28 --fake 10"' >> /etc/default/owserver
root@repeater3:~# run-owfs
Using /lib/modules/2.4.30/fuse.o
root@repeater3:~# cat test1.pl 
#!/usr/bin/perl

use OW;
print "Version: ".OW::version."\n";
print OW::init("localhost:3002")."\n";
print "dir: ".OW::get("/")."\n";
print OW::get("10.67C6697351FF/temperature")."\n";
OW::finish();

root@repeater3:~# ./test1.pl 
Version: 2.6p5
1
dir: structure/,bus.0/,uncached/,settings/,system/,statistics/,28.4AEC29CDBAAB/,10.67C6697351FF/,alarm/,simultaneous/
     36.4784
root@repeater3:~#

Thanks for the help with the perl-package!

/Christian

13 (edited by ggp81 2007-06-15 08:50:57)

Re: Full Perl packages avail for testing

I tried to compile Perl on Kamikaze+2.6 kernel and it seems to be unstable sad
If someone is able to build a stable version of Perl on Kamikaze with 2.6 kernel, I would appreciate if he/she could drop me an e-mail. I am afraid the problem is dealing with Kamikaze or Kernel and not with Perl itself sad

Re: Full Perl packages avail for testing

ggp81 wrote:

I tried to compile Perl on Kamikaze+2.6 kernel and it seems to be unstable sad

Do you have any Makefiles for Kamikaze that I could use?

/Christian

Re: Full Perl packages avail for testing

I asked the question elsewhere, but I think this thread is a better place. Can someone help me with adding CRC32 module to perl. Hopefully, build it - since I am a little scared of building perl myself, or give noobie instructions how to do that.

I had buildroot installed; but I was afraid to brick the router and leave the family without phone or internet - so I waited for kamikaze binaries hmm Also, frol's instructions leave me with more questions than answers.

TIA

16 (edited by peterco 2007-07-28 15:19:23)

Re: Full Perl packages avail for testing

Just a quick note regarding perl packages for kamikaze...

For whiterussian, I had previously ported frol's perl makefiles (2006-03-20)
to the new buildroot, and introduced a preliminary dependency scanning
mechanism to generate proper dependencies for the perlbase-* packages and
third-party CPAN module packages.

Now that others have already been successful[1] in compiling perl for kamikaze
using my adjusted makefiles, I added support for all architectures currently
in kamikaze. Thus, perl packages are no longer not only available for mipsel,
but also for armeb, mips, powerpc and i386 (and arm, once a prebuilt kamikaze
SDK is released for this arch).

Lacking time and hardware, I have not tested these packages[2] yet, so all
reports on success or failure are welcome. Please note that the dependencies
between perlbase-* packages might be a little too strict in a few cases
(especially regarding perlbase-unicore), so a little experimentation with
"ipkg -force-depends" might be helpful to save space.

For building your own custom CPAN module packages, have a look at the existing
perl-* module packages in my source tree[3], which can be checked out with
darcs[4].

Peter

[1] http://forum.openwrt.org/viewtopic.php?id=10117
[2] http://www.cip.ifi.lmu.de/~colberg/openwrt/bin/
[3] http://www.cip.ifi.lmu.de/~colberg/openwrt/packages/
[4] http://darcs.net/

17 (edited by kazor 2007-07-25 21:26:29)

Re: Full Perl packages avail for testing

Great work Frol,

Thanks to your efforts, i've managed to decomission a pc and cut 100w power usage.

The perl is now happily running on a usb key expanded r100/wl500g with openwrt RC5 !

Thanks

Kazor

Re: Full Perl packages avail for testing

peterco wrote:

Just a quick note regarding perl packages for kamikaze...

For whiterussian, I had previously ported frol's perl makefiles (2006-03-20)
to the new buildroot, and introduced a preliminary dependency scanning
mechanism to generate proper dependencies for the perlbase-* packages and
third-party CPAN module packages.

I think you should modify your files/config.sh-*-linux-uclibc.in files and make sure they really works under 2.6-kernels.
I guess you have used the makefiles under http://www.cip.ifi.lmu.de/~colberg/open … erl/files/ , and I doubt they will work correctly according to some old posts. (Look at http://forum.openwrt.org/viewtopic.php?id=10944 )

Some math-functions doesn't work under mipsel 2.6-kernels. You should really look more into the "fpossize" variable and think if size "24" in config.sh-mipsel-linux-uclibc.in is a good value. When I changed this to "4" + changed u32align, the math-functions seemed to work correctly.
d_u32align='define'
fpossize='4'

The Time:HiRes module need some config-vars to be defined, since it tries to compile, link and run some test-programs to verify existence of nanosleep() for example, and it doesn't work while cross-compiling perl.
# Fix problem with HiRes timer.
d_nanosleep='define'
d_clock_gettime='define'
d_clock_getres='define'
d_clock_nanosleep='define'
d_clock='define'

I can't promise these change will be good for all platforms, but I hope you could change and verify it for mipsel at least.

/Christian

Re: Full Perl packages avail for testing

Hello Christian,

d1mag wrote:

I think you should modify your files/config.sh-*-linux-uclibc.in files and make sure they really works under 2.6-kernels.
I guess you have used the makefiles under http://www.cip.ifi.lmu.de/~colberg/open … erl/files/ ,

Yes, all my packages are compiled exactly from these sources.

and I doubt they will work correctly according to some old posts. (Look at http://forum.openwrt.org/viewtopic.php?id=10944 )

Some math-functions doesn't work under mipsel 2.6-kernels. You should really look more into the "fpossize" variable and think if size "24" in config.sh-mipsel-linux-uclibc.in is a good value. When I changed this to "4" + changed u32align, the math-functions seemed to work correctly.
d_u32align='define'
fpossize='4'

Following the above-mentioned post, I tested the included perl snippet with official images of kamikaze 7.07 for the platforms brcm-2.4 and brcm47xx-2.6 (on a WRT54Gv4), using my kamikaze perl packages. Contrary to the result described in the post, the correct values were printed.

In conclusion, I believe the problems experienced might be related to a uClibc version mismatch between compile time and runtime. Maybe the above poster tried running a perl binary compiled for whiterussian on kamikaze, or (taking a wild guess, for someone who has not followed the development of kamikaze) one for an older version of kamikaze on a newer version with major uClibc ABI changes?

(I tested my whiterussian perl package on brcm47xx-2.6, and promptly received a "bus error" executing the above script. However, the perl package compiled with a kamikaze brcm-2.4 SDK worked fine on brcm47xx-2.6, as expected.)

Using the original define of fpossize='24' in the config.sh template, have there been any other math test cases which failed for you?


The Time:HiRes module need some config-vars to be defined, since it tries to compile, link and run some test-programs to verify existence of nanosleep() for example, and it doesn't work while cross-compiling perl.
# Fix problem with HiRes timer.
d_nanosleep='define'
d_clock_gettime='define'
d_clock_getres='define'
d_clock_nanosleep='define'
d_clock='define'

I can't promise these change will be good for all platforms, but I hope you could change and verify it for mipsel at least.

/Christian

Thanks, I added these defines to all config.sh templates (and subsequently uploaded new perl packages, version 5.8.8-2).

Regards,
Peter

Re: Full Perl packages avail for testing

First of all, a big thanks to frol and peterco for doing the great work on getting perl on OpenWrt.

I needed to get IPv6 multicast working in OpenWrt, so I've done the legwork to create the necessary packages.
Binaries and patches (packages):
http://www.cs.drexel.edu/~ib29/dev/openwrt/

I've tested this on whiterussian, but not kamikaze yet.  Any comments welcome.

Re: Full Perl packages avail for testing

As Perl now looks like to be pretty stable on all platform tested, we could ask the inclusion on the Buildroot by opening a ticket. Couldn't we?

22 (edited by mlilien 2007-10-02 22:19:42)

Re: Full Perl packages avail for testing

Hi,

i succesfully builded perl for kamikaze from petercos sources. But I got into trouble after that.
Now the perl-scripts from kamikazes build system use the new builded host-perl, not my system-perl anymore.
The Problem is that the environment of the host-perl is corrupted and searches for modules in /usr/local/lib/perl...
When I add "-Dprefix=$(STAGING_DIR)/usr" to  the Configure options in Stage 1, the host-perl searches for
its modules in $(STAGING_DIR)/usr/lib/perl5/5.8.8/... .
This is wrong too, the modules are actually installed in $(STAGING_DIR)/usr/lib/perl5/5.8/...
Is there a way to fix that or to prevent kamikaze from using the new builded host-perl?

Regards,
Marcel

Re: Full Perl packages avail for testing

could anyone release a perl version to kamikaze ?

Re: Full Perl packages avail for testing

First of all I should say thanks to everyone that has gotten this working.  I really needed a full featured perl in OpenWRT but had no idea how to get it to build by myself, so this has been a lifesaver.

I've run into a problem recently:  I had this package building fine on the kamikaze 7.09 release, but I have had to switch to the development trunk to get support for some platforms that were unavailable in 7.09.  I can't get this package to build in the current trunk buildroot.

Is there any plan to incorporate this package into kamikaze in addition to microperl?  Or does anyone have patches or an updated Makefile that will allow it to build from the current trunk?

Thanks,
Ben

25

Re: Full Perl packages avail for testing

Thanks to those who helped getting perl to run under OpenWRT. Can anyone gives any clues as to how to get perl modules, such as Crypt::CBC and others, installed and working?
Any help is much appreciated!

SJ