sgrif / pq-sys

Auto-generated rust bindings for libpq
Apache License 2.0
41 stars 32 forks source link

Mac OSX Bug Sur: workaround for pq-sys causes recompile of pq-sys for every cargo build/check. #35

Closed staninprague closed 3 years ago

staninprague commented 3 years ago

Thank you for your great work!

On Mac OSX Big Sur pq-sys would not compile by default and possible workaround is described in this issue #34:

I have the solution:

please in mac os big sur:

  1. install libpq brew install libpq, take note on the path of the installed lib 2.set the environment variable for PQ_LIB_DIR export PQ_LIB_DIR="$(brew --prefix libpq)/lib"

compile your project it should be working now

While workaround works, any change to a crate that has Diesel as dependency (and diesel has pq-sys as its dependency) leads to compilation of pq-sys and subsequently diesel.

This affects cargo check/build. Here is the sequence for the incremental build when crate having a dependency on diesel is changed:

Compiling pq-sys v0.4.6 Compiling diesel v1.4.5

This affects negatively build times for crates that have a Diesel dependency. Anything I can try or provide more data on the problem to help solving it?

staninprague commented 3 years ago

What worked for me (looks like) was to cleanup on any PQ_LIB_DIR etc based suggestions. Uninstall libpq via brew uninstall libpq and install postgresql via brew install postgresql. May be an overkill, but until someone figures out better solution, this is it for me.