I am glad to hear this, because ECL is the only free Common Lisp on Windows with multithreading support (at the same time an active work on multithreading for CLISP is in progress, Clozure CL has beta port for Windows, and a lot of work was also done for threading in SBCL Windows port, although the work is not finished).
I tried Hunchentoot on ECL and for those who are interested too, I reproduce here the steps I took. My environment: Windows XP + Microsoft Visual Studio.
- You need the latest versions of Hunchentoot and all the dependencies. If you are lazy, you may get all them at once from this archive I prepared.
- Apply the patch from this post (already done in my archive): save the port-ecl.lisp to the hunchentoot directory and add
#+:ecl (:file "port-ecl")
to hunchentoot.asd as here. - Checkout fresh ECL from CVS:
cvs -z3 -d:pserver:anonymous@ecls.cvs.sourceforge.net:/cvsroot/ecls checkout ecl
I recommend fresh checkout because I had problems building ECL from sources already existing on my computer after update withcvs update -dAP
. - Configure ECL. Open ecl\msvc\Makefile and set
ECL_THREADS = 1 ECL_UNICODE = 1 ECL_ASDF = 1 ECL_SOCKETS = 1
- Build ECL. Run Visual Studio command prompt: menu Start->All Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools -> Visual Studio 2005 Command Prompt. This script sets up environment variables so that C compiler cl.exe, nmake.exe and other things are in your PATH, all includes and libraries are available, etc.
In this console window type:
> cd <DIR_WITH_ECL_SOURCES>\ecl\msvc > nmake
After the build completes, copy resulting binaries somewhere:> nmake install prefix=c:\somewhere\ecl
Now you have working ECL, lets test it:> c:\somewhere\ecl\ecl.exe ECL (Embeddable Common-Lisp) 0.9l (CVS 2008-07-12 18:54) Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya Copyright (C) 1993 Giuseppe Attardi Copyright (C) 2000 Juan J. Garcia-Ripoll ECL is free software, and you are welcome to redistribute it under certain conditions; see file 'Copyright' for details. Type :h for Help. Top level. > (+ 2 2) 4 > (quit)
Works.Do not close the Visual Studio command prompt, we will need it soon.
- As Hunchentoot uses ASDF, we need Hunchentoot with all its dependencies to be registered in
ASDF:*CENTRAL-REGISTY*
. For this I have a special lisp file, setup-asdf-registry.lisp (already included in the archive from the step 1):;; this file must be stored in the same directory ;; where all the lisp libraries are stored ;; (but libraries, of course, have their own subdirectories) (require 'asdf) (flet ((reg (relative-lib-dir) (let ((lib-dir (directory-namestring (merge-pathnames relative-lib-dir (load-time-value (or #.*compile-file-pathname* *load-pathname*)))))) (pushnew lib-dir asdf:*central-registry* :test #'equalp)))) (reg "alexandria\\") (reg "asdf-binary-locations\\") (reg "babel_0.2.0\\") (reg "cffi-080926\\") (reg "chunga-0.4.3\\") (reg "cl-base64-3.3.2\\") (reg "cl-fad-0.6.2\\") (reg "cl-ppcre-2.0.1\\") (reg "cl-who-0.11.0\\") (reg "cl+ssl\\") (reg "flexi-streams-1.0.7\\") (reg "hunchentoot-0.15.7\\") (reg "md5-1.8.5\\") (reg "rfc2388\\") (reg "trivial-features_0.1\\") (reg "trivial-gray-streams\\") (reg "url-rewrite-0.1.1\\")) (asdf:operate 'asdf:load-op :asdf-binary-locations)
- Compile and load Hunchentoot. For this go back to the Visual Studio command prompt.
> c:\somewhere\ecl\ecl.exe > (load "c:/archive-from-the-step-1/setup-asdf-registry.lisp") > (pushnew :hunchentoot-no-ssl *features*) > (asdf:operate 'asdf:load-op :hunchentoot-test)
ECL must be started from Visual Studio command prompt because it uses C compiler when compiling Lisp.(pushnew :hunchentoot-no-ssl *features*)
is only necessary if you do not have OpenSSL installed (get it here for Win32). - Start Hunchentoot:
> (hunchentoot:start-server :port 4242)
Now you may open http://localhost:4242/hunchentoot/test and see Hunchentoot test site.
At the moment of this post writing, almost all examples from the test site work, except for two: "UTF-8 demo (writing UTF-8 characters directly to the stream)" and "UTF-8 demo (returning a string)". The reason is already found and I am sure it will be fixed very soon.
Excellent! It is very helpful that you brought all these things together.
ReplyDeleteIn my case it seems I also had to include the Microsoft Platform SDK in the include & lib paths.
But everything worked perfectly. Plus it's nice to have a copy of ECL now with :unicode and :threads listed in *features* -- that will be handy for other things some day.
Thanks again for the work & writing this up.
Thanks, I am glad you found it useful.
ReplyDeleteClozure port to Windows has been completed. Clozure 1.3 officially supports Win32 (Win64 does not work).
ReplyDeleteGreat post - looking forward for others in the same area - ecl threads would be great !
ReplyDelete__mario__