Skip to content

Commit

Permalink
GMP/MPIR bindings fixups.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineKhaldi committed Nov 20, 2021
1 parent d011ca6 commit c5878f7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 22 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build-arm64-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -41,9 +44,10 @@ jobs:
echo $PATH && \
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/ && \
yum -y install sudo openssl-devel && \
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 && sudo make install && cd .. && rm -rf gmp-6.2.1 && \
source $HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-musl && \
rm -rf venv && \
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-crate-and-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-m1-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
arch -arm64 sh rust.sh -y
- name: install GMP
- name: Install GMP
run: |
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | tar x
cd gmp-6.2.1
Expand All @@ -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: |
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ jobs:
bash -exc '\
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 && \
yum -y install sudo openssl-devel && \
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 && 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 && \
Expand Down Expand Up @@ -245,6 +246,16 @@ 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:
Expand Down
14 changes: 3 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
}

0 comments on commit c5878f7

Please sign in to comment.