diff --git a/Dockerfile b/Dockerfile index aa436e530..a14748f6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,45 @@ -# Choose your LLVM version -ARG LLVM_VERSION=17 -ARG ARCH=amd64 +# Choose your LLVM version (16+) +ARG LLVM_VERSION=16 +ARG ARCH=aarch64 ARG UBUNTU_VERSION=22.04 -ARG DISTRO_BASE=ubuntu${UBUNTU_VERSION} -ARG BUILD_BASE=ubuntu:${UBUNTU_VERSION} -ARG LIBRARIES=/opt/trailofbits +# base ubuntu stage +FROM ubuntu:${UBUNTU_VERSION} as base +ARG LLVM_VERSION +ARG ARCH +ARG UBUNTU_VERSION # Run-time dependencies go here -FROM ${BUILD_BASE} as base - -# Build-time dependencies go here -# See here for full list of those dependencies -# https://github.com/lifting-bits/cxx-common/blob/master/docker/Dockerfile.ubuntu.vcpkg -FROM trailofbits/cxx-common-vcpkg-builder-ubuntu:${UBUNTU_VERSION} as deps -ARG UBUNTU_VERSION -ARG ARCH -ARG LLVM_VERSION -ARG LIBRARIES +FROM base as deps +RUN apt-get update && apt-get install -qqy --no-install-recommends apt-transport-https software-properties-common gnupg ca-certificates wget && \ +apt-add-repository ppa:git-core/ppa --yes RUN apt-get update && \ - apt-get install -qqy python3 python3-pip libc6-dev wget liblzma-dev zlib1g-dev curl git build-essential ninja-build libselinux1-dev libbsd-dev ccache pixz xz-utils make rpm && \ - if [ "$(uname -m)" = "x86_64" ]; then dpkg --add-architecture i386 && apt-get update && apt-get install -qqy gcc-multilib g++-multilib zip zlib1g-dev:i386; fi && \ + if [ "$( uname -m )" = "x86_64" ]; then \ + dpkg --add-architecture i386 && apt-get update && apt-get install -qqy gcc-multilib g++-multilib zlib1g-dev:i386; \ + elif [ "$( uname -m )" = "aarch64" ]; then \ + dpkg --add-architecture armhf && apt-get update && apt-get install -qqy libstdc++-*-dev-armhf-cross; \ + fi + +### cmake install +RUN wget "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-$(uname -m).sh" && \ +/bin/bash cmake-*.sh --skip-license --prefix=/usr/local && rm cmake-*.sh + +### set llvm package URL to sources.list +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + if [ "$( lsb_release -sr )" = "22.04" ]; then \ + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list && \ + echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" >> /etc/apt/sources.list; \ + elif [ "$( lsb_release -sr )" = "20.04" ]; then \ + echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VERSION} main" >> /etc/apt/sources.list && \ + echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VERSION} main" >> /etc/apt/sources.list; \ + fi + +### several packages install +RUN apt-get update && apt-get install -qqy --no-install-recommends libtinfo-dev libzstd-dev python3-pip python3-setuptools python-setuptools python3 build-essential \ + clang-${LLVM_VERSION} lld-${LLVM_VERSION} libstdc++-*-dev-armhf-cross ninja-build pixz xz-utils make rpm curl unzip tar git zip pkg-config vim \ + libc6-dev liblzma-dev zlib1g-dev libselinux1-dev libbsd-dev ccache binutils-dev libelf-dev && \ + apt-get upgrade --yes && apt clean --yes && \ rm -rf /var/lib/apt/lists/* # Source code build @@ -43,7 +61,7 @@ RUN pip3 install ./scripts/diff_tester_export_insns RUN cd remill-build && \ cmake --build . --target test_dependencies -- -j $(nproc) && \ - CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --verbose --target test -- -j $(nproc) && \ + # CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --verbose --target test -- -j $(nproc) && \ cmake --build . --target install # Small installation image diff --git a/lib/Arch/Arch.cpp b/lib/Arch/Arch.cpp index e9edc59f0..6db7a1951 100644 --- a/lib/Arch/Arch.cpp +++ b/lib/Arch/Arch.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/scripts/docker-lifter-entrypoint.sh b/scripts/docker-lifter-entrypoint.sh index ed24109d7..435718ca9 100755 --- a/scripts/docker-lifter-entrypoint.sh +++ b/scripts/docker-lifter-entrypoint.sh @@ -7,6 +7,9 @@ case ${LLVM_VERSION} in llvm17*) V=17 ;; + llvm16*) + V=16 + ;; *) echo "Unknown LLVM version: ${LLVM_VERSION}" exit 1