Skip to content

Commit

Permalink
actually use the crosscompilers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Aug 27, 2024
1 parent f1d9ff8 commit f3b48fd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ LABEL org.opencontainers.image.source=https://github.com/halide/docker-images

WORKDIR /ws

## Install wget
#RUN yum -y install wget

## Install Ninja
RUN git clone --depth 1 --branch v1.12.1 https://github.com/ninja-build/ninja.git && \
ARG NINJA_VERSION=v1.12.1
RUN git clone --depth 1 --branch ${NINJA_VERSION} https://github.com/ninja-build/ninja.git && \
cmake -S ninja -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF && \
cmake --build build --target install -j "$(nproc)" && \
rm -rf ninja build

## Install flatbuffers
ARG FB_VERSION=23.5.26
RUN wget -q https://github.com/google/flatbuffers/archive/refs/tags/v${FB_VERSION}.tar.gz && \
tar xvf v${FB_VERSION}.tar.gz && \
rm v${FB_VERSION}.tar.gz && \
cmake -G Ninja -S flatbuffers-${FB_VERSION} -B build \
ARG FB_VERSION=v23.5.26
RUN git clone --depth 1 --branch ${FB_VERSION} https://github.com/google/flatbuffers.git && \
cmake -G Ninja -S flatbuffers -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$TARGET_CC \
-DCMAKE_CXX_COMPILER=$TARGET_CXX \
-DFLATBUFFERS_BUILD_TESTS=OFF \
&& \
cmake --build build --target install && \
rm -rf flatbuffers-${FB_VERSION} build
rm -rf flatbuffers build

## Install flatbuffers
ARG WABT_VERSION=1.0.36
RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/wabt.git && \
git -C wabt submodule update --init third_party/picosha2 && \
cmake -G Ninja -S wabt -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$TARGET_CC \
-DCMAKE_CXX_COMPILER=$TARGET_CXX \
-DWITH_EXCEPTIONS=ON \
-DBUILD_TESTS=OFF \
-DBUILD_TOOLS=OFF \
Expand All @@ -41,16 +41,16 @@ RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/
cmake --build build --target install && \
rm -rf wabt build

## Install LLVM
# Install LLVM
ARG LLVM_TAG=llvmorg-18.1.8
RUN wget -q https://github.com/llvm/llvm-project/archive/refs/tags/${LLVM_TAG}.tar.gz && \
tar xf ${LLVM_TAG}.tar.gz && \
rm ${LLVM_TAG}.tar.gz && \
cmake -G Ninja -S llvm-project-${LLVM_TAG}/llvm -B build \
RUN git clone --depth 1 --branch ${LLVM_TAG} https://github.com/llvm/llvm-project.git && \
cmake -G Ninja -S llvm-project/llvm -B build \
"-DLLVM_ENABLE_PROJECTS=clang;lld" \
"-DLLVM_ENABLE_RUNTIMES=compiler-rt" \
"-DLLVM_TARGETS_TO_BUILD=WebAssembly;X86;AArch64;ARM;Hexagon;NVPTX;PowerPC;RISCV" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$TARGET_CC \
-DCMAKE_CXX_COMPILER=$TARGET_CXX \
-DLLVM_BUILD_32_BITS=OFF \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
Expand All @@ -72,4 +72,4 @@ RUN wget -q https://github.com/llvm/llvm-project/archive/refs/tags/${LLVM_TAG}.t
-DLLVM_INCLUDE_TESTS=OFF \
&& \
cmake --build build --target install && \
rm -rf llvm-project-${LLVM_TAG} build
rm -rf llvm-project build
23 changes: 11 additions & 12 deletions build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ set -eo pipefail

[[ "$1" == "" ]] && echo "You must specify the LLVM version as an argument, e.g. 17.0.6" && exit

LLVM_TAG=$1
LLVM_TAG="$1"

docker build \
--tag "ghcr.io/halide/manylinux_2_28_aarch64-llvm:$LLVM_TAG" \
--build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \
--build-arg "ARCH=aarch64" \
.

docker build \
--tag "ghcr.io/halide/manylinux_2_28_x86_64-llvm:$LLVM_TAG" \
--build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \
--build-arg "ARCH=x86_64" \
.
build_arch () {
ARCH="$1"
docker build \
--tag "ghcr.io/halide/manylinux_2_28_$ARCH-llvm:$LLVM_TAG" \
--build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \
--build-arg "ARCH=$ARCH" \
.
}

build_arch aarch64
build_arch x86_64
6 changes: 5 additions & 1 deletion reset-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi
##
# Remove all images

docker image prune
docker image prune -f

read -ra images < <(docker images -qa) || true
if ((${#images[@]} != 0)); then
Expand All @@ -37,3 +37,7 @@ if ((${#volumes[@]} != 0)); then
else
echo "No volumes to remove"
fi

##
# Remove everything else
docker system prune -af --volumes

0 comments on commit f3b48fd

Please sign in to comment.