Diesel without local version of postgres?

Is it possible to use Diesel without installing a local version of Postgres or the Diesel CLI?

When I tried to compile my project, I got a linker error:
LINK : fatal error LNK1181: cannot open input file 'libpq.lib'

I'm trying to connect to a DB in the cloud instead of a local one.

The postgres client library isn't required for running a DB server locally. It's the client that knows the protocol with which to connect to any (local or remote) DB server. You aren't going to be able to connect to any database without having a client library.

Gotcha. Do you know where I can just get the client library?

Sorry, no. Not concretely, at least. It looks like you're running Windows, of which I'm not a competent user, but chances are there are pre-built binary distributions for postgres on Windows, so you should be able to get hold of the client library from such an official source.

If you don't need the postgres backend you can just disable it. For the cli this would be cargo install --no-default-features --features "sqlite mysql" (if you need both, the mysql and the sqlite backend).
For diesel itself, just enable only the required features.

Would I be able to just link against libpg.lib? I just downloaded the version 10.11 binaries zip and extracted the lib folder to C:\postgres\lib on my system:
https://www.enterprisedb.com/download-postgresql-binaries.

I found where you can give cargo a path to search for libraries and I tried adding this line:

rustc-link-search = ["C:\\postgres\\lib"]

but I get the same error.

Note: Make sure that both the bin and lib directories for postgres are added to your PATH

Thanks, I have actually already added those to my path, but I'm not interested in using the Diesel CLI at the moment. I'm just trying to connect to a Postgres DB and run a simple select statement.

I got the project to build with the following steps:

  1. Went to https://www.enterprisedb.com/download-postgresql-binaries and downloaded v10.11.
  2. Extracted the pgsql/lib folder to C:\postgres\lib.
  3. added build = "build.rs" to cargo.toml under package.
  4. added build.rs to the root folder with this code:
fn main() {
    println!(r"cargo:rustc-link-search=C:\postgres\lib");
}