Linking, /usr/bin/ld cannot find -lgpgme

I'm trying to link to an external func in /lib/x86_64-linux-gnu/libgpgme.so.11 which exists on my computer and getting linker error that it's not found. I link it in src with #[link(name = "gpgme")]. The problem persists when adding -- -L /lib/x86_64-linux-gnu to the build command and likewise when using a build script that outputs the option rustc-link-search-dir or whatever. The search dir and -lgpgme show on the build command line output as expected. It also shows -m64 which makes me suspect the target correctly matches the architecture of the library, so I'm out of ideas of what the problem could be.

Ps sorry if there's typos I'm on my phone and just typing this from memory

The linker is looking for a file named "libgpgme.so" without the ".11" on the end. In most Linux distros, you can install a package named libgpgme-dev (for Debian-based distros including Ubuntu) or gpgme-devel (for RPM-based distros like CentOS) to get this file.

1 Like

Following your advice, I tested and it works perfect! thank you!!