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

libpkg: make shlib handling portable #2386

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

ifreund
Copy link
Contributor

@ifreund ifreund commented Dec 10, 2024

All shared objects NEEDED by an ELF file are added to shlibs_required by pkg-create rather than filtering them based on the host system ELF hints file and installed libraries.

The ALLOW_BASE_SHLIBS option is deprecated and ignored.

Before running the solver, pkg now scans /lib and /usr/lib (taking --rootdir into account) and builds a list of system-provided shlibs that is used as an input to the solver. If pkg detects that it is targeting a pkgbase system this scan for system shlibs is skipped as the base packages will provide all necessary shlibs.

The detection of a pkgbase system is implemented by checking if /usr/bin/uname is tracked in the pkg database.

The main user-facing change is that pkg-create now adds all shared objects listed as NEEDED by an ELF file to shlibs_required. In general this should not cause issues due to the solver taking the shlibs provided by the base system into account but there may be exceptions where manual filtering is necessary. For this purpose, SHLIB_REQUIRE_IGNORE_GLOB and SHLIB_REQUIRE_IGNORE_GLOB are added in the second commit.

References: #2331

All shared objects NEEDED by an ELF file are added to shlibs_required
by pkg-create rather than filtering them based on the host system ELF
hints file and installed libraries.

The ALLOW_BASE_SHLIBS option is deprecated and ignored.

Before running the solver, pkg now scans /lib and /usr/lib (taking
--rootdir into account) and builds a list of system-provided shlibs that
is used as an input to the solver. If pkg detects that it is targeting a
pkgbase system this scan for system shlibs is skipped as the base
packages will provide all necessary shlibs.

The detection of a pkgbase system is implemented by checking if
/usr/bin/uname is tracked in the pkg database.

The main user-facing change is that pkg-create now adds *all* shared
objects listed as NEEDED by an ELF file to shlibs_required. In general
this should not cause issues due to the solver taking the shlibs
provided by the base system into account but there may be exceptions.
An option to filter these entries will be added in the next commit.

References:	freebsd#2331
Sponsored by:	The FreeBSD Foundation
Since libpkg no longer does any automatic filtering of DT_NEEDED entries
while generating the shlibs_required list, it will be necessary to
manually filter required shared libraries in some cases.

Sponsored by:	The FreeBSD Foundation
Sponsored by:	The FreeBSD Foundation
@ifreund
Copy link
Contributor Author

ifreund commented Dec 10, 2024

Note that contrary to the discussion in #2331 this patch does not do any filtering of shlibs_provided. I'm not quite sure where I got the idea that filtering shlibs_provided was necessary, even before this patch pkg added all SONAME entries starting with "lib" to shlibs_provided so there is no change in behavior here. This patch only affects generation of shlibs_required entries.

@ifreund ifreund force-pushed the remove-allow-base-shlibs branch from 6cc6499 to 116b085 Compare December 10, 2024 15:02
@bapt bapt merged commit f88eb14 into freebsd:main Dec 11, 2024
11 of 12 checks passed
@ifreund ifreund deleted the remove-allow-base-shlibs branch December 11, 2024 15:14
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.

2 participants