Merge pull request #784 from thewtex/wask-sdk-20

web-wasi: bump to wasi-sdk 20
This commit is contained in:
Matt McCormick 2023-06-22 09:13:08 -04:00 committed by GitHub
commit 7312d8fa92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 14 deletions

View File

@ -3,16 +3,7 @@ FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"
ENV WASI_VERSION 19 ENV LLVM_VERSION 16
ENV WASI_VERSION_FULL ${WASI_VERSION}.0
RUN cd /usr/ && \
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
tar xvzf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
rm wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
ENV WASI_SYSROOT /usr/wasi-sdk-${WASI_VERSION_FULL}/share/wasi-sysroot
ENV WASI_SDK_PATH /usr/wasi-sdk-${WASI_VERSION_FULL}
ENV LLVM_VERSION 15
# Build LLVM / Clang that supports our glibc # Build LLVM / Clang that supports our glibc
RUN apt-get update && \ RUN apt-get update && \
@ -27,14 +18,19 @@ RUN apt-get update && \
apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} && \ apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# The path to the rt directory contains the LLVM patch version which is not reflected in the LLVM apt repository ENV WASI_VERSION 20
# or package. To make adding the RT robust to changing patch versions without needing to duplicate the folder ENV WASI_VERSION_FULL ${WASI_VERSION}.0
# content, we copy after extracting using a bash glob to resolve the patch version RUN cd /usr/ && \
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
tar xvzf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
rm wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
RUN cd /usr/ && \ RUN cd /usr/ && \
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \ curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
tar xvzf libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \ tar xvzf libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
rm libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \ rm libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
ln -s /usr/lib/wasi/ $(echo /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}.*)/lib/wasi cp -r lib/wasi /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}/lib/
ENV WASI_SYSROOT /usr/wasi-sdk-${WASI_VERSION_FULL}/share/wasi-sysroot
ENV WASI_SDK_PATH /usr/wasi-sdk-${WASI_VERSION_FULL}
COPY clang-wasi-sysroot.sh clang++-wasi-sysroot.sh /usr/local/bin/ COPY clang-wasi-sysroot.sh clang++-wasi-sysroot.sh /usr/local/bin/

View File

@ -8,5 +8,10 @@ set(CMAKE_C_COMPILER /usr/local/bin/clang-wasi-sysroot.sh)
set(CMAKE_CXX_COMPILER /usr/local/bin/clang++-wasi-sysroot.sh) set(CMAKE_CXX_COMPILER /usr/local/bin/clang++-wasi-sysroot.sh)
set(CMAKE_AR llvm-ar-$ENV{LLVM_VERSION}) set(CMAKE_AR llvm-ar-$ENV{LLVM_VERSION})
set(CMAKE_RANLIB llvm-ranlib-$ENV{LLVM_VERSION}) set(CMAKE_RANLIB llvm-ranlib-$ENV{LLVM_VERSION})
set(CMAKE_ASM_COMPILER clang-$ENV{LLVM_VERSION})
set(CMAKE_C_COMPILER_TARGET $ENV{CROSS_TRIPLE})
set(CMAKE_CXX_COMPILER_TARGET $ENV{CROSS_TRIPLE})
set(CMAKE_ASM_COMPILER_TARGET $ENV{CROSS_TRIPLE})
set(CMAKE_CROSSCOMPILING_EMULATOR /wasi-runtimes/wasmtime/bin/wasmtime-pwd.sh) set(CMAKE_CROSSCOMPILING_EMULATOR /wasi-runtimes/wasmtime/bin/wasmtime-pwd.sh)