简体   繁体   English

rust-lld:错误:无法找到库 -lpq

[英]rust-lld: error: unable to find library -lpq

I'm trying to build a simple web app using Yew, Diesel, and Postgres.我正在尝试使用 Yew、Diesel 和 Postgres 构建一个简单的 Web 应用程序。 When I run当我跑

wasm-pack build --target web --out-name wasm --out-dir ./static

I get the following error:我收到以下错误:

*rust-lld: error: unable to find library -lpq* 

I'm on macOS Catalina.我在 macOS Catalina 上。 I installed Postgres through Homebrew.我通过 Homebrew 安装了 Postgres。 My libpq.dylib file is at /usr/local/lib .我的libpq.dylib文件位于/usr/local/lib

These are the troubleshooting I've tried already:这些是我已经尝试过的故障排除:

  1. Added /usr/local/lib to $PATH ./usr/local/lib$PATH My pg_config shows LIBDIR = /usr/local/lib .我的pg_config显示LIBDIR = /usr/local/lib
  2. Re-installed Postgres重新安装 Postgres
  3. Updated rustc -nightly更新rustc -nightly

Ideas here are not helpful as well: How can I link a Rust Wasm application with libpq via wasm-pack?这里的想法也没有帮助: 如何通过 wasm-pack 将 Rust Wasm 应用程序与 libpq 链接?

Still it is not resolved.还是没有解决。 I'd be grateful for any suggestions.我将不胜感激任何建议。

Libpq does not support the wasm-web platform as far as I'm aware therefore there is no way to make this work.据我所知,Libpq 不支持 wasm-web 平台,因此无法完成这项工作。 As already mentioned in the comments you probably want to use diesel in your backend code, not in the frontend.正如评论中已经提到的,您可能希望在后端代码中使用diesel ,而不是在前端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM