Skip to content

Commit

Permalink
settings-plugins: specify plugin soname
Browse files Browse the repository at this point in the history
Rust 1.81.0 has started setting the soname for cdylib artifacts it
builds, which now matches the library's name provided by the crate.

These library names could all be the same, but in practice should be
distinct within the workspace to prevent cdylib artifacts from being
overwritten when building two or more crates that share a library
name.

If a soname is not specified, then glibc's dynamic linker will treat
the library's filename as its soname. If a soname is specified, then
that will always be used regardless of the filename.

Both the settings plugin loader code and the ld.so.conf.d drop-ins
expect that we can install each crate's cdylib as "libsettings.so"
and have the dynamic linker find the right library at runtime.

To keep this working as expected, add a new linker argument so the
embedded soname ends up as "libsettings.so", to match the filename.

Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Sep 20, 2024
1 parent 74970be commit 7c0c7a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/settings-plugins/settings-plugins.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Do not prefer shared linking, since the libstd we use at build time
# may not match the one installed on the final image.
%global __global_rustflags_shared %__global_rustflags
%global __global_rustflags_shared %__global_rustflags -C link-arg=-Wl,-soname=libsettings.so

%global _cross_pluginsdir %{_cross_libdir}/settings-plugins

Expand Down

0 comments on commit 7c0c7a8

Please sign in to comment.