« www.sqlcrypt.com - Encryption for SQLite | Main | CMUCL FreeBSD -lc_r »

29 October 2004

Building CMUCL

With CMUCL 19a, building from source isn't that difficult, provided everything builds nicely which should be the case if one is using a supported platform.

The instructions are in the file BUILDING. To wit:

» Unpack the source into a directory called src. (First encounter with CMUCL's famous compilation bootstrapping problem: reading BUILDING without unpacking the source tree.)

» In the parent directory of src, create a target build directory:

$ src/tools/create-target.sh freebsd4 FreeBSD_gencgc FreeBSD

» Edit freebsd4/setenv.lisp to add some features. My CMUCL 19a binary installation has :ELF, :FREEBSD and :FREEBSD4 so I add those in.

» Recompile the Lisp world:

$ src/tools/build-world.sh freebsd4 lisp

» The first time this is done, build-world.sh writes, "The C header file has changed. Be sure to re-compile the startup code." Here the "startup code" refers to the C code that compiles to the lisp binary. How it builds is driven by the file freebsd4/lisp/Config, which is sym-linked to src/lisp/Config.FreeBSD_gencgc by create-target.sh above.

In this case, my purpose in rebuilding the thing is to link lisp to libc_r.so. Make one change to freebsd4/lisp/Config:

--- Config.FreeBSD_gencgc-nothr Thu Oct 28 20:25:46 2004
+++ Config.FreeBSD_gencgc       Fri Oct 29 10:25:13 2004
@@ -14,6 +14,6 @@
 ASSEM_SRC = x86-assem.S
 ARCH_SRC = x86-arch.c
 OS_SRC = FreeBSD-os.c os-common.c elf.c
-OS_LINK_FLAGS = -dynamic -export-dynamic
+OS_LINK_FLAGS = -pthread -dynamic -export-dynamic
 OS_LIBS =
 GC_SRC = gencgc.c

The link flag -pthread will link lisp to libc_r.so.

Now do it:

$ src/tools/rebuild-lisp.sh freebsd4
...
$ ldd freebsd4/lisp/lisp
freebsd4/lisp/lisp:
        libm.so.2 => /usr/lib/libm.so.2 (0x28085000)
        libc_r.so.4 => /usr/lib/libc_r.so.4 (0x280a0000)

» Build the Lisp world again:

$ src/tools/build-world.sh freebsd4 lisp

» Dump a core:

$ src/tools/load-world.sh freebsd4 "19a ngps freebsd4-pthread 2004-10-29"

» Test!

$ freebsd4/lisp/lisp -core freebsd4/lisp/lisp.core -noinit -nositeinit
...
Loaded subsystems:
    Python 1.1, target Intel x86
    CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (+ 4 3) 

7
* 

Looks good.


Posted by ngps at 12:50 | Comments (0) | Trackbacks (0)
Comments
There is no comment.
Trackbacks
Please send trackback to:http://sandbox.rulemaker.net/ngps/151/tbping
There is no trackback.