From f1d24730eba17b8d084ee7625ff841bc44a2fbc3 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Thu, 8 Aug 2024 10:48:31 -0500 Subject: [PATCH] wasm: update image to Ubuntu 20.04. Update runtimes - node 10 -> node 18 - wasmtime v0.8.0-ish -> wasmtime v3.0.0 - wasmer 0.12.0-ish -> wasmer 2.0.0 Also, update ffi-napi to 4.0.3. Comment out wac/wax/wace build since these don't currently work. --- impls/wasm/Dockerfile | 106 +++++++++++++++++++--------------------- impls/wasm/package.json | 2 +- 2 files changed, 52 insertions(+), 56 deletions(-) diff --git a/impls/wasm/Dockerfile b/impls/wasm/Dockerfile index f528d071df..6dcaca0091 100644 --- a/impls/wasm/Dockerfile +++ b/impls/wasm/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 as base +FROM ubuntu:20.04 as base MAINTAINER Joel Martin ########################################################## @@ -28,9 +28,9 @@ WORKDIR /mal # For building node modules RUN apt-get -y install g++ -# Add nodesource apt repo config for 10.x stable +# Add nodesource apt repo config for 18.x stable RUN apt-get -y install gnupg -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - # Install nodejs RUN apt-get -y install nodejs @@ -42,9 +42,10 @@ ENV NPM_CONFIG_CACHE /mal/.npm # RUN dpkg --add-architecture i386 && \ apt-get -y update && \ - apt-get -y install \ - lib32gcc-8-dev libsdl2-dev:i386 libsdl2-image-dev:i386 \ - libedit-dev:i386 freeglut3-dev:i386 lib32gcc-7-dev \ + DEBIAN_FRONTEND=noninteractive apt-get -y install \ + lib32gcc-9-dev lib32gcc-8-dev lib32gcc-7-dev \ + libsdl2-dev:i386 libsdl2-image-dev:i386 \ + libedit-dev:i386 freeglut3-dev:i386 \ libreadline-dev:i386 # @@ -52,12 +53,7 @@ RUN dpkg --add-architecture i386 && \ # RUN apt-get -y install git-core cmake -RUN git clone https://github.com/WebAssembly/binaryen/ && \ - cd binaryen && \ - cmake . && make && \ - make install && \ - cd .. && \ - rm -r binaryen +RUN apt-get -y install binaryen ########################################################################### FROM base as build_tools @@ -66,37 +62,37 @@ FROM base as build_tools # # clang/LLVM and rust (for building wasmtime) # -RUN apt-get -y install llvm-3.9-dev libclang-3.9-dev clang-3.9 -RUN apt-get -y install curl && \ - curl https://sh.rustup.rs -sSf > /tmp/rustup.sh && \ - sh /tmp/rustup.sh -y -ENV PATH $PATH:/root/.cargo/bin +#RUN apt-get -y install llvm-3.9-dev libclang-3.9-dev clang-3.9 +#RUN apt-get -y install curl && \ +# curl https://sh.rustup.rs -sSf > /tmp/rustup.sh && \ +# sh /tmp/rustup.sh -y +#ENV PATH $PATH:/root/.cargo/bin # # pypy / rpython (for building warpy) # -# rpython deps -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get -y install libffi-dev pkg-config libz-dev \ - libbz2-dev libsqlite3-dev libncurses-dev libexpat1-dev \ - libssl-dev libgdbm-dev tcl-dev - -# install pypy, build and install pypy/rpython, remove prior pypy -RUN apt-get -y install software-properties-common && \ - add-apt-repository ppa:pypy && \ - apt-get -y update && \ - apt-get -y install pypy && \ - mkdir -p /opt/pypy && \ - curl -L https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-src.tar.bz2 \ - | tar -xjf - -C /opt/pypy/ --strip-components=1 && \ - cd /opt/pypy && make && \ - chmod -R ugo+rw /opt/pypy/rpython/_cache && \ - ln -sf /opt/pypy/rpython/bin/rpython /usr/local/bin/rpython && \ - ln -sf /opt/pypy/pypy-c /usr/local/bin/pypy && \ - rm -rf /tmp/usession* && \ - ln -sf /opt/pypy/pypy/goal/pypy-c /usr/local/bin/pypy && \ - apt-get -y autoremove pypy +## rpython deps +#ENV DEBIAN_FRONTEND=noninteractive +#RUN apt-get -y install libffi-dev pkg-config libz-dev \ +# libbz2-dev libsqlite3-dev libncurses-dev libexpat1-dev \ +# libssl-dev libgdbm-dev tcl-dev +# +## install pypy, build and install pypy/rpython, remove prior pypy +#RUN apt-get -y install software-properties-common && \ +# add-apt-repository ppa:pypy && \ +# apt-get -y update && \ +# apt-get -y install pypy && \ +# mkdir -p /opt/pypy && \ +# curl -L https://github.com/pypy/pypy/archive/refs/tags/release-pypy2.7-v6.0.0.tar.gz \ +# | tar -xzf - -C /opt/pypy/ --strip-components=1 && \ +# cd /opt/pypy && make && \ +# chmod -R ugo+rw /opt/pypy/rpython/_cache && \ +# ln -sf /opt/pypy/rpython/bin/rpython /usr/local/bin/rpython && \ +# ln -sf /opt/pypy/pypy-c /usr/local/bin/pypy && \ +# rm -rf /tmp/usession* && \ +# ln -sf /opt/pypy/pypy/goal/pypy-c /usr/local/bin/pypy && \ +# apt-get -y autoremove pypy # @@ -127,24 +123,25 @@ FROM build_tools as runtimes # # warpy # -RUN git clone https://github.com/kanaka/warpy/ && \ - cd warpy && \ - make warpy-nojit && \ - cp warpy-nojit /usr/bin/warpy +#RUN git clone https://github.com/kanaka/warpy/ && \ +# cd warpy && \ +# make warpy-nojit && \ +# cp warpy-nojit /usr/bin/warpy # # wac/wace # -RUN git clone https://github.com/kanaka/wac/ && \ - cd wac && \ - make USE_SDL= wac wax wace && \ - cp wac wax wace /usr/bin +#RUN git clone https://github.com/kanaka/wac/ && \ +# cd wac && \ +# make USE_SDL= wac wax wace && \ +# cp wac wax wace /usr/bin # # wasmer # -RUN curl https://get.wasmer.io -sSfL | sh && \ +#RUN curl https://get.wasmer.io -sSfL | sh +RUN sh -c "$(curl https://get.wasmer.io -sSfL)" -- 2.0.0 && \ cp /root/.wasmer/bin/wasmer /usr/bin/wasmer && \ cp /root/.wasmer/bin/wapm /usr/bin/wapm @@ -157,9 +154,8 @@ RUN curl https://get.wasmer.io -sSfL | sh && \ # wasmtime # -RUN curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar xvJf - && \ - cp wasmtime-dev-x86_64-linux/wasmtime /usr/bin/wasmtime && \ - cp wasmtime-dev-x86_64-linux/wasm2obj /usr/bin/wasm2obj +RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-linux.tar.xz | tar xvJf - && \ + cp wasmtime-v3.0.0-x86_64-linux/wasmtime /usr/bin/wasmtime #RUN git clone --recursive https://github.com/CraneStation/wasmtime && \ # cd wasmtime && \ @@ -173,13 +169,13 @@ RUN curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmt FROM base as wasm ########################################################################### -COPY --from=runtimes /usr/bin/wac /usr/bin/wac -COPY --from=runtimes /usr/bin/wax /usr/bin/wax -COPY --from=runtimes /usr/bin/wace /usr/bin/wace -COPY --from=runtimes /usr/bin/warpy /usr/bin/warpy +#COPY --from=runtimes /usr/bin/wac /usr/bin/wac +#COPY --from=runtimes /usr/bin/wax /usr/bin/wax +#COPY --from=runtimes /usr/bin/wace /usr/bin/wace +#COPY --from=runtimes /usr/bin/warpy /usr/bin/warpy COPY --from=runtimes /usr/bin/wasmtime /usr/bin/wasmtime -COPY --from=runtimes /usr/bin/wasm2obj /usr/bin/wasm2obj COPY --from=runtimes /usr/bin/wasmer /usr/bin/wasmer COPY --from=runtimes /usr/bin/wapm /usr/bin/wapm +ENV HOME /mal diff --git a/impls/wasm/package.json b/impls/wasm/package.json index 5242d90ddc..2bb76a7674 100644 --- a/impls/wasm/package.json +++ b/impls/wasm/package.json @@ -4,7 +4,7 @@ "description": "Make a Lisp (mal) language implemented in WebAssembly", "dependencies": { "@kanaka/wamp": "1.0.9", - "ffi-napi": "^2.4.4", + "ffi-napi": "^4.0.3", "text-encoding": "0.6.4" } }