Skip to content

Commit

Permalink
Fix inconsistent Z3 dependency and missing testing dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-carrasco authored and cnheitman committed Dec 5, 2023
1 parent f23afb1 commit 66222f7
Showing 1 changed file with 10 additions and 7 deletions.
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.12.2

# 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 66222f7

Please sign in to comment.