0

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.

pretzelhammer
  • 13,874
  • 15
  • 47
  • 98
nalin
  • 3
  • 5
  • 1
    Do you really intend to link your frontend code to Postgres? How would that work, considering WASM does not support OS primitives that libpq would need (sockets and such)? – justinas Oct 04 '20 at 14:52
  • Hey, you are right. I should approach it with Rocket or Actix-web. Thanks for the comment! – nalin Oct 04 '20 at 15:54

1 Answers1

1

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.

weiznich
  • 2,910
  • 9
  • 16