Skip to content

jasom/clasp

Repository files navigation

Clasp

-- Update Oct 5, 2014 -- Please read regarding installing Clasp

If you have questions come ask them on IRC at freenode #clasp

Clasp is a Common Lisp implementation that interoperates with C++ and uses LLVM for just-in-time (JIT) compilation to native code. See http://drmeister.wordpress.com/2014/09/18/announcing-clasp/ for the announcement.

Clasp is not yet a full ANSI compliant Common Lisp - if you find differences between Clasp and the Common Lisp standard they are considered bugs in Clasp and please feel free to report them.

Libraries that clasp depends on can be obtained using the repository: externals-clasp
Currently you must build externals-clasp prior to building Clasp - we will eliminate the need for this in future releases.

Systems Clasp has built on

Clasp needs an advanced C++ compiler that supports C++11 (minimum clang 3.5 or gcc 4.8).

Clasp also needs a very specific version of the llvm/clang 3.6 libraries that are not part of a standard release. This version of the llvm/clang3.6 is included in externals-clasp. Incidentally, the externals-clasp/llvm3.6 builds a clang3.6 compiler, which can be used by the Clasp build system to compile Clasp.

Systems that Clasp is known to build on
OS X 10.9.5 using Xcode 6.0.1
Debian Testing(Jessie) - see issue #22
Debian Unstable(Sid)
Gentoo Linux - see issue #20
Arch Linux
OpenSuse 13.1 - see issue #19
Debian Stable (Wheezy) - see issue #21
Ubuntu 14.04 - see issue #26

If you experience problems with the systems above please submit an issue here or come see us on #clasp on irc.freenode.net

Building Clasp

To build Clasp from within the top level directory do the following.

  1. You need to download and build the externals-clasp repository
  • it contains all of the external libraries that Clasp depends on and it downloads the specific version of LLVM 3.6 that Clasp needs.
  1. Copy local.config.darwin or local.config.linux to local.config depending on your system

  2. Edit local.config and configure it for your system. The following configuration variables affect the build process.

Variable Description
CLASP_BUILD_TARGET_DIR This defines where make will put the Clasp application. I use $HOME/local/clasp
EXTERNALS_BUILD_TARGET_DIR This defines where Clasp build will find the externals-clasp libraries. I use $HOME/local/externals-clasp
TARGET_OS Currently either linux or darwin
PJOBS The number of processors you have available to build with.
Set PJOBS <= the number of cores you have.
Also if you have less than 8GB memory you should set PJOBS to 2 or 1,
otherwise your system will swap like crazy
CXXFLAGS If you set this export CXXFLAGS = -v it will print more debugging info
during the build
  1. Make both the mps and boehm versions of Clasp (see note 1 for other options).
# make

If you see the error "fatal error: 'core_scrape_flag.h' file not found" just stop the build with control-C and type "make" again. It will sort itself out. It's something to do with the order in which boost-build builds things but I haven't sorted it out yet.

  1. Add the directory in $CLASP_BUILD_TARGET_DIR/MacOS (OS X) or $CLASP_BUILD_TARGET_DIR/bin (linux) (from local.config) to your PATH

  2. To run the MPS version of Clasp use

# clasp_mps_o

and to run the Boehm version of Clasp use

# clasp_boehm_o
  1. When the Clasp REPL prompt appears you can type Common Lisp commands.
Starting Clasp 0.1... loading image... it takes a few seconds
Loading .clasprc
Top level.
> (defun hello-world () (print "Clasp is running.  Huzzah!!!"))

HELLO-WORLD
> (hello-world)

"Clasp is running.  Huzzah!!!"
"Clasp is running.  Huzzah!!!"
> (quit)

Clasp will run within Emacs using *inferior-lisp* and in the future Clasp will have a SLIME interface (volunteer programmers will be showered with appreciation and praise!).

Note 1: You can make just one version of Clasp

# make boostbuildv2-build 

and then to make the boehm version of Clasp use

# make clasp-boehm

or to make the mps version of Clasp use

# make clasp-mps

External libraries

If you want to install the external libraries separately its more complicated because Clasp requires a particular version of LLVM/Clang3.6 which hasn't been officially released yet but is present in externals-clang. This should all become easier in a couple of months when LLVM/Clang3.6 is released.
These are the requirements as of Sep 28, 2014.
LLVM/clang 3.5 compiler
Boost build v2
boost libraries ver 1.55
Boehm 7.2
gmp-6.0.0
expat-2.0.1
zlib-1.2.8
readline-6.2

Acknowledgments

Clasp was supported by the Defense Threat Reduction Agency (DOD-DTRA) (HDTRA1-09-1-0009) the National Institutes of Health (NIH/NIGMS Grant number: 2R01GM067866-07A2) and the National Science Foundation (Grant number: 1300231)