Skip to content

Commit c5878f7

Browse files
committed
GMP/MPIR bindings fixups.
1 parent d011ca6 commit c5878f7

File tree

6 files changed

+45
-22
lines changed

6 files changed

+45
-22
lines changed

.github/workflows/benchmark.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ jobs:
4545
python -m pip install maturin
4646
rustup target add x86_64-unknown-linux-musl
4747
48+
- name: Install GMP
49+
if: startsWith(matrix.os, 'ubuntu')
50+
run: |
51+
sudo apt-get install lzip -y
52+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
53+
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
54+
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
55+
4856
- name: Build Windows
4957
if: startsWith(matrix.os, 'windows')
5058
run: |
@@ -114,11 +122,12 @@ jobs:
114122

115123
- name: Install dependencies
116124
run: |
125+
sudo apt-get install lzip -y
126+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
127+
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
128+
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
117129
python -m pip install maturin
118130
rustup target add x86_64-unknown-linux-musl
119-
sudo apt install libgmp3-dev
120-
ls -la /usr/lib64
121-
ls -la /usr/lib
122131
123132
- name: Build
124133
env:

.github/workflows/build-arm64-wheels.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
os: [ ARM64 ] # , ubuntu-latest ]
2121

2222
steps:
23+
24+
- uses: Chia-Network/actions/clean-workspace@main
25+
2326
- name: Checkout repository
2427
uses: actions/checkout@v2
2528
with:
@@ -41,9 +44,10 @@ jobs:
4144
echo $PATH && \
4245
curl -L https://sh.rustup.rs > rustup-init.sh && \
4346
sh rustup-init.sh -y && \
44-
yum -y install openssl-devel && \
45-
yum -y install gmp && \
46-
ls -la /usr/lib64/ && \
47+
yum -y install sudo openssl-devel && \
48+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \
49+
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
50+
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 && \
4751
source $HOME/.cargo/env && \
4852
rustup target add aarch64-unknown-linux-musl && \
4953
rm -rf venv && \

.github/workflows/build-crate-and-npm.yml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ jobs:
2323
with:
2424
fetch-depth: 0
2525

26+
- name: Install GMP
27+
run: |
28+
sudo apt-get install lzip -y
29+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
30+
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
31+
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
32+
2633
- name: Set up rusts
2734
uses: actions-rs/toolchain@v1
2835
with:

.github/workflows/build-m1-wheel.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
3838
arch -arm64 sh rust.sh -y
3939
40-
- name: install GMP
40+
- name: Install GMP
4141
run: |
4242
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | tar x
4343
cd gmp-6.2.1
@@ -53,7 +53,7 @@ jobs:
5353
. ./venv/bin/activate
5454
export PATH=~/.cargo/bin:$PATH
5555
arch -arm64 pip install maturin
56-
arch -arm64 maturin build --no-sdist -i python --release --strip --cargo-extra-args="--features=openssl"
56+
arch -arm64 maturin build --no-sdist --release --strip --cargo-extra-args="--features=openssl"
5757
5858
- name: Install clvm_rs wheel
5959
run: |

.github/workflows/build-test.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ jobs:
7070
bash -exc '\
7171
curl -L https://sh.rustup.rs > rustup-init.sh && \
7272
sh rustup-init.sh -y && \
73-
yum -y install openssl-devel && \
74-
yum -y install gmp && \
75-
ls -la /usr/lib64 && \
73+
yum -y install sudo openssl-devel && \
74+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \
75+
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
76+
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1 && \
7677
source $HOME/.cargo/env && \
7778
rustup target add x86_64-unknown-linux-musl && \
7879
rm -rf venv && \
@@ -245,6 +246,16 @@ jobs:
245246
- uses: actions/checkout@v2
246247
with:
247248
fetch-depth: 1
249+
- name: Install GMP
250+
run: |
251+
sudo apt-get install lzip -y
252+
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x
253+
cd gmp-6.2.1
254+
./configure --enable-fat --with-pic
255+
make -j 6
256+
sudo make install
257+
cd ..
258+
rm -rf gmp-6.2.1
248259
- name: Install rust
249260
uses: actions-rs/toolchain@v1
250261
with:

build.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
fn main() {
2-
#[cfg(target_os = "windows")]
3-
{
2+
if cfg!(windows) {
43
println!("cargo:rustc-link-lib=mpir");
54
println!("cargo:rustc-link-search=mpir_gc_x64");
6-
}
7-
#[cfg(target_os = "linux")]
8-
{
9-
println!("cargo:rustc-link-lib=gmp");
10-
println!("cargo:rustc-link-search=/usr/lib64");
11-
println!("cargo:rustc-link-search=/usr/lib");
12-
}
13-
#[cfg(target_os = "macos")]
14-
{
5+
} else {
156
println!("cargo:rustc-link-lib=gmp");
7+
println!("cargo:rustc-link-search=/usr/local/lib");
168
println!("cargo:rustc-link-search=/opt/homebrew/lib");
179
}
1810
}

0 commit comments

Comments
 (0)