Thursday, October 16, 2008

PicoLisp in a chroot

Picolisp has a nifty feature where you can include inline c code, and it will be automatically compiled for you, and just work.

Unfortunately I'm on a 64 system, and pico dosn't at the moment compile under 64 bit. Now I'm told that if I install the right things and tweak the right options I can get 32 bit binaries to compile anyway. But that involves modifying the upstream source and I don't like doing that, unless I plan to submit a patch.

In this case It seemed somewhat pointless. So I though I'd try setting pico up in a chrooted environment. I came accross the following post on the matter: Installing apps in a 32-bit chroot in AMD64 Debian systems.

I followed most of step 1, with the following exceptions:
  • I skipped step 1.3 (decided not to mess with my main gcc instalation.
  • Installed gcc, and build-essentials into the chroot. (also locals and less which didn't get installed by default.
  • Installed dchroot into my real system ( I think this is soemthing the tutorial does later).
  • Compiled picolisp in the chroot enviroment and installed it to /usr/local/
  • Added some scripts to my real path which would execute picolisp and psh in the chroot.


All in all it was a surprisingly easy process and at the end of it I have a fully functional picoLisp. which is accessible form anywhere. even the scripting is easy.


!#/bin/bash
dchroot --preserve-environment <> "$@"


This lets me run pico the same way weather I'm in the chroot or in the main system. And there are no gremlins. I started a picolisp server in the chroot, started firefox (I mean Iceweasel) in the main system, and everything worked, even the ondemand compilation of c from inside pico.

Partially I did this because I wanted to learn how to do it, and now that I have a 32 bit chroot I'll probably move my IceWeasel into it and install flash.

Hmm, I wonder which I'll see first, 64 bit PicoLisp or 64bit Flash? I have it on good authority that they are both in development.

No comments: