From 4e51ad1a135da764da413950e35a41bc4ba10a49 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 20 Nov 2021 22:18:01 +0100 Subject: [PATCH] GMP/MPIR bindings fixups. --- .github/workflows/benchmark.yml | 15 ++++++++++++--- .github/workflows/build-arm64-wheels.yml | 8 ++++++-- .github/workflows/build-crate-and-npm.yml | 7 +++++++ .github/workflows/build-m1-wheel.yml | 2 +- .github/workflows/build-test.yml | 11 +++++++++-- build.rs | 14 +++----------- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 845a82d1..031cea57 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -45,6 +45,14 @@ jobs: python -m pip install maturin rustup target add x86_64-unknown-linux-musl + - name: Install GMP + if: startsWith(matrix.os, 'ubuntu') + run: | + sudo apt-get install lzip -y + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 + - name: Build Windows if: startsWith(matrix.os, 'windows') run: | @@ -114,11 +122,12 @@ jobs: - name: Install dependencies run: | + sudo apt-get install lzip -y + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 python -m pip install maturin rustup target add x86_64-unknown-linux-musl - sudo apt install libgmp3-dev - ls -la /usr/lib64 - ls -la /usr/lib - name: Build env: diff --git a/.github/workflows/build-arm64-wheels.yml b/.github/workflows/build-arm64-wheels.yml index 05bcac0d..48a6b47a 100644 --- a/.github/workflows/build-arm64-wheels.yml +++ b/.github/workflows/build-arm64-wheels.yml @@ -20,6 +20,9 @@ jobs: os: [ ARM64 ] # , ubuntu-latest ] steps: + + - uses: Chia-Network/actions/clean-workspace@main + - name: Checkout repository uses: actions/checkout@v2 with: @@ -42,8 +45,9 @@ jobs: curl -L https://sh.rustup.rs > rustup-init.sh && \ sh rustup-init.sh -y && \ yum -y install openssl-devel && \ - yum -y install gmp && \ - ls -la /usr/lib64/ && \ + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && /usr/bin/sudo make install && cd .. && rm -rf gmp-6.2.1 && \ source $HOME/.cargo/env && \ rustup target add aarch64-unknown-linux-musl && \ rm -rf venv && \ diff --git a/.github/workflows/build-crate-and-npm.yml b/.github/workflows/build-crate-and-npm.yml index 7082f2f4..2fcb58ad 100644 --- a/.github/workflows/build-crate-and-npm.yml +++ b/.github/workflows/build-crate-and-npm.yml @@ -23,6 +23,13 @@ jobs: with: fetch-depth: 0 + - name: Install GMP + run: | + sudo apt-get install lzip -y + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 + - name: Set up rusts uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/build-m1-wheel.yml b/.github/workflows/build-m1-wheel.yml index 5bf40c91..21d5f277 100644 --- a/.github/workflows/build-m1-wheel.yml +++ b/.github/workflows/build-m1-wheel.yml @@ -53,7 +53,7 @@ jobs: . ./venv/bin/activate export PATH=~/.cargo/bin:$PATH arch -arm64 pip install maturin - arch -arm64 maturin build --no-sdist -i python --release --strip --cargo-extra-args="--features=openssl" + arch -arm64 maturin build --no-sdist --release --strip --cargo-extra-args="--features=openssl" - name: Install clvm_rs wheel run: | diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 9a07f6a7..cca56fd3 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -71,8 +71,9 @@ jobs: curl -L https://sh.rustup.rs > rustup-init.sh && \ sh rustup-init.sh -y && \ yum -y install openssl-devel && \ - yum -y install gmp && \ - ls -la /usr/lib64 && \ + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && /usr/bin/sudo make install && cd .. && rm -rf gmp-6.2.1 && \ source $HOME/.cargo/env && \ rustup target add x86_64-unknown-linux-musl && \ rm -rf venv && \ @@ -245,6 +246,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 1 + - name: Install GMP + run: | + sudo apt-get install lzip -y + curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \ + cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \ + make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 - name: Install rust uses: actions-rs/toolchain@v1 with: diff --git a/build.rs b/build.rs index 8e500fb5..e84daf04 100644 --- a/build.rs +++ b/build.rs @@ -1,18 +1,10 @@ fn main() { - #[cfg(target_os = "windows")] - { + if cfg!(windows) { println!("cargo:rustc-link-lib=mpir"); println!("cargo:rustc-link-search=mpir_gc_x64"); - } - #[cfg(target_os = "linux")] - { - println!("cargo:rustc-link-lib=gmp"); - println!("cargo:rustc-link-search=/usr/lib64"); - println!("cargo:rustc-link-search=/usr/lib"); - } - #[cfg(target_os = "macos")] - { + } else { println!("cargo:rustc-link-lib=gmp"); + println!("cargo:rustc-link-search=/usr/local/lib"); println!("cargo:rustc-link-search=/opt/homebrew/lib"); } }