{"id":1217,"hash":"e79dfd137e4ace1a513f3602fec5116b1cf2192b09cdaa9b533d6c9f4781f856","pattern":"rust diesel linking with `cc` failed","full_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:\n\nerror: linking with `cc` failed: exit status: 1\n...\n = note: /usr/bin/ld: cannot find -lpq\n\nI've installed the following:\n\nsudo yum update -y\nsudo yum install git -y\nsudo yum groupinstall \"Development Tools\" -y\nsudo yum install cmake -y\nsudo yum install postgresql-libs -y\n\nSeriously, how are people managing to get this crate running?","ecosystem":"cargo","package_name":"linker","package_version":null,"solution":"From the Diesel Getting Started guide:\n\nIf you run into an error like:\n\nnote: ld: library not found for -lmysqlclient\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\n\nThis 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.\n\nBy default diesel depends on the following client libraries:\n\nlibpq for the PostgreSQL backend\nlibmysqlclient for the Mysql backend\nlibsqlite3 for the SQlite backend\n\nIf you are not sure on how to install those dependencies please consult the documentation of the corresponding dependency or your distribution package manager.\n\nFor example, if you only have PostgreSQL installed, you can use this to install diesel_cli with only PostgreSQL:\n\ncargo install diesel_cli --no-default-features --features postgres\n\nThe error \"cannot find -lpq\" is your linker telling you that it cannot find the PostgreSQL client library.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/70910000/rust-diesel-linking-with-cc-failed","votes":8,"created_at":"2026-04-19T04:52:37.216096+00:00","updated_at":"2026-04-19T04:52:37.216096+00:00"}