diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 792f2b693..e9477c6ec 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -49,7 +49,7 @@ jobs: run: | git clone https://github.com/bitwuzla/bitwuzla.git cd bitwuzla - git checkout -b 0.4.0 0.4.0 + git checkout -b 0.7.0 0.7.0 python ./configure.py --shared cd build sudo ninja install @@ -58,9 +58,9 @@ jobs: - name: Install Capstone run: | - wget https://github.com/aquynh/capstone/archive/5.0.1.tar.gz - tar -xf ./5.0.1.tar.gz - cd ./capstone-5.0.1 + wget https://github.com/aquynh/capstone/archive/5.0.3.tar.gz + tar -xf ./5.0.3.tar.gz + cd ./capstone-5.0.3 bash ./make.sh sudo make install cd ../ diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7977548e4..6f50adb3a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,7 +9,7 @@ jobs: matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] boost-interface: ['ON', 'OFF'] - capstone-version: ['5.0.1'] + capstone-version: ['5.0.3'] steps: - name: Checkout uses: actions/checkout@v4 @@ -52,7 +52,7 @@ jobs: run: | git clone https://github.com/bitwuzla/bitwuzla.git cd bitwuzla - git checkout -b 0.4.0 0.4.0 + git checkout -b 0.7.0 0.7.0 python ./configure.py --shared cd build sudo ninja install diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 73ddc9688..baea66b40 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -128,10 +128,10 @@ jobs: - name: Download and build Capstone run: | - wget -UseBasicParsing https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.1.zip -O capstone-5.0.1.zip - tar -xf capstone-5.0.1.zip - mkdir -p capstone-5.0.1/build - cd capstone-5.0.1/build + wget -UseBasicParsing https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.3.zip -O capstone-5.0.3.zip + tar -xf capstone-5.0.3.zip + mkdir -p capstone-5.0.3/build + cd capstone-5.0.3/build ../nmake.bat shell: powershell @@ -143,8 +143,8 @@ jobs: PYTHON_LIBRARY: ${{ env.pythonLocation }}\libs\${{ matrix.pylib }} Z3_INCLUDE_DIRS: ${{ github.workspace }}\z3-4.12.2-x64-win\include Z3_LIBRARIES: ${{ github.workspace }}\z3-4.12.2-x64-win\bin\libz3.lib - CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}\capstone-5.0.1\include - CAPSTONE_LIBRARIES: ${{ github.workspace }}\capstone-5.0.1\build\capstone.lib + CAPSTONE_INCLUDE_DIRS: ${{ github.workspace }}\capstone-5.0.3\include + CAPSTONE_LIBRARIES: ${{ github.workspace }}\capstone-5.0.3\build\capstone.lib - name: Repair wheel package run: | @@ -159,121 +159,121 @@ jobs: path: ${{ github.workspace }}\wheelhouse\windows_x86_64\triton_library-${{ env.package-version }}-${{ matrix.pycp }}-win_amd64.whl if-no-files-found: warn - - build-macos: - # macos-13 = x86 - # macos-14 = arm (M1) - runs-on: macos-12 - strategy: - matrix: - python-version: ['3.8', '3.9', '3.10'] - include: - - python-version: 3.8 - pycp: cp38-cp38 - - python-version: 3.9 - pycp: cp39-cp39 - - python-version: 3.10 - pycp: cp310-cp310 - # - python-version: 3.11 - # pycp: cp311-cp311 - # - python-version: 3.12 - # pycp: cp312-cp312 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: "14.0" - directory: ${{ runner.temp }}/llvm - - - name: Upgrade pip version - run: | - sudo python -m pip install -U pip - - - name: Install build package - run: | - sudo python -m pip install build - - - name: Install Meson - run: | - python -m pip install meson - - - name: Install Bitwuzla - run: | - git clone https://github.com/bitwuzla/bitwuzla.git - cd bitwuzla - git checkout -b 0.4.0 0.4.0 - python ./configure.py --shared --prefix $(pwd)/install - cd build - sudo ninja install - - - name: Download Z3 - run: | - wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.12.2/z3-4.12.2-x64-osx-10.16.zip -O z3-4.12.2-x64-osx-10.16.zip - unzip z3-4.12.2-x64-osx-10.16.zip - - - name: Install Capstone - run: | - 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 - - - name: Build Triton Python package - run: python -m build --wheel --outdir wheelhouse/default_x86_64 - env: - Z3_INTERFACE: On - Z3_INCLUDE_DIRS: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/include - Z3_LIBRARIES: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/bin/libz3.a - BITWUZLA_INTERFACE: On - BITWUZLA_INCLUDE_DIRS: ${{ github.workspace }}/bitwuzla/install/include - BITWUZLA_LIBRARIES: ${{ github.workspace }}/bitwuzla/install/lib/libbitwuzla.dylib - CAPSTONE_INCLUDE_DIRS: /usr/local/include - CAPSTONE_LIBRARIES: /usr/local/lib/libcapstone.a - LLVM_INTERFACE: On - CMAKE_PREFIX_PATH: ${{env.LLVM_PATH}} - BOOST_INTERFACE: Off - - - name: Repair wheel package - run: | - pip install delocate==0.10.4 - - python ${{ github.workspace }}/src/scripts/macos/delocate-wheel-custom.py \ - --verbose \ - --wheel-dir wheelhouse/repaired_x86_64 \ - ${{ github.workspace }}/wheelhouse/default_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl - - - name: Test wheel package - run: | - pip install virtualenv - - virtualenv test-venv - source test-venv/bin/activate - - pip install ${{ github.workspace }}/wheelhouse/repaired_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl - - python -c "import triton" - - pip install capstone - pip install lief - pip install unicorn==2.0.0 - pip install z3-solver==4.12.2 - - cd ${{ github.workspace }}/src/testers - python -m unittest discover -b -v unittests - deactivate - - - name: Upload wheel package - uses: actions/upload-artifact@v4 - with: - name: triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl - path: ${{ github.workspace }}/wheelhouse/repaired_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl - if-no-files-found: warn + # NOTE Temporarily disabled until issues with macos-14 get resolved. + # build-macos: + # # macos-13 = x86 + # # macos-14 = arm (M1) + # runs-on: macos-12 + # strategy: + # matrix: + # python-version: ['3.8', '3.9', '3.10'] + # include: + # - python-version: 3.8 + # pycp: cp38-cp38 + # - python-version: 3.9 + # pycp: cp39-cp39 + # - python-version: 3.10 + # pycp: cp310-cp310 + # # - python-version: 3.11 + # # pycp: cp311-cp311 + # # - python-version: 3.12 + # # pycp: cp312-cp312 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + + # - name: Install LLVM and Clang + # uses: KyleMayes/install-llvm-action@v2 + # with: + # version: "14.0" + # directory: ${{ runner.temp }}/llvm + + # - name: Upgrade pip version + # run: | + # sudo python -m pip install -U pip + + # - name: Install build package + # run: | + # sudo python -m pip install build + + # - name: Install Meson + # run: | + # python -m pip install meson + + # - name: Install Bitwuzla + # run: | + # git clone https://github.com/bitwuzla/bitwuzla.git + # cd bitwuzla + # git checkout -b 0.4.0 0.4.0 + # python ./configure.py --shared --prefix $(pwd)/install + # cd build + # sudo ninja install + + # - name: Download Z3 + # run: | + # wget -q https://github.com/Z3Prover/z3/releases/download/z3-4.12.2/z3-4.12.2-x64-osx-10.16.zip -O z3-4.12.2-x64-osx-10.16.zip + # unzip z3-4.12.2-x64-osx-10.16.zip + + # - name: Install Capstone + # run: | + # 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 + + # - name: Build Triton Python package + # run: python -m build --wheel --outdir wheelhouse/default_x86_64 + # env: + # Z3_INTERFACE: On + # Z3_INCLUDE_DIRS: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/include + # Z3_LIBRARIES: ${{ github.workspace }}/z3-4.12.2-x64-osx-10.16/bin/libz3.a + # BITWUZLA_INTERFACE: On + # BITWUZLA_INCLUDE_DIRS: ${{ github.workspace }}/bitwuzla/install/include + # BITWUZLA_LIBRARIES: ${{ github.workspace }}/bitwuzla/install/lib/libbitwuzla.dylib + # CAPSTONE_INCLUDE_DIRS: /usr/local/include + # CAPSTONE_LIBRARIES: /usr/local/lib/libcapstone.a + # LLVM_INTERFACE: On + # CMAKE_PREFIX_PATH: ${{env.LLVM_PATH}} + # BOOST_INTERFACE: Off + + # - name: Repair wheel package + # run: | + # pip install delocate==0.10.4 + + # python ${{ github.workspace }}/src/scripts/macos/delocate-wheel-custom.py \ + # --verbose \ + # --wheel-dir wheelhouse/repaired_x86_64 \ + # ${{ github.workspace }}/wheelhouse/default_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl + + # - name: Test wheel package + # run: | + # pip install virtualenv + + # virtualenv test-venv + # source test-venv/bin/activate + + # pip install ${{ github.workspace }}/wheelhouse/repaired_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl + + # python -c "import triton" + + # pip install capstone + # pip install lief + # pip install unicorn==2.0.0 + # pip install z3-solver==4.12.2 + + # cd ${{ github.workspace }}/src/testers + # python -m unittest discover -b -v unittests + # deactivate + + # - name: Upload wheel package + # uses: actions/upload-artifact@v4 + # with: + # name: triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl + # path: ${{ github.workspace }}/wheelhouse/repaired_x86_64/triton_library-${{ env.package-version }}-${{ matrix.pycp }}-macosx_12_0_x86_64.whl + # if-no-files-found: warn diff --git a/src/scripts/docker/Dockerfile b/src/scripts/docker/Dockerfile index bae7bd2a1..33a9ae116 100644 --- a/src/scripts/docker/Dockerfile +++ b/src/scripts/docker/Dockerfile @@ -25,22 +25,12 @@ ENV SOURCE_DIR=/src # Create directory for dependencies. 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.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 -j $(nproc) && \ - make install - # Download, build and install Bitwuzla. RUN echo "[+] Download, build and install Bitwuzla" && \ cd $DEPENDENCIES_DIR && \ git clone https://github.com/bitwuzla/bitwuzla.git && \ cd bitwuzla && \ - git checkout -b 0.4.0 0.4.0 && \ + git checkout -b 0.7.0 0.7.0 && \ export PY310_PATH=$(python3.10 -c 'import sys, os; print(os.path.dirname(sys.executable))') && \ CC=clang CXX=clang++ PATH=$PATH:$PY310_PATH python3.10 ./configure.py --shared --prefix $(pwd)/install && \ cd build && \ @@ -55,8 +45,8 @@ RUN echo "[+] Download Z3" && \ # Download, build and install Capstone. RUN echo "[+] Download, build and install Capstone" && \ cd $DEPENDENCIES_DIR && \ - 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 && \ + wget -q https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.3.tar.gz -O capstone-5.0.3.tar.gz && \ + tar xf capstone-5.0.3.tar.gz && \ + cd ./capstone-5.0.3 && \ CAPSTONE_ARCHS="arm aarch64 riscv x86" ./make.sh && \ sudo make install diff --git a/src/scripts/docker/build-wheel-linux.sh b/src/scripts/docker/build-wheel-linux.sh index 2fc081205..1dc0fcaec 100755 --- a/src/scripts/docker/build-wheel-linux.sh +++ b/src/scripts/docker/build-wheel-linux.sh @@ -1,14 +1,14 @@ #! /usr/bin/env bash # This file is meant to be used inside the docker image build by the -# `build-docker-image.sh` script. This file build triton-library for Python 3.8, -# 3.9, 3.10 and 3.11. It is used by the Build Python Package Github workflow but can -# also be used locally by running: +# `build-docker-image.sh` script. This file build triton-library for Python +# 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13. It is used by the Build Python +# Package Github workflow but can also be used locally by running: # # $ docker pull quay.io/pypa/manylinux_2_28_x86_64 # $ ./src/scripts/docker/build-docker-image.sh # $ cd /tmp -# $ wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz +# $ wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz # $ tar xf clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz # $ cd - # $ docker run \ @@ -17,7 +17,7 @@ # -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. +# You'll find the .whl packages in the wheelhouse folder. set -e # set -x # Debugging @@ -42,6 +42,8 @@ export CMAKE_PREFIX_PATH=$LLVM_DIR # Build Triton Python wheel package for Python 3.8. echo "[+] Build Triton wheel package for Python 3.8" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.8.*/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") @@ -51,6 +53,8 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64 # Build Triton Python wheel package for Python 3.9. echo "[+] Build Triton wheel package for Python 3.9" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.9.*/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") @@ -60,6 +64,8 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64 # Build Triton Python wheel package for Python 3.10. echo "[+] Build Triton wheel package for Python 3.10" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.10.*/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") @@ -69,6 +75,8 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64 # Build Triton Python wheel package for Python 3.11. echo "[+] Build Triton wheel package for Python 3.11" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.11.*/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") @@ -78,6 +86,8 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64 # Build Triton Python wheel package for Python 3.12. echo "[+] Build Triton wheel package for Python 3.12" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.12.*/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") @@ -87,6 +97,8 @@ $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64 # Build Triton Python wheel package for Python 3.13. echo "[+] Build Triton wheel package for Python 3.13" cd $SOURCE_DIR +rm -rf $SOURCE_DIR/build +rm -rf $SOURCE_DIR/triton_library.egg-info export PYTHON_BINARY=/opt/_internal/cpython-3.13.1/bin/python export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])") export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])")