When I build my rust project in macOS with apple sillicon using this command:
CARGO_HTTP_MULTIPLEXING=false cargo build
shows error like this:
= note: ld: library not found for -lpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried to install
brew install libpq
brew link --force libpq
still did not fix this problem, what should I do to fix this problem? Is it the PostgreSQL lib did not support Apple Sillicon(Apple M1 Pro) right now? This is my project dependencies:
[package]
name = "reddwarf_dict"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = { version = "0.5.0-rc.1", features = ["json"] }
serde = { version = "1.0.64", features = ["derive"] }
serde_json = "1.0.64"
# database
diesel = { version = "1.4.7", features = ["postgres"] }
dotenv = "0.15.0"
chrono = "0.4"
log = "0.4"
env_logger = "0.9.0"
config = "0.11"
rust_wheel = "0.1.0"
Firstly, I run these commands:
brew install libpq
brew link --force libpq
Then:
PQ_LIB_DIR="$(brew --prefix libpq)/lib"
cargo install diesel_cli --no-default-features --features postgres
It works for me.
macOS: Big Sur 11.5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With