注意:在MacOS中构建rust时,找不到-lpq的库 [英] note: ld: library not found for -lpq when build rust in macOS

查看:19
本文介绍了注意:在MacOS中构建rust时,找不到-lpq的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在MacOS中使用Apple Sillicon使用以下命令构建我的Rust项目时:

CARGO_HTTP_MULTIPLEXING=false cargo build

显示如下错误:

  = note: ld: library not found for -lpq
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已尝试安装

brew install libpq
brew link --force libpq
仍未解决此问题,我应该做些什么来解决此问题?是不是PostgreSQL库现在不支持Apple Sillicon(Apple M1 Pro)?这是我的项目依赖项:

[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"

推荐答案

我可以通过以下方式解析:

cargo clean

以后

cargo build

这篇关于注意:在MacOS中构建rust时,找不到-lpq的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆