Perl for WinCE devices


TOC
Building perl by yourself
Obtaining precompiled binaries
Installation instructions
Known problems and their solutions
Other
Future development directions
Contacts


NOTE: Perl for WinCE now has WiKi at http://perlce.sourceforge.net/cgi-bin/perlce-tcltkce-wiki.pl?PerlCE_And_Tcltkce_Wiki_Page
Be sure to check there, as it could contain more recent information on subject.

NOTE2: that wiki become read-only due to forced requirement on SF site.
this problem will not be fixed until people with enough enthusiasm will provide their help on fixing this


News:

Starting from 5.9.4 version, in the Perl source tree 'wince' directory was merged with win32, so it is no more separate directory.
Build process is not changed, however.


Perl has support WinCE starting from 5.6.0 version, it was provided by Rainer Keuchel, along with other excellent software ported to WinCE platform available at his site.

Starting from perl version 5.8.0 build for WinCE has following additional features that were missing earlier:

Building perl by yourself

- preparing to build

Check that you have following:

- building perl core

If nothing unusual happens, perl core and core libraries will be built. "compile.bat dist" will prepare a distribution for copying. If your mileage varies so that you did not get your binaries that you deserve (yes, if you stepped this way such long, you certainly deserve your binaries), then write to perlce-user@lists.sourceforge.net mailing list and share your experience.

Idea of compile.bat file is simple: it is a wrapper for wince/makefile.ce. It prepares environment variables and then calls "nmake -f Makefile.ce" with any extra arguments added to command line, and this provides a way to specify make targets, specify platform name and so on.

Idea of cross-compiling process is also simple: during a cross-compiling process a special module "Cross.pm" is created, and a special "Config.pm" file hidden somewhere deep, and this Config file reflects parameters of your WinCE device. When module "Cross" is invoked then that special Config.pm comes into play.

If you want to try threaded build, then you should provide arguments "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define" to compile.bat file, all at once or some of them at your wish. Another way is to edit Makefile.ce appropriately. Be prepared to waste much more memory than usual in this case, just because there exists some black hole that is not noticed yet. More details will be published once they wil be available.

- building external perl extensions

Building external perl extensions is not supported.
There are several reasons why it is not supported, most important reason is because nowadays MakeMaker::Extutils is a huge collection of $^O combinations with XXX_DIR_YYY variables, because Perl supports not only large number or platforms but yet large number of types of installations thus resulting in gazillion number of totals.
It was decided to add just such minimum as possible at all.

However, building of external modules is possible, using a couple of simlpe tricks.

I'll provide details here when I'll gather more information. Until that please see how this is done for CPAN modules Tcl-0.72.tar.gz and TclTk-0.72.tar.gz -- both they contain ceMakefile.pl containing some information on question.

Obtaining precompiled binaries

There was made very first attempt to build entire 5.8.1-pre for WinCE devices, it is available from download page for this project: http://sourceforge.net/project/showfiles.php?group_id=76681

'perlce-build-area' package contains so-called build area, which means entire files set after building process, including *.obj files and *.lib (those could be used for building extensions). This file is extremely large and usually is not needed for ordinary use.

If you experience some difficulties using pre-built binaries, please let me know

Installation instructions

(currently installation isn't perfect. sorry for that)

1. celib.dll

In case you do not have yet celib.dll install it: many ports from Rainer Keuchel use it, PerlCE also uses it. Download it from Rainer Keuchel's site or from sourceforge site http://prdownloads.sourceforge.net/perlce/celib-3.11-dll-src.tar.gz
You do not need all files from inside that archive: just copy yours celib.dll into your \Windows directory. (other files are required if you're building binaries by yourself)

2. files

- unzip files, copy them preferably to storage card (to not occupy main memory unless needed)
- edit Config.pm to reflect your installation path (globally replace string \storage card\perl58m into yours or do nothing if you unzipped perl into \storage card\perl58m)
- perl-at-19923 has misplaced files in ./lib/IO/* directory. Fixed in next release, please place files by yourself until that
- simply copy any desired pure-perl modules into ./lib and/or delete modules that you decided not to use to save memory
- update Dynaloader.pm with a file available separately for download. This file has logic for different OSes stripped (BTW why should my Win32 installation compare $^O with, say, 'VMS' every time?), much smaller in size and contains few WinCE-specific logic.
- help files are not provided. Instead you can just copy *.html files from usual perl distribution, and invoke it from Explorer.

3. registry values

Easiest way to deal with registry values is to use PerlIDE from http://www.rainer-keuchel.de/wince/dirlist.html
However perl.exe could be executed even without registry values set up properly.

Known problems and their solutions

1. Socket.dll and alike

There is a known feature on WinCE devices (or misfeature, depending on how you look at this :) when WinCE refuses to load a DLL if DLL with same name is already loaded. Regardless whether or not you specified exact path to new instance of DLL, a handle to firstly loaded DLL with same name will be returned.

This leads to a problem when file Socket.dll from perl directory becomes ignored just because WinCE has socket.dll in \Windows directory and it is usually loaded.

Avioding such problem is simple: rename file perl/lib/auto/Socket.dll into Socket_1.dll and do a simple hacking of Dynaloader.pm to try *.dll at first and *_1.dll at second.
updated Dynaloader.pm is available for download under perl-582-1 section, and handles namely this logic: it tries to download *_1.dll file as a secont attempt to download extension DLL.

2. startup time

Perl runs relatively fast on WinCE devices, but it takes quite long time to start its run.
Mostly this is because perl needs to load its own DLL file. Given average WinCE device it takes about 1 second to load 1 Mbyte DLL file before using it (as of my Cassiopeia E-125). This is atomic operation and could not be faster than that.

The workaround is simple.
Just look into previous section and it will become clear that once we'll load perl.dll into memory it will not be loaded second time. Just write a simpe perl script that uses often required DLLs, and you'll save about 1 second each time some perl script will run. Some often used DLLs could be "prepared" using call to DynaLoader::dl_load_file("path_to_dll"); . Please make sure your "boost" script do not exit, it must be in background (finish it with a reading operator "<STDIN>;") and invoking next perl script will save about 1 second per required 1 MByte DLL.

3. threaded build eats much more memory than usual build

Threaded Perl is way experimental on WinCE and it appeared right before 5.8.1 is out. May be sometimes it will be more tested, now it works as "just to prove it works".

4. Errno extension not cleanly built

(no more problem as of 5.8.6+)

5. Backspace do not work

(no more problem as of 5.8.2+)

6. Explanations on this site are not very clear

Yes, better explanations should be done with a person who knows English better than me. Please post corrections to said mailing list, or ask there about unclear places and together we'll improve explanations.

Other

If you want most recent information please use perlce-user@lists.sourceforge.net mailing list.
Subscribe to that list by filling your address at URL http://lists.sourceforge.net/lists/listinfo/perlce-user


Hosted by SourceForge.net Logo

last updated: 16-nov-2006