{"id":314,"hash":"b9a8a02f81fdc7942f61f81d5b36b24871f1c0b91f0e6246b20490f991526abd","pattern":"How to fix diesel_cli link libpq.lib error with Postgres tools installed in Docker?","full_message":"I'm trying (for hours now) to install the cargo crate diesel_cli for postgres. However, every time I run the recommended cargo command:\n\ncargo install diesel_cli --no-default-features --features postgres\n\nI wait a few minutes just to see the same build fail with this message:\n\nnote: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'\n\nerror: aborting due to previous error\nerror: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `C:\\Users\\<user name here>\\AppData\\Local\\Temp\\cargo-installUU2DtT`\n\nCaused by:\n  could not compile `diesel_cli`.\n\nI'm running postgres in a docker container and have the binaries on my C:\\pgsql with the lib and bin directories both on the PATH so I can't figure out why it's not linking. What else could be required they didn't mention in the docs?","ecosystem":"cargo","package_name":"postgresql","package_version":null,"solution":"Update:\n\nThe answer below is a work around for older versions. Please check the possibility to execute cargo clean first\n\nOriginal Version\n\nAdding the folder to the PATH variable didn't help, at least in my case, as by some reason it is not used in the /LIBPATH parameter passed to link.exe.\nIn my case it was C:\\Users\\<username>\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\nYou can see it in the beginning of the error message.\nCopy libpq.lib in there and it will be used from there.\n\nAfter installation diesel would require some other assemblies. Copy libcrypto-1_1-x64.dll, libiconv-2.dll and libssl-1_1-x64.dll into the folder showed after where diesel command execution","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/62708607/how-to-fix-diesel-cli-link-libpq-lib-error-with-postgres-tools-installed-in-dock","votes":26,"created_at":"2026-04-19T04:41:50.439301+00:00","updated_at":"2026-04-19T04:52:37.212271+00:00"}