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

1.2k views Asked by At

I'm trying to build a simple web app using Yew, Diesel, and Postgres. 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. I installed Postgres through Homebrew. My libpq.dylib file is at /usr/local/lib.

These are the troubleshooting I've tried already:

  1. Added /usr/local/lib to $PATH. My pg_config shows LIBDIR = /usr/local/lib.
  2. Re-installed Postgres
  3. Updated rustc -nightly

Ideas here are not helpful as well: How can I link a Rust Wasm application with libpq via wasm-pack?

Still it is not resolved. I'd be grateful for any suggestions.

1

There are 1 answers

0
weiznich On BEST ANSWER

Libpq does not support the wasm-web platform as far as I'm aware therefore there is no way to make this work. As already mentioned in the comments you probably want to use diesel in your backend code, not in the frontend.