roswell2をインストールする

Lisp Advent Calendar 2023 - Adventar の6日目の記事です。

以前からCommon Lispの処理系マネージャ(?)である roswell は存在していたが、新に roswell2 が出てきたので使ってみる。 roswellとroswell2の大きな違いは、roswellが複数OSへの移植性を考慮して下位層がC上位層がCommon Lispで書かれていたのに対し、roswell2では全てをCommon Lispで書き直している。

動作確認したバージョン

インストール

ビルド用にaptでOS側のパッケージをインストールする。

sudo apt install -y git make docker.io
sudo gpasswd -a $USERNAME docker

docker関連でgroupを設定したので再ログインする。

githubからroswell2をもらってくる。

git clone git@github.com:roswell/roswell2.git

ubuntu上でのビルドなのでlinux-buildでmakeを行う。

cd roswell2
make linux-build

最終的にこんな感じに出力されたら成功。

...
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
[undoing binding stack and other enclosing state... done]
[performing final GC... done]
[defragmenting immobile space... (fin,inst,fdefn,code,sym)=883+953+18675+20067+26865... done]
[saving current Lisp image into bin/lisp:
writing 0 bytes from the read-only space at 0x50000000
writing 896 bytes from the static space at 0x50100000
writing 33308672 bytes from the dynamic space at 0x1000000000
writing 2064384 bytes from the immobile space at 0x50200000
writing 12984320 bytes from the immobile space at 0x52a00000
done]

ローカルディレクトリにインストールする。

PREFIX=$HOME/.local make install

最終的にこんな感じに出力されたら成功。

echo 9820c6a Mon Nov 6 18:03:20 2023 +0000 > lib/commit
mkdir -p /home/roswell2/.local/bin
cp -f bin/lisp /home/roswell2/.local/bin
mkdir -p /home/roswell2/.local/lib/roswell
cp -r lib/* /home/roswell2/.local/lib/roswell

元々 .local/bin がなくてパスが通ってないので再ログインする。

何かをリビルドする。 コマンド名が、roswellでは ros だったが、roswell2からは lisp に変更になっているので注意。

lisp rebuild

最終的にこんな感じに出力されたら成功。

...
To load "roswell2.cmd.version":
  Load 1 ASDF system:
    roswell2.cmd.version
; Loading "roswell2.cmd.version"

To load "roswell2/config.default":
  Load 1 ASDF system:
    roswell2/config.default
; Loading "roswell2/config.default"

とりあえず実行してみる。

lisp run -L sbcl

最後に * が出たらreplの起動成功なので普通にlispコードを実行してみる。

* (remove-duplicates '(:alfa :alfa :bravo :bravo))
(:ALFA :BRAVO)

roswell2のインストールが出来た。