Skip to content

Commit d5ec1eb

Browse files
kyle-elliott-tobclaude
authored andcommitted
Retire cxx-common Docker build path
The root Dockerfile built remill via scripts/build.sh against cxx-common v0.6.0, which pins Intel XED v2022.04.17. lib/Arch/X86/Arch.cpp now references AVX-512 ISA-set enums that only exist in newer XED, so that build path fails to compile (issue #780). cxx-common is no longer supported. Remove the cxx-common Dockerfile and rename Dockerfile.llvm to Dockerfile so the only Docker build uses the dependencies/ superbuild, matching build.yml and the README (XED v2025.06.08). Delete the now-unused scripts/build.sh and scripts/travis.bat, and point docker-publish.yml at the renamed Dockerfile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2d76a91 commit d5ec1eb

5 files changed

Lines changed: 97 additions & 904 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
uses: docker/build-push-action@v5
5858
with:
5959
context: .
60-
file: ./Dockerfile.llvm
60+
file: ./Dockerfile
6161
push: ${{ github.event_name != 'pull_request' }}
6262
tags: ${{ steps.meta.outputs.tags }}
6363
labels: ${{ steps.meta.outputs.labels }}
@@ -73,7 +73,7 @@ jobs:
7373
docker build \
7474
--build-arg LLVM_VERSION=${{ matrix.llvm }} \
7575
--build-arg UBUNTU_VERSION=24.04 \
76-
-f Dockerfile.llvm \
76+
-f Dockerfile \
7777
-t test-image .
7878
docker run --rm test-image --version
7979
docker run --rm test-image --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000

Dockerfile

Lines changed: 95 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,110 @@
1-
# Choose your LLVM version
2-
ARG LLVM_VERSION=17
3-
ARG UBUNTU_VERSION=24.04
4-
ARG DISTRO_BASE=ubuntu${UBUNTU_VERSION}
5-
ARG BUILD_BASE=ubuntu:${UBUNTU_VERSION}
6-
ARG LIBRARIES=/opt/trailofbits
1+
# Dockerfile for building remill with specific LLVM versions from apt.llvm.org
2+
# This approach supports newer LLVM versions (19, 22, etc.)
73

4+
ARG LLVM_VERSION=22
5+
ARG UBUNTU_VERSION=24.04
86

9-
# Run-time dependencies go here
10-
FROM ${BUILD_BASE} as base
7+
FROM ubuntu:${UBUNTU_VERSION} AS builder
118

12-
# Build-time dependencies go here
13-
# See here for full list of those dependencies
14-
# https://github.com/lifting-bits/cxx-common/blob/master/docker/Dockerfile.ubuntu.vcpkg
15-
FROM ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-v2:${UBUNTU_VERSION} as deps
16-
ARG UBUNTU_VERSION
179
ARG LLVM_VERSION
18-
ARG LIBRARIES
10+
ARG DEBIAN_FRONTEND=noninteractive
1911

20-
RUN apt-get update && \
21-
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 && \
22-
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 && \
23-
rm -rf /var/lib/apt/lists/*
12+
# Install build dependencies
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
lsb-release \
15+
wget \
16+
software-properties-common \
17+
gnupg \
18+
cmake \
19+
ninja-build \
20+
python-is-python3 \
21+
python3-pip \
22+
python3-setuptools \
23+
python3-venv \
24+
git \
25+
ca-certificates \
26+
&& rm -rf /var/lib/apt/lists/*
2427

25-
# Source code build
26-
FROM deps as build
27-
ARG LLVM_VERSION
28+
# Install LLVM from apt.llvm.org
29+
RUN wget https://apt.llvm.org/llvm.sh && \
30+
chmod +x llvm.sh && \
31+
./llvm.sh ${LLVM_VERSION} && \
32+
apt-get install -y --no-install-recommends llvm-${LLVM_VERSION}-dev && \
33+
rm -rf /var/lib/apt/lists/* llvm.sh
34+
35+
# Set environment variables for build
36+
ENV LLVM_VERSION=${LLVM_VERSION}
37+
ENV CC=clang-${LLVM_VERSION}
38+
ENV CXX=clang++-${LLVM_VERSION}
2839

2940
WORKDIR /remill
30-
COPY ./ ./
3141

32-
RUN git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
42+
# Copy source code
43+
COPY . .
44+
45+
# Configure git (needed for version detection)
46+
RUN git config --global user.email "docker@remill.local" && \
47+
git config --global user.name "Docker Build" && \
48+
git config --global --add safe.directory /remill
49+
50+
# Get LLVM prefix
51+
RUN echo "LLVM_PREFIX=$(llvm-config-${LLVM_VERSION} --prefix)" > /tmp/llvm_env
52+
53+
# Build dependencies (XED, etc.)
54+
RUN . /tmp/llvm_env && \
55+
cmake -G Ninja -S dependencies -B dependencies/build \
56+
-DUSE_EXTERNAL_LLVM=ON \
57+
"-DCMAKE_PREFIX_PATH=${LLVM_PREFIX}" && \
58+
cmake --build dependencies/build
3359

34-
RUN ./scripts/build.sh \
35-
--llvm-version ${LLVM_VERSION} \
36-
--prefix /opt/trailofbits \
37-
--extra-cmake-args "-DCMAKE_BUILD_TYPE=Release" \
38-
--disable-package
60+
# Setup Python venv for tests
61+
RUN python3 -m venv /opt/venv && \
62+
/opt/venv/bin/pip install --no-cache-dir scripts/diff_tester_export_insns
3963

40-
RUN pip3 install ./scripts/diff_tester_export_insns
64+
# Build remill
65+
RUN . /tmp/llvm_env && \
66+
. /opt/venv/bin/activate && \
67+
cmake -G Ninja -B build \
68+
"-DCMAKE_PREFIX_PATH=${LLVM_PREFIX};/remill/dependencies/install" \
69+
"-DCMAKE_INSTALL_PREFIX=/opt/remill" \
70+
-DCMAKE_BUILD_TYPE=Release && \
71+
cmake --build build
4172

42-
# NOTE: At time of writing, tests only pass on x86_64 architecture
43-
RUN cd remill-build && \
44-
cmake --build . --target test_dependencies -- -j $(nproc) && \
45-
CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --verbose --target test -- -j $(nproc) || [ "$(uname -m)" != "x86_64" ] && \
46-
cmake --build . --target install
73+
# Run tests
74+
RUN cmake --build build --target test_dependencies && \
75+
env CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
76+
77+
# Install
78+
RUN cmake --install build
79+
80+
# Runtime image
81+
FROM ubuntu:${UBUNTU_VERSION} AS runtime
4782

48-
# Small installation image
49-
FROM base as install
5083
ARG LLVM_VERSION
84+
ARG DEBIAN_FRONTEND=noninteractive
85+
86+
# Install runtime dependencies
87+
RUN apt-get update && apt-get install -y --no-install-recommends \
88+
wget \
89+
gnupg \
90+
lsb-release \
91+
software-properties-common \
92+
ca-certificates \
93+
&& wget https://apt.llvm.org/llvm.sh \
94+
&& chmod +x llvm.sh \
95+
&& ./llvm.sh ${LLVM_VERSION} \
96+
&& apt-get install -y --no-install-recommends llvm-${LLVM_VERSION} \
97+
&& rm -rf /var/lib/apt/lists/* llvm.sh
98+
99+
# Copy remill installation
100+
COPY --from=builder /opt/remill /opt/remill
101+
102+
# Set environment
103+
ENV LLVM_VERSION=${LLVM_VERSION}
104+
ENV PATH="/opt/remill/bin:${PATH}"
105+
106+
# Create entrypoint script
107+
RUN echo '#!/bin/sh\nexec remill-lift-'${LLVM_VERSION}' "$@"' > /usr/local/bin/entrypoint.sh && \
108+
chmod +x /usr/local/bin/entrypoint.sh
51109

52-
COPY --from=build /opt/trailofbits /opt/trailofbits
53-
COPY scripts/docker-lifter-entrypoint.sh /opt/trailofbits
54-
ENV LLVM_VERSION=llvm${LLVM_VERSION} \
55-
PATH=/opt/trailofbits/bin
56-
ENTRYPOINT ["/opt/trailofbits/docker-lifter-entrypoint.sh"]
110+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

Dockerfile.llvm

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)