Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Small perl for embedded devices?

by knave (Acolyte)
on Jan 18, 2003 at 01:13 UTC ( [id://227884]=perlquestion: print w/replies, xml ) Need Help??

knave has asked for the wisdom of the Perl Monks concerning the following question:

Some time has passed since this question was last asked. Where does one go for a small-footprint perl distribution? I have found very little. Can it be done in under 500KB?

Replies are listed 'Best First'.
Re: Small perl for embedded devices?
by rob_au (Abbot) on Jan 18, 2003 at 07:20 UTC
    You may want to have a look at microperl which was introduced as a new feature with Perl 5.7.0. This build incorporates the bootstrap feature of Perl which behaves similar to any other build of Perl, but does not incorporate Dynaloader XS module allowing the execution of C-based Perl modules or system specific functions such as crypt and readdir.

    This build of Perl is particularly good for hacking and porting, relying upon only 71 files from the Perl source - On a test build on a i686 Linux machine however, the build size of the microperl binary using gcc 2.95.4 with libc6 (2.2.5) and no source hacking was approximately 968Kb.

    If you are interested, there was an article on microperl written by Simon Cozens in Issue 19 of The Perl Journal here - This article has also been incorporated in the O'Reilly published "Computer Science and Perl Programming".

     

    Update - In Re: bootstrapping with microperl, I describe the compression of a stripped microperl binary which had been built with the -O3 optimisation flag with UPX - The resultant binary was 308Kb in size.

    kathmandu:/home/build/perl-5.8.0# upx -9 microperl -omicroperl.upx Ultimate Packer for eXecutables Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 UPX 1.20 Markus F.X.J. Oberhumer & Laszlo Molnar May 23 +rd 2001 File size Ratio Format Name -------------------- ------ ----------- ----------- 721956 -> 315924 43.75% linux/386 microperl.upx Packed 1 file.

     

    perl -le 'print+unpack("N",pack("B32","00000000000000000000001000011001"))'

Re: Small perl for embedded devices?
by gjb (Vicar) on Jan 18, 2003 at 01:18 UTC

    You could have a look at TinyPerl, it's the smallest I've seen so far, but it's about 116K larger than you require (I'm not sure whether this is file size or runtine memory, but I guess the former which is probably not what you have in mind).

    Just my 2 cents, -gjb-

Re: Small perl for embedded devices?
by sauoq (Abbot) on Jan 18, 2003 at 01:54 UTC

    I've got perl on my Zaurus. The ipk distribution is about a meg (compressed.) The binary is about 800k or so.

    -sauoq
    "My two cents aren't worth a dime.";
    
      I can't say that the Perl that is for the Zaurus is worth the 1 meg compressed. However, a fully featured (w/CGI) Perl I created by modifying Debian-ARM archives and put into a cramdisk comes out to be about 3 megs on disk.

      --
      $Stalag99{"URL"}="http://stalag99.keenspace.com";

Re: Small perl for embedded devices?
by zentara (Archbishop) on Jan 18, 2003 at 14:28 UTC
    I just made a microperl from perl5.8 to test. It is done with make -f Makefile.micro. It compiled to 908k stripped. However when I tested it on a script , it gave an error "Unsupported function opendir". So I guess it is pretty limited.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://227884]
Approved by gjb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 22:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found