cargolinker95% confidence\u2191 8

rust diesel linking with `cc` failed

Full error message
Ok, so kind of getting nowhere here. Before I posted a problem with my Mac M1 having linker issues with Rust Diesel and got nothing. So I spun up an Ec2 instance and tried to run this crate here and got the following:

error: linking with `cc` failed: exit status: 1
...
 = note: /usr/bin/ld: cannot find -lpq

I've installed the following:

sudo yum update -y
sudo yum install git -y
sudo yum groupinstall "Development Tools" -y
sudo yum install cmake -y
sudo yum install postgresql-libs -y

Seriously, how are people managing to get this crate running?

From the Diesel Getting Started guide: If you run into an error like: note: ld: library not found for -lmysqlclient clang: error: linker command failed with exit code 1 (use -v to see invocation) This means you are missing the client library needed for a database backend – mysqlclient in this case. You can resolve this issue by either installing the library (using the usual way to do this depending on your operating system) or by excluding the undesired default library with the --no-default-features flag. By default diesel depends on the following client libraries: libpq for the PostgreSQL backend libmysqlclient for the Mysql backend libsqlite3 for the SQlite backend If you are not sure on how to install those dependencies please consult the documentation of the corresponding dependency or your distribution package manager. For example, if you only have PostgreSQL installed, you can use this to install diesel_cli with only PostgreSQL: cargo install diesel_cli --no-default-features --features postgres The error "cannot find -lpq" is your linker telling you that it cannot find the PostgreSQL client library.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/e79dfd137e4ace1a513f3602fec5116b1cf2192b09cdaa9b533d6c9f4781f856
hash \u00b7 e79dfd137e4ace1a513f3602fec5116b1cf2192b09cdaa9b533d6c9f4781f856
rust diesel linking with `cc` failed — DepScope fix | DepScope