Skip to content
vijay edwin edited this page Jun 15, 2024 · 8 revisions

Clasp can also build and run in a Docker Container.

Here is a Dockerfile (based on a file yitzi kindly provided) for creating a container with clasp: If you have more memory than 12 GB, you might run more things in parallel (should be quicker) with the following values in the Dockerfile

  • ./koga --jobs=4 &
  • ninja -j 4 -C build

The Dockerfile is for Ubuntu 22.04 LTS (Jammy Jellyfish)

FROM ubuntu:jammy

SHELL ["/bin/bash", "-c"]

ARG D_USER=app
ARG D_UID=1000

ENV DEBIAN_FRONTEND=noninteractive
ENV USER ${D_USER}
ENV HOME /home/${D_USER}
ENV JUPYTER_PATH=${HOME}/.local/share/jupyter/
ENV JUPYTERLAB_DIR=${HOME}/.local/share/jupyter/lab/
ENV PATH "${HOME}/.local/bin:${PATH}"

RUN apt-get update
RUN apt-get dist-upgrade -y
RUN apt-get install -o Dpkg::Options::="--force-overwrite" -y \
	binutils-gold clang-13 libboost-dev libbsd-dev libclang-cpp13-dev \
	libelf-dev libgmp-dev libncurses-dev libunwind-dev llvm-13 ninja-build \
	sbcl zlib1g-dev sudo locales wget git pkg-config libclang-13-dev

RUN apt-get -y install software-properties-common
RUN add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"

RUN apt-get -y install unzip
RUN apt-get -y install cmake build-essential
             
RUN echo 'en_US.UTF-8 UTF-8' >/etc/locale.gen
RUN sudo -E locale-gen

RUN useradd --create-home --shell=/bin/false --uid=${D_UID} ${D_USER} && \
    usermod -aG sudo $D_USER && \
    passwd -d $D_USER

WORKDIR ${HOME}
USER ${D_USER}

RUN wget https://github.com/fmtlib/fmt/releases/download/8.1.1/fmt-8.1.1.zip && \
    unzip fmt-8.1.1.zip && \
    cd fmt-8.1.1 && \
    mkdir build  && \
    cd build  && \
    cmake .. && \
    make && \
    sudo make install
    
RUN wget https://beta.quicklisp.org/quicklisp.lisp && \
    sbcl --non-interactive --load quicklisp.lisp --eval '(quicklisp-quickstart:install)' --eval '(ql-util:without-prompting (ql:add-to-init-file))' && \
    rm quicklisp.lisp

RUN git clone https://github.com/clasp-developers/clasp.git && \
    cd clasp && \
    ./koga --debug-release --debug-bclasp-lisp --debug-cclasp-lisp  --debug-compiler --debug-guard --debug-verify-modules --debug-jit-log-symbols --debug-assert-type-cast --skip-sync=mps && \
    ninja -j 2 -C build

To create the docker container:

  • Store the above content as Dockerfile in a directory and open a terminal there
  • docker build --tag clasp .

To run it:

  • docker run --name test -it clasp
  • in the container run clasp with /home/app/clasp/build/boehmprecise/clasp
  • or install with sudo ninja -C build install (could also be added to the Dockerfile)
Clone this wiki locally