sgrif / pq-sys

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

VCPKG_ROOT not respected #39

Open buehler opened 2 years ago

buehler commented 2 years ago

Hey there

I tried to install diesel-cli and diesel (Windows 11) and I still receive the two common errors with missing libpq.lib and when running missing libpq.dll.

I do not get why the errors occur. I got vcpkg installed with the corresponding vc++ build packages. It worked on the openssl lib. VCPKG_ROOT is set to the correct directory, and vcpkg list results in:

% vcpkg list                                                                                              ~/Development
libpq:x64-windows                                  12.9#1           The official database access API of postgresql
libpq[openssl]:x64-windows                                          support for encrypted client connections and ran...
libpq[zlib]:x64-windows                                             Use zlib (else --without-zlib)
openssl:x64-windows                                1.1.1m#2         OpenSSL is an open source project that provides ...
openssl:x64-windows-static-md                      1.1.1m#2         OpenSSL is an open source project that provides ...
vcpkg-cmake-config:x64-windows                     2022-02-06
vcpkg-cmake:x64-windows                            2022-01-19
zlib:x64-windows                                   1.2.11#13        A compression library

Now when trying to install diesel_cli, without setting PQ_LIB_DIR, it does not compile with the message that the lib is missing. When setting the lib dir, it compiles but does not run since libpq.dll is not in the path.

To solve the issue, I needed to set the PQ_LIB_DIR to the directory in vcpkg where the libs are stored and the bin directory of vcpkg had to be added to the PATH variable.

Is this the way it was intented to go? I thought (or rather: I hoped) that it "just works" with VCPGK_ROOT set since the build step should find the necessary lib and dll.

I know it may not have directly to do with this crate, but I would appreciate any hint in some direction.

Regards Christoph

weiznich commented 2 years ago

I fear I cannot really help here as I do not own a windows based computer.