From 15a18dc374f9dbabcaf078a4b6f7218c3387c5b6 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Sat, 25 Mar 2023 16:37:49 +0900 Subject: [PATCH] Update docker build to use LLVM 16 (#316) --- docker/Dockerfile | 9 +++------ docker/wasi-sdk.cmake | 9 +++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 12312c8..610de47 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,6 +9,7 @@ FROM ubuntu:22.04 as dist ADD dist/wasi-sdk-*.*-linux.tar.gz / +ADD dist/libclang_rt.builtins-wasm32-wasi-*.*.tar.gz /wasi-sysroot-clang_rt # Move versioned folder to unversioned to using bash glob to allow # this file to be independent of major version number. @@ -16,7 +17,7 @@ RUN mv /wasi-sdk-* /wasi-sdk FROM ubuntu:22.04 -ENV LLVM_VERSION 15 +ENV LLVM_VERSION 16 # Install build toolchain including clang, ld, make, autotools, ninja, and cmake RUN apt-get update && \ @@ -33,11 +34,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* COPY --from=dist /wasi-sdk/share/wasi-sysroot/ /wasi-sysroot/ -# The path to the rt directory contains the LLVM patch version which is not reflected in the LLVM apt repository -# or package. To make adding the RT robust to changing patch versions without needing to duplicate the folder -# content, we symlink after extracting using a bash glob to resolve the patch version -ADD dist/libclang_rt.builtins-wasm32-wasi-*.*.tar.gz /wasi-sysroot-clang_rt -RUN ln -s /wasi-sysroot-clang_rt/lib/wasi/ $(echo /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}.*)/lib/wasi +COPY --from=dist /wasi-sysroot-clang_rt/lib/wasi /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}/lib/wasi ADD docker/wasi-sdk.cmake /usr/share/cmake/wasi-sdk.cmake ENV CMAKE_TOOLCHAIN_FILE /usr/share/cmake/wasi-sdk.cmake diff --git a/docker/wasi-sdk.cmake b/docker/wasi-sdk.cmake index b87c948..f2f3229 100644 --- a/docker/wasi-sdk.cmake +++ b/docker/wasi-sdk.cmake @@ -11,10 +11,11 @@ set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR wasm32) set(triple wasm32-wasi) -set(CMAKE_C_COMPILER /usr/bin/clang-15) -set(CMAKE_CXX_COMPILER /usr/bin/clang++-15) -set(CMAKE_AR /usr/bin/llvm-ar-15) -set(CMAKE_RANLIB /usr/bin/llvm-ranlib-15) +set(CMAKE_C_COMPILER /usr/bin/clang-$ENV{LLVM_VERSION}) +set(CMAKE_CXX_COMPILER /usr/bin/clang++-$ENV{LLVM_VERSION}) +set(CMAKE_ASM_COMPILER /usr/bin/clang-$ENV{LLVM_VERSION}) +set(CMAKE_AR /usr/bin/llvm-ar-$ENV{LLVM_VERSION}) +set(CMAKE_RANLIB /usr/bin/llvm-ranlib-$ENV{LLVM_VERSION}) set(CMAKE_C_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER_TARGET ${triple}) SET(CMAKE_SYSROOT /wasi-sysroot)