Skip to content

Commit

Permalink
Update wheel build script for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheitman committed Dec 6, 2023
1 parent f055237 commit 7ec9769
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
33 changes: 14 additions & 19 deletions src/scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ RUN mkdir -p $DEPENDENCIES_DIR
# Download, build and install GMP.
RUN echo "[+] Download, build and install GMP" && \
cd $DEPENDENCIES_DIR && \
wget -q https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz && \
tar -xf gmp-6.2.1.tar.xz && \
cd gmp-6.2.1 && \
wget -q https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz -O gmp-6.3.0.tar.xz && \
tar -xf gmp-6.3.0.tar.xz && \
cd gmp-6.3.0 && \
./configure --enable-cxx && \
make && \
make -j $(nproc) && \
make install

# Download, build and install Bitwuzla.
Expand All @@ -35,27 +35,22 @@ RUN echo "[+] Download, build and install Bitwuzla" && \
git clone https://github.com/bitwuzla/bitwuzla.git && \
cd bitwuzla && \
git checkout -b 0.2.0 0.2.0 && \
CC=clang CXX=clang++ PATH=$PATH:/opt/_internal/cpython-3.10.13/bin python3.10 ./configure.py --shared --prefix $(pwd)/install && \
export PY310_PATH=$(dirname $(realpath -L $(which python3.10))) && \
CC=clang CXX=clang++ PATH=$PATH:$PY310_PATH python3.10 ./configure.py --shared --prefix $(pwd)/install && \
cd build && \
PATH=$PATH:/opt/_internal/cpython-3.10.13/bin ninja install
PATH=$PATH:$PY310_PATH ninja -j $(nproc) install

# Download Z3.
RUN echo "[+] Download Z3" && \
cd $DEPENDENCIES_DIR && \
wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.8.17/z3-4.8.17-x64-glibc-2.31.zip && \
unzip z3-4.8.17-x64-glibc-2.31.zip
cd $DEPENDENCIES_DIR && \
wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.12.2/z3-4.12.2-x64-glibc-2.31.zip && \
unzip -q z3-4.12.2-x64-glibc-2.31.zip

# Download, build and install Capstone.
RUN echo "[+] Download, build and install Capstone" && \
cd $DEPENDENCIES_DIR && \
wget -q https://github.com/aquynh/capstone/archive/4.0.2.tar.gz -O capstone-4.0.2.tar.gz && \
tar -xf capstone-4.0.2.tar.gz && \
cd capstone-4.0.2 && \
bash ./make.sh && \
wget -q https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.1.tar.gz -O capstone-5.0.1.tar.gz && \
tar xf capstone-5.0.1.tar.gz && \
cd ./capstone-5.0.1 && \
./make.sh && \
sudo make install

# Download LLVM.
RUN echo "[+] Download LLVM" && \
cd $DEPENDENCIES_DIR && \
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz && \
tar -xf clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
14 changes: 9 additions & 5 deletions src/scripts/docker/build-wheel-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#
# $ docker pull quay.io/pypa/manylinux_2_28_x86_64
# $ ./src/scripts/docker/build-docker-image.sh
# $ docker run --rm -v $(pwd):/src build-triton-linux-x86_64 bash /src/src/scripts/docker/build-wheel-linux.sh
# $ docker run \
# --rm \
# -v $(pwd):/src \
# -v /tmp/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04:/llvm \
# build-triton-linux-x86_64 bash /src/src/scripts/docker/build-wheel-linux.sh
#
# You'll find the .whl packages in the wheel-final folder.

Expand All @@ -20,10 +24,10 @@ WHEEL_DIR=$SOURCE_DIR/wheelhouse

# Set environment variables for building Triton.
echo "[+] Setup environment variables"
export Z3_INCLUDE_DIRS=$DEPENDENCIES_DIR/z3-4.8.17-x64-glibc-2.31/include
export Z3_LIBRARIES=$DEPENDENCIES_DIR/z3-4.8.17-x64-glibc-2.31/bin/libz3.a
export Z3_INCLUDE_DIRS=$DEPENDENCIES_DIR/z3-4.12.2-x64-glibc-2.31/include
export Z3_LIBRARIES=$DEPENDENCIES_DIR/z3-4.12.2-x64-glibc-2.31/bin/libz3.so
export CAPSTONE_INCLUDE_DIRS=/usr/include
export CAPSTONE_LIBRARIES=/usr/lib/libcapstone.a
export CAPSTONE_LIBRARIES=/usr/lib/libcapstone.so
export BITWUZLA_INTERFACE=On
export BITWUZLA_INCLUDE_DIRS=$DEPENDENCIES_DIR/bitwuzla/install/include
export BITWUZLA_LIBRARIES=$DEPENDENCIES_DIR/bitwuzla/install/lib64/libbitwuzla.so
Expand Down Expand Up @@ -70,7 +74,7 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64
echo "[+] Repair wheel packages"
cd $SOURCE_DIR
for whl in $WHEEL_DIR/linux_x86_64/*.whl; do
auditwheel repair "$whl" --wheel-dir $WHEEL_DIR/manylinux_2_28_x86_64
auditwheel repair --plat manylinux_2_31_x86_64 "$whl" --wheel-dir $WHEEL_DIR/manylinux_2_31_x86_64
done

echo "[+] Remove build directory"
Expand Down

0 comments on commit 7ec9769

Please sign in to comment.