Diesel fails to run on windows 11

After installing diesel using: cargo install diesel_cli --no-default-features --features "sqlite-bundled postgres" it fails to execute with the following error:

error while loading shared libraries: api-ms-win-crt-locale-l1-1-0.dll

I'm actually clueless what to do. If I adjust the PATH setting to point to a location that contains this dll the next error is:

error while loading shared libraries: ?

Any help would be much appreciated.
Thanks in advance.

Such linker errors are always hard to help with, as they solely depend on your environment. Generally speaking you need to provide whatever library is linked by any of the required dependencies of diesel. In your case, diesel will require libpq as dependency. Depending on which libpq distribution you use that might pull in other dependencies as well.

The best help I can offer here is to provide a link to a setup that works: See diesel's own CI setup for windows for a tested setup.

2 Likes

api-ms-win-crt-*.dll looks like part of the UCRT, specifically one of the ABI versioned shards referenced from the meta .lib import library. So that smells like the binary was built from a Windows installation newer than you're running it from, which is definitely odd since you say you cargo installed it.

The error: ? is completely useless to anyone and would require additional tooling to diagnose.

If you downloaded anything to get that DLL, it's most likely not genuine and definitely isn't going to work. I'd be somewhat worried it's malware trying to steal something from you and printing that useless error to distract you.

2 Likes

Thanks a lot for your answers and hints.
I was actually using PosgreSQL 16 and first thing downgraded to 12.
However, the error remains. While running diesel.exe --help in git-bash on windows gives this error with the interesting dll, I tried to do the same in PowerShell and there I got errors for other libraries missing.

Those libraries are:

  • libcrypto-1_1-x64.dll
  • libssl-1_1-x64.dll
  • libintl-9.dll

Which seems to indicate a missing openSSL installation. However, except from building openSSL for Windows from source I could not find a good source for an openSSL installer for windows 11.

I'd appreciate any further hints.

Thanks in advance.

Yes those libraries indicate a missing openssl installation. You might get these libraries via package managers like vcpk or chocolaty.