Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for settings plugins #4213

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

bcressey
Copy link
Contributor

Issue number:
Related: bottlerocket-os/bottlerocket-sdk#204

Description of changes:
Drop the runtime requirement on glibc-devel, which results in unnecessary header files and static library archives on the final system.

Work around a behavior change in Rust 1.81.0 where the soname is now set for cdylib artifacts. We need the soname to stay "libsettings.so" for compatibility reasons.

Testing done:
Verified that the soname was set as expected.

for d in x86_64-bottlerocket-linux-gnu/sys-root/usr/lib/settings-plugins/*/libsettings.so ; do
  echo "# ${d}"
  readelf -a ${d} | grep SONAME
done

# x86_64-bottlerocket-linux-gnu/sys-root/usr/lib/settings-plugins/aws-dev/libsettings.so
 0x000000000000000e (SONAME)             Library soname: [libsettings.so]
# x86_64-bottlerocket-linux-gnu/sys-root/usr/lib/settings-plugins/metal-dev/libsettings.so
 0x000000000000000e (SONAME)             Library soname: [libsettings.so]
# x86_64-bottlerocket-linux-gnu/sys-root/usr/lib/settings-plugins/vmware-dev/libsettings.so
 0x000000000000000e (SONAME)             Library soname: [libsettings.so]

Also verified that the settings plugins were correctly loaded on variants built with both the older and newer Rust toolchains.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

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]>
This is only needed at build time, not at runtime.

Signed-off-by: Ben Cressey <[email protected]>
@bcressey bcressey merged commit c41aa9e into bottlerocket-os:develop Sep 25, 2024
32 checks passed
@bcressey bcressey deleted the settings-plugin-fixes branch September 25, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants