JMpol

Maemo LISP Environment

        Welcome Network SYMBOLICS APPLE LINUX NOKIA Maemo PC Literature Workgroup

Maemo

The steps regarding the installation and configuration of the software components

building the LISP development environment under Maemo, the Debian-based OS

of the Nokia N900 Mobile Computer, are detailed below. Installation is performed in

an Image File containing the Debian OS, as detailed in the webpage Easy Debian.

The advantage of this method is that thousands of precompiled Apps provided by

the Debian repositories can be installed on the tablet without interfering with the

original Maemo OS, either via the Debian instruction apt-get or by using a Package

Manager as, e.g Aptitude or Synaptic.

Easy Debian

To perform the installation on a N900 tablet follow the instructions provided in the

Easy Debian homepage. After installation, Debian can be started and displayed

either on the N900 by launching the App Debian chroot from within the N900's

Applications Manager, or in a Terminal App, e.g on a Mac via SSH, by executing the

command:

$  debian

The thumbnails debian on N900 via chroot and debian on N900 via ssh show the

Debian OS deb-m5v3d while displayed on the N900 screen and via SSH in a Mac

X Terminal App, respectively.

Following termination of a Debian session launch the App close Debian from within

the N900's Application Manager to shutdown Debian correctly.

Aptitude / Synaptic

Among other applications, Easy Debian along with the Debian OS also installs the

Synaptic Package Manager on the N900 as a standalone App. The thumbnail

synaptic on N900 - Debian shows a screenshot of Synaptic running on the N900.

Alternatively, you may install the Terminal-based Package Manager Aptitude by

starting Synaptic and searching for aptitude. Once located, mark the package for

installation from within Synaptic's Package menu and select Apply. Aptitude will be

installed in the Debian Image File on your tablet. Should it be necessary, Synaptic's

Help menu enables to access both a Manual, via menu item Contents, and a Quick

Introduction in HTML format under Iceweasel, i.e the Debian version of the Web

Browser Mozilla Firefox.

CLISP

To install CLISP together with two common library packages, download the debs

provided in the Maemo.org Web page CLISP 2.48+ with FFI on Maemo Fremantle

either into /home/user/MyDocs or into a dedicated folder under /media/mmc1 onto

the N900's memory card, and proceed as follows.

clisp_2.48+-1_armel.deb

libffcall1_1.11-1_armel.deb

libbsigsegv0_2.6-1_armel.deb

Launch Debian chroot from within the N900's Applications Manager. Once Debian

is running, launch the command shown below, by specifying the path to the folder

containing the debs downloaded in the previous step.

$  dpkg  -iR  /path_to_folder_containing_the_debs

This command will recursively handle all regular files matching pattern *.deb found

in the specified folder and unpack and configure the packages in the Debian Image,

as appropriate. Upon installation completion, CLISP can be stated under Debian by

invoking the command:

$  clisp

On startup, CLISP initialization is controlled by the commands made available by

the user root in the file /root/.clisprc.lisp. As shown in the thumbnail CLISP on N900

via SSH the file .clisprc.lisp on this N900, includes just one instruction that loads the

file asdf.fas into CLISPASDF stays for "Another System Definition Facility" and is

available for free. Click asdf.lisp to download the latest release source code from

the ASDF homepage and put the file asdf.lisp into the folder of your preference, e.g

/usr/share/common-lisp/source/cl-asdf/asdf.lisp

Subsequently compile the file in a CLISP Listener on the N900 Mobile Computer by

calling the function:

(compile-file "/usr/share/common-lisp/source/cl-asdf/asdf.lisp")

Compilation of asdf.lisp will generate the files asdf.fas and asdf.lib, respectively.

Alternatively, you could install a precompiled version of the ASDF package onto the

N900, i.e cl-asdf, from the Debian repository using Aptitude or Synaptic, together

with cl-swank, as detailed in section SLIME below. Finally, in order to load ASDF

whenever starting CLISP, include the entry provided in .clisprc.lisp in your CLISP

init-file.

GNU Emacs

The actual version of GNU Emacs and dependent files should be installed from the

Debian repository Editors using either Aptitude or Synaptic. After installation Emacs

can be started by the command

$  emacs

launched either directly on the device under Debian chroot or in a Terminal App via

SSH, as shown by the thumbnails Emacs on N900 via chroot and  Emacs on N900

via ssh, respectively.

SLIME

SLIME is the Superior Lisp Interaction Mode for Emacs. Combined with cl-swank,

the SLIME LISP-side server, Emacs provides under Maemo/Debian an excellent

platform for unifying LISP development. Installation of SLIME and cl-swank onto the

N900 should be performed from the Debian repository Development using Aptitude

or Synaptic. Also note that cl-swank will automatically install cl-asdf, as a dependent

package. A manual in HTML format or in pdf explains what SLIME can do and how

it shall be used.

With a LISP implementation that can be started from the command-line, e.g CLISP,

SLIME installation just requires the next two lines to be included in the Emacs init-

file.

(setq inferior-lisp-program "/usr/bin/clisp")

; path to the LISP system

(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime")   ; SLIME directory

If included, the next two lines tell Emacs that the rest of SLIME should be loaded

automatically, i.e when one of the commands M-x slime or M-x slime-connect is

executed the first time.

(require 'slime-autoloads)

(slime-setup)

Note, however, that a bug in the current definition of function "binary-pathname" in

the file /usr/share/common-lisp/source/slime/swank-loader.lisp inhibits SLIME from

starting correctly. Here is a version of swank-loader.lisp that cures this problem.

The thumbnail slime-repl clisp shows a SLIME interaction mode with CLISP started

in Emacs using the ESC key as Meta key in a Terminal App connected to the N900

via SSH under Mac OS X, and the thumbnail inferior-lisp shows the messaging on

SLIME startup in the Emacs buffer *inferior lisp*.

Maxima

The computer algebra system Maxima and its dependent packages among which,

maxima-doc, maxima-emacs, maxima-share, maxima-src, maxima-test as well as

xmaxima should be installed onto the N900 mobile computer from the Debian

repository Mathematics, using either Aptitude or Synaptic. Following the installation,

Maxima may be started under Maemo/Debian either by invoking the command

$  maxima

in a Terminal App or by the command M-x maxima in Emacs. All it has to be done

after installation is to provide the appropriate entries in .emacs, the Emacs init-file.

For convenience here is a .emacs init-file to place it in the folder /root. For details

and documentation regarding Maxima, consult the Maxima homepage.

Gnuplot

The command-line program Gnuplot provides an ideal complement for Maxima in

order to generate 2- and 3-dimensional plots. Following Maxima installation onto

the N900, the packages gnuplot, gnuplot-nox and gnuplot-x11 should be installed

from the Debian repository Mathematics, using either Aptitude or Synaptic.

Following the installation, Gnuplot may be started under Maemo/Debian on the

N900 either as a standalone App by invoking the command

$  gnuplot

in a Terminal App or from within a Unified Emacs Development Environment by a

Maxima or LISP function resulting in the generation of a plot, e.g as shown in the

thumbnails Gnuplot 1, Gnuplot 2 and Gnuplot 2 rotated.

SSH

This metapackage is a convenient way to install both the OpenSSH client and the

OpenSSH server, a free implementation of the Secure Shell ssh, able to provide

secure encrypted communications between two untrusted hosts over an insecure

network. Install ssh on the N900  from the Debian repository Networking, using

either Aptitude or Synaptic.

The thumbnail Unified Emacs Development Environment  shows an OpenSSH

server on the N900 providing access to several SSH clients under Mac OS X, i.e

*slime repl clisp*, *maxima* and two Editor buffers foo.lisp and primefactors.cpp,

running under Maemo/Debian.

Telnet

The Telnet client can be used for interactive communication with another host using

the TELNET Protocol. The daemon telnetd is a server which supports the DARPA

telnet communication protocol. Telnet and telnetd may be installed on the N900

from the Debian repository Networking, using either Aptitude or Synaptic. To start a

telnet session in a X Terminal App on the N900 and communicate with a Symbolics

NXP1000 machine, e.g venus, execute the following commands:

$  xhost  +venus

venus being added to access control list

$  telnet  venus

connected to venus ......

Thumbnail n900:telnet venus shows a screenshot of the communication between

N900 telnet client and Symbolics NXP1000 telnet server, giving access to the user

on the N900 to Genera 8.3, the OS of the Symbolics NXP1000 machine.

NFS

The NFS kernel server is the recommended NFS server for Linux , which provides

features like NFSv3 and NFSv4, Kerberos support and much more. Together with

the package nfs-common, which provides support files common to both client and

server, the NFS kernel server should be installed onto the N900 from the Debian

repository Networking, using either Aptitude or Synaptic.

In order to mount an exported UNIX or Linux file system, e.g the Mac OS X file

system /Users/jm  onto the N900 at the mount point /mnt, execute the command:

$  mount  -t nfs  -o nolock  macpro:/Users/jm   /mnt

Before Debian shutdown, unmount the filesystem /mnt on the N900 by executing

the command:

$  umount  /mnt

CUPS

CUPS, the Common UNIX Printing System developed by Easy Software Products

and subsequently sold to and maintained by Apple Inc., is an open source printing

system and general replacement for lpd and the like. The CUPS scheduler/daemon

gives the N900 a printing capability over the Internet Printing Protocol IPP.

If you have a network printer that can be accessed by CUPS, you can do so under

Easy Debian which, since version v3c, has cups-client installed.

Thus, as shown by screenshot N900 Printing via CUPS, you can check for available

printers by the command

$  lpstat  -a

and print out files from your N900 device by

$  lp  -d  printername  filename

The configuration of a printer for CUPS on the N900 may be performed using a web

browser, as e.g Iceweasel, the Debian version of Firefox, via the URL

http://localhost:631/

Alternatively, CUPS may be installed onto the N900 also from the Debian repository

Networking, using either Aptitude or Synaptic.

gcc, g++, gdb

The packages gcc, g++ and gdb provide to N900 the GNU C and C++ compiler and

integrated source-level debugger, enabling the capability of compiling and making

FFI calls from within CLISP to C and C++. G++, gcc and gdb may be installed onto

the N900 from the Debian repository Development, using Aptitude or Synaptic.

In order to compile C and C++ programs under Emacs, use either "Emacs Tools >

Compile", which results in a make -k call, as shown in thumbnails Unified Emacs

Development Environment and C++ Compilation - Emacs, or the "Emacs Tools >

Shell Command", which allows you to launch the appropriate Compiler gcc or g++,

respectively.

Alternatively, you may compile and run C or C++ programs also from within XTerm

using either gcc or g++, as shown in g++ and gcc examples for primefactors.cpp

and for the program quadratic.c, which makes use of the option -lm in order to link

the mathematics library math.h.

VNC

You can access an existing N900 X session from a PC or Mac on your LAN via a

Virtual Network Computing (VNC), using the programs x11vnc as VNC server on

the N900, PuTTY, and TightVNC Viewer as VNC client on the PC under Windows,

and the TightVNC Java Viewer under Mac OS X, as described below.

You can download and install TightVNC and the associated driver DFMirage, and

use it as your VNC Server or Viewer on the PC for free. Alternatively, you can use

RealVNC.

On a Mac, download the TightVNC Java Viewer from its homepage. It contains the

VNC client tightvnc-jviewer.jar that wolks on any system where Java is supported.

For Maemo, x11vnc is available in the extras repository. To install it, you can open

the Application Manager, go to Application Catalogues, and enable the repository

Extras-Testing, as follows.

Catalogue name

Maemo Extras-Testing

Web address

http://repository.maemo.org/extras-testing/

Distribution

fremantle

Components

free non-free

Then use the Application Manager to search for the package named x11vnc and

install it.

Using a PC

If not already done, download and install putty.exe onto your PC from within the

PuTTY Download Page. This will allow you to initiate an N900 VNC session from

your PC, using SSH Local Port Forwarding and regular host based authentication,

as described below.

To configure PuTTY, launch putty.exe, and select Connection > SSH>Tunnels. In

the field Source port enter the port number the N900 VNC server shall listen to. I.e,

either 5900 or 5910 or something else, if you have TightVNC server running on the

local PC. In the Destination field, enter localhost:5900, as shown in the thumbnail

PuTTY - Connection SSH Tunnels, and then press the button Add. This means you

want to forward the data traffic to localhost on the SSH server computer. The result

is shown in PuTTY - Tunnel for VNC Local Port Forwarding.

Now select Session. In the field Host Name (or IP address) enter the name or IP

address of your N900, e.g N901, specify the session's name in the field Saved

sessions, as shown in PuTTY - Basic options to your session, and press Save.

PuTTY is now configured and ready to initiate a VNC session with Nokia tablet

N901, using host based authentication.

Now, to initiate a VNC session via SSH Local Port Forwarding from the PC to the

N901, open PuTTY, select and load the session N901 by pressing the Load button,

and press Open.

In a PuTTY terminal you will be asked by your N900 to Login. Enter the appropriate

User Id and the Password, as shown for the tablet N901 in thumbnail PuTTY - Login

terminal window.

Now, once a secure connection has been established via a plain SSH Local Port

Forwarding, prepare the VNC Viewer, i.e the VNC client on the PC, as follows.

Open TightVNC Viewer on the PC and instead of pointing it to your N900, point it to

localhost:5910 or alternatively to port 127.0.0.1:5910, as shown in TightVNC Viewer

- Connection Request. Thus, the VNC client connects to your local PC, and PuTTY

forwards the data traffic over a secure SSH tunnel to the remote N900.

Then on the N900, fire up the VNC server x11vnc and immediately after, press the

button Connect of the TightVNC Viewer on the PC to initiate the new VNC session.

On the PC's display you will get the screen shown in TightVNC N900 Screen on the

PC via SSH Local Port Forwarding.

At this point, start Emacs, type in M-x slime, as shown in TightVNC N900 Emacs on

the PC via SSH Local Port Forwarding and enjoy Lisp using the N900 GUI with the

mouse and keyboard of the local PC, as shown in thumbnail TightVNC N900 Slime

on the PC via SSH Local Port Forwarding.

Using a Mac

In order to initiate a VNC session via SSH Local Port Forwarding from a Mac to a

N900 running Maemo, e.g from the Mac mini server to the tablet N901, proceed as

follows.

Under OS X, open the xterm Terminal emulator and invoke the following command

to establish a secure encrypted connection from your Mac mini server to the tablet

N901 via SSH Local Port Forwarding, as shown in thumbnail Connection Server to

N900 via SSH Local Port Forwarding, using in place of root the User_Id for your

N900 and its hostname or IP address, as appropriate.

server:~ jm$  ssh  -v  -L  5910:localhost:5900  root@n901

The SSH option -v will enable you to control the steps performed to establish this

encrypted connection. The option -L is used to initialise Local Port Forwarding.

Depending on whether the SSH server on your N900 was configured to require a

passphrase for RSA authentication, you will be requested to enter this passphrase,

otherwise if a password based authentication has been configured, to provide the

appropriate password.

Now, once a secure connection has been established via a plain SSH Local Port

Forwarding, prepare the VNC Viewer, i.e the VNC Java client on the Mac mini, as

follows.

Open the TightVNC Java Viewer on the Mac mini and instead of pointing it to your

N900, point it to localhost:5910 or alternatively to port 127.0.0.1:5910, as shown in

TightVNC Java Viewer - Connection Request. Thus, the VNC Java client connects

to your local Mac mini and SSH forwards the data traffic over a secure tunnel to the

remote N900.

Then on the N900, fire up the VNC server x11vnc and immediately after, press the

button Connect of the TightVNC Java Viewer on the Mac mini to initiate a new VNC

session. On the Mac mini's display you will get the screen shown in TightVNC N900

Screen on Mac mini Server via SSH Local Port Forwarding.

At this point, start Emacs, type in M-x slime, as shown in TightVNC N900 Emacs on

Mac mini Server via SSH Local Port Forwarding and enjoy Lisp using the N900 GUI

with the mouse and keyboard of the local Mac mini, as shown in TightVNC N900

Slime on Mac mini Server via SSH Local Port Forwarding.