Skip to content

Commit 4ee7b9c

Browse files
committed
Load libsecret by its SONAME, libsecret-1.so.0
The library name `libsecret-1.so` is only found in `-dev` or `-devel` packages on many distros, and it's usually only a symlink. For example, this is what I have on Fedora: /usr/lib64/libsecret-1.so -> libsecret-1.so.0 /usr/lib64/libsecret-1.so.0 -> libsecret-1.so.0.0.0 /usr/lib64/libsecret-1.so.0.0.0 $ rpm -qf /usr/lib64/libsecret* libsecret-devel-0.21.4-2.fc40.x86_64 libsecret-0.21.4-2.fc40.x86_64 libsecret-0.21.4-2.fc40.x86_64 The middle `libsecret-1.so.0` filename matches the actual `SONAME` in the library, which you can see with `readelf -d`, and this is what programs built directly against this library will use. It's a better choice for dynamic loaders too, so devel packages aren't needed.
1 parent 0de7f2e commit 4ee7b9c

File tree

1 file changed

+1
-1
lines changed
  • credential/cargo-credential-libsecret/src

1 file changed

+1
-1
lines changed

credential/cargo-credential-libsecret/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ mod linux {
115115
let secret_password_store_sync: Symbol<'_, SecretPasswordStoreSync>;
116116
let secret_password_clear_sync: Symbol<'_, SecretPasswordClearSync>;
117117
unsafe {
118-
lib = Library::new("libsecret-1.so").context(
118+
lib = Library::new("libsecret-1.so.0").context(
119119
"failed to load libsecret: try installing the `libsecret` \
120120
or `libsecret-1-0` package with the system package manager",
121121
)?;

0 commit comments

Comments
 (0)