Skip to content

Commit

Permalink
Merge branch 'dev-v1.0' of github.com:JonathanSalwan/Triton into dev-…
Browse files Browse the repository at this point in the history
…v1.0
  • Loading branch information
Triton Library committed Dec 5, 2023
2 parents 2cf216d + 83332bb commit 6ef9008
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Timestamp Variable
run: echo "TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
- name: Build the Docker image
run: docker build . --file Dockerfile --tag triton-docker:$(date +%s)
run: docker build . --file Dockerfile --tag triton-docker:$TIMESTAMP
- name: Run test cases
run: docker run --entrypoint /bin/bash --rm triton-docker:$TIMESTAMP -c 'ctest --test-dir /tmp/triton-build/ --output-on-failure'
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM --platform=linux/amd64 ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

COPY . /Triton

# libboost >= 1.68
# libpython >= 3.6
# llvm >= 12
Expand All @@ -23,15 +25,13 @@ RUN cd /tmp && \
ninja install && \
ldconfig

# To test pre-releases 'pip install' the corresponding .whl from https://github.com/Z3Prover/z3/releases/tag/Nightly
# libz3 >= 4.6.0
RUN cd /tmp && \
curl -o z3.tgz -L https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.8.14.tar.gz && \
tar zxf z3.tgz && cd z3-z3-4.8.14 && mkdir build && cd build && \
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4 && make install && \
pip3 install z3-solver && rm -rf /tmp/z3*
RUN pip3 install z3-solver==4.8.14

# Triton (LLVM for lifting; z3 or bitwuzla as SMT solver)
RUN git clone https://github.com/JonathanSalwan/Triton && cd Triton && mkdir build && cd build && cmake -DLLVM_INTERFACE=ON -DCMAKE_PREFIX_PATH=$(/usr/lib/llvm-12/bin/llvm-config --prefix) -DZ3_INTERFACE=ON -DBITWUZLA_INTERFACE=ON -DBITWUZLA_INCLUDE_DIRS=/usr/local/include -DBITWUZLA_LIBRARIES=/usr/local/lib/x86_64-linux-gnu/libbitwuzla.so .. && make -j4 && make install
RUN PYV=`python3 -c "import platform;print(platform.python_version()[:3])"` && \
# Triton (LLVM for lifting; z3 or bitwuzla as SMT solver)
cd /Triton && mkdir /tmp/triton-build && cd /tmp/triton-build && cmake -DLLVM_INTERFACE=ON -DCMAKE_PREFIX_PATH=$(/usr/lib/llvm-12/bin/llvm-config --prefix) -DZ3_INTERFACE=ON -DZ3_INCLUDE_DIRS=/usr/local/lib/python$PYV/dist-packages/z3/include/ -DZ3_LIBRARIES=/usr/local/lib/python$PYV/dist-packages/z3/lib/libz3.so -DBITWUZLA_INTERFACE=ON -DBITWUZLA_INCLUDE_DIRS=/usr/local/include -DBITWUZLA_LIBRARIES=/usr/local/lib/x86_64-linux-gnu/libbitwuzla.so /Triton && make -j$(nproc) && make install

RUN PYV=`python3 -c "import platform;print(platform.python_version()[:3])"` && \
PYP="/usr/lib/python$PYV/site-packages" && \
Expand All @@ -40,4 +40,7 @@ RUN PYV=`python3 -c "import platform;print(platform.python_version()[:3])"` && \
# Next command fails if Triton has no z3 or bitwuzla support
PYTHONPATH="$PYP" python3 -c "from triton import *; ctx=TritonContext(ARCH.X86_64); ctx.setSolver(SOLVER.Z3); ctx.setSolver(SOLVER.BITWUZLA);"

# Dependencies required for testing
RUN pip install unicorn==2.0.0 lief

ENTRYPOINT /bin/bash

0 comments on commit 6ef9008

Please sign in to comment.