From 86280f6199ceab35526f146f9f80294b4fce5318 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Wed, 17 Jan 2024 05:17:20 -0500 Subject: [PATCH] Update Docker and docs (#332) * Update Docker and docs * Don't try to overwrite CMake installation in GHA * Install CMake with apt * Run anghabench on this branch to test fixes * Don't touch anghabench CI file --- Dockerfile | 8 +++--- README.md | 16 ++++++------ scripts/build.sh | 63 +++++++++--------------------------------------- 3 files changed, 22 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90e1450a..371ff08a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -# Choose your LLVM version -ARG LLVM_VERSION=14 -ARG ARCH=amd64 -ARG UBUNTU_VERSION=20.04 +# Choose your LLVM version (only _some_ versions are supported) +ARG LLVM_VERSION=16 +ARG UBUNTU_VERSION=22.04 ARG DISTRO_BASE=ubuntu${UBUNTU_VERSION} ARG BUILD_BASE=ubuntu:${UBUNTU_VERSION} ARG LIBRARIES=/opt/trailofbits @@ -15,7 +14,6 @@ FROM ${BUILD_BASE} as base # https://github.com/lifting-bits/cxx-common/blob/master/docker/Dockerfile.ubuntu.vcpkg FROM ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-v2:${UBUNTU_VERSION} as deps ARG UBUNTU_VERSION -ARG ARCH ARG LLVM_VERSION ARG LIBRARIES diff --git a/README.md b/README.md index 44fa4b8e..b6698be9 100644 --- a/README.md +++ b/README.md @@ -190,8 +190,8 @@ Most of Rellic's dependencies can be provided by the [cxx-common](https://github | [CMake](https://cmake.org/) | 3.21+ | | [Google Flags](https://github.com/google/glog) | Latest | | [Google Log](https://github.com/google/glog) | Latest | -| [LLVM](http://llvm.org/) | 14| -| [Clang](http://clang.llvm.org/) | 14| +| [LLVM](http://llvm.org/) | 16| +| [Clang](http://clang.llvm.org/) | 16| | [Z3](https://github.com/Z3Prover/z3) | 4.7.1+ | ## Pre-made Docker Images @@ -245,7 +245,7 @@ To try out Rellic you can do the following, given a LLVM bitcode file of your ch ```shell # Create some sample bitcode or your own -clang-14 -emit-llvm -c ./tests/tools/decomp/issue_4.c -o ./tests/tools/decomp/issue_4.bc +clang-16 -emit-llvm -c ./tests/tools/decomp/issue_4.c -o ./tests/tools/decomp/issue_4.bc ./rellic-build/tools/rellic-decomp --input ./tests/tools/decomp/issue_4.bc --output /dev/stdout ``` @@ -271,15 +271,13 @@ make -j8 The Docker image should provide an environment which can set-up, build, and run rellic. The Docker images are parameterized by Ubuntu verison, LLVM version, and architecture. -To build the docker image using LLVM 16 for Ubuntu 22.04 on amd64 you can run the following command: +To build the docker image using LLVM 16 for Ubuntu 22.04 you can run the following command: ```sh -ARCH=amd64; UBUNTU=22.04; LLVM=16; docker build . \ - -t rellic:llvm${LLVM}-ubuntu${UBUNTU}-${ARCH} \ +UBUNTU=22.04; LLVM=16; docker build . \ + -t rellic:llvm${LLVM}-ubuntu${UBUNTU} \ -f Dockerfile \ - --platform linux/${ARCH} --build-arg UBUNTU_VERSION=${UBUNTU} \ - --build-arg ARCH=${ARCH} \ --build-arg LLVM_VERSION=${LLVM} ``` @@ -293,7 +291,7 @@ clang-16 -emit-llvm -c ./tests/tools/decomp/issue_4.c -o ./tests/tools/decomp/is docker run --rm -t -i \ -v $(pwd):/test -w /test \ -u $(id -u):$(id -g) \ - rellic:llvm16-ubuntu22.04-amd64 --input ./tests/tools/decomp/issue_4.bc --output /dev/stdout + rellic:llvm16-ubuntu22.04 --input ./tests/tools/decomp/issue_4.bc --output /dev/stdout ``` To explain the above command more: diff --git a/scripts/build.sh b/scripts/build.sh index 2377dcf8..a12647f2 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -19,7 +19,7 @@ CURR_DIR=$( pwd ) BUILD_DIR="${CURR_DIR}/rellic-build" INSTALL_DIR=/usr/local LLVM_VERSION=llvm-16 -CXX_COMMON_VERSION=v0.4.1 +CXX_COMMON_VERSION=v0.6.4 OS_VERSION=unknown ARCH_VERSION=unknown BUILD_FLAGS= @@ -33,42 +33,19 @@ function GetUbuntuOSVersion source /etc/lsb-release case "${DISTRIB_CODENAME}" in - groovy) - echo "[!] Ubuntu 20.10 is not supported; using libraries for Ubuntu 20.04 instead" - OS_VERSION=ubuntu-20.04 + noble) + OS_VERSION=ubuntu-24.04 return 0 ;; jammy) OS_VERSION=ubuntu-22.04 return 0 ;; - focal) - OS_VERSION=ubuntu-20.04 - return 0 - ;; - eoan) - echo "[!] Ubuntu 19.10 is not supported; using libraries for Ubuntu 18.04 instead" - OS_VERSION=ubuntu-18.04 - return 0 - ;; - disco) - echo "[!] Ubuntu 19.04 is not supported; using libraries for Ubuntu 18.04 instead" - OS_VERSION=ubuntu-18.04 - return 0 - ;; - cosmic) - echo "[!] Ubuntu 18.10 is not supported; using libraries for Ubuntu 18.04 instead" - OS_VERSION=ubuntu-18.04 - return 0 - ;; - bionic) - OS_VERSION=ubuntu-18.04 - return 0 - ;; *) echo "[x] Ubuntu ${DISTRIB_CODENAME} is not supported. Only jammy (22.04) are pre-compiled." echo "[x] Please see https://github.com/lifting-bits/cxx-common to build dependencies from source." - return 1 + echo "[x] Attempting to use Ubuntu 22.04 binaries" + OS_VERSION=ubuntu-22.04 ;; esac } @@ -147,12 +124,12 @@ function GetOSVersion ;; *arch*) - OS_VERSION=ubuntu-18.04 + OS_VERSION=ubuntu-22.04 return 0 ;; [Kk]ali) - OS_VERSION=ubuntu-18.04 + OS_VERSION=ubuntu-22.04 return 0; ;; @@ -183,12 +160,12 @@ function DownloadLibraries #BUILD_FLAGS="${BUILD_FLAGS} -DCMAKE_OSX_SYSROOT=${sdk_root}" # Min version supported - OS_VERSION="macos-12" + OS_VERSION="macos-13" # Hard-coded to match pre-built binaries in CI - XCODE_VERSION="14.2" - if [[ "$(sw_vers -productVersion)" == "12."* ]]; then - echo "Found MacOS Monterey" - OS_VERSION="macos-12" + XCODE_VERSION="15.0" + if [[ "$(sw_vers -productVersion)" == "13."* ]]; then + echo "Found MacOS Ventura" + OS_VERSION="macos-13" else echo "WARNING: ****Likely unsupported MacOS Version****" echo "WARNING: ****Using ${OS_VERSION}****" @@ -326,22 +303,6 @@ function Package function GetLLVMVersion { case ${1} in - 12) - LLVM_VERSION=llvm-12 - return 0 - ;; - 13) - LLVM_VERSION=llvm-13 - return 0 - ;; - 14) - LLVM_VERSION=llvm-14 - return 0 - ;; - 15) - LLVM_VERSION=llvm-15 - return 0 - ;; 16) LLVM_VERSION=llvm-16 return 0