2021年2月7日星期日

Cargo Build Error On Mac OS Big Sur (libgmp.la not found)

Summary of Problem:
I'm just creating a simple rust program that uses the rug, primes and rand crates to check if a number is prime. I'm using cargo to handle the build and run. The issue is I can't get the build to successfully complete. It appears that a deliverable is failing to compile.

Summary of Error Message:
I get this message after running cargo build

       libtool:   error: cannot find the library 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la' or unhandled argument 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la'        make[4]: *** [t-popc] Error 1        make[4]: *** Waiting for unfinished jobs....        libtool:   error: cannot find the library 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la' or unhandled argument 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la'        make[4]: *** [t-constants] Error 1        libtool:   error: cannot find the library 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la' or unhandled argument 'Q2/target/debug/build/gmp-mpfr-sys-16a98ae813310906/out/build/gmp-build/libgmp.la'        make[4]: *** [t-sub] Error 1  ...    make[4]: *** [t-bswap] Error 1    make[4]: *** [t-parity] Error 1    make[3]: *** [check-am] Error 2    make[2]: *** [check-recursive] Error 1    make[1]: *** [check-recursive] Error 1    make: *** [check] Error 2    thread 'main' panicked at 'Program failed with code 2: "make" "-j" "12" "check"', /Users/alirezaazimi/.cargo/registry/src/github.com-1ecc6299db9ec823/gmp-mpfr-sys-1.4.2/build.rs:1235:13    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace  

My Cargo.toml File:

[package]  name = "Q2"  version = "0.1.0"  authors = ["********"]  edition = "2018"    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html    [dependencies]  rand = "0.7.2"  primes = "0.3.0"  rug = "1.11.0"  

What I've Tried:
I'm usure about why the library is not being generated. Add to that the fact I'm new to rust. I've tried cargo clean and cargo build again, but that had no effect. I've tried updating my gcc compiler by running brew upgrade. That also did not change anything.

https://stackoverflow.com/questions/66095401/cargo-build-error-on-mac-os-big-sur-libgmp-la-not-found February 08, 2021 at 11:01AM

没有评论:

发表评论