summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2021-12-07 15:27:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-12 11:27:20 +0000
commit8571182ece1602ce8e030c98aef17cdc5718a037 (patch)
tree3b3dd1d4cf22b9c8576ca1e92047f5712ae7c847
parent63bf94e26443b3790648c393f36203e9954b85de (diff)
downloadopenembedded-core-contrib-8571182ece1602ce8e030c98aef17cdc5718a037.tar.gz
package: Only snap libraries if they would be processed by ldconfig OS-12840
PACKAGE_SNAP_LIB_SYMLINKS renames libraries based on their SONAME so that they can be found directly rather than going via symlinks that would be created by ldconfig. For example, without PACKAGE_SNAP_LIB_SYMLINKS in ${libdir} we have: libharfbuzz.so.0 -> libharfbuzz.so.0.20600.4 libharfbuzz.so.0.20600.4 but with PACKAGE_SNAP_LIB_SYMLINKS="1" we have just: libharfbuzz.so.0 Unfortunately, this renaming is done based on the SONAME which breaks packages like mesa which install a single library with multiple hard links: -rwxr-xr-x root/root 13593488 2021-12-07 12:26 ./usr/lib/dri/i915_dri.so -rwxr-xr-x root/root 13137328 2021-12-07 12:26 ./usr/lib/dri/i965_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/iris_dri.so link to ./usr/lib/dri/i915_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/kms_swrast_dri.so link to ./usr/lib/dri/i915_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/nouveau_vieux_dri.so link to ./usr/lib/dri/i965_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/r200_dri.so link to ./usr/lib/dri/i965_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/radeon_dri.so link to ./usr/lib/dri/i965_dri.so hrwxr-xr-x root/root 0 2021-12-07 12:26 ./usr/lib/dri/swrast_dri.so link to ./usr/lib/dri/i915_dri.so The SONAME for i915_dri.so (and therefore all the other names that link to the same file) is libgallium_dri.so. This means that PACKAGE_SNAP_LIB_SYMLINKS causes do_package to successfully rename the first name found to libgallium_dri.so. A similar thing happens to i965_dri.so with its SONAME of libmesa_dri_drivers.so. The order is not deterministic, so this means that although every build will be missing one name, it's not always the same one. -rwxr-xr-x root/root 13593488 2021-11-30 15:17 ./usr/lib/dri/i915_dri.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/kms_swrast_dri.so link to ./usr/lib/dri/i915_dri.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/libgallium_dri.so link to ./usr/lib/dri/i915_dri.so -rwxr-xr-x root/root 13137328 2021-11-30 15:17 ./usr/lib/dri/libmesa_dri_drivers.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/nouveau_vieux_dri.so link to ./usr/lib/dri/libmesa_dri_drivers.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/r200_dri.so link to ./usr/lib/dri/libmesa_dri_drivers.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/radeon_dri.so link to ./usr/lib/dri/libmesa_dri_drivers.so hrwxr-xr-x root/root 0 2021-11-30 15:17 ./usr/lib/dri/swrast_dri.so link to ./usr/lib/dri/i915_dri.so This renaming means that the library cannot be found at runtime. The simplest way to avoid this renaming is to only snap libraries that would be processed by ldconfig. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Phil Blundell <pb@pbcl.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 84eafbd529..09cd376f4a 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1878,7 +1878,7 @@ python package_do_shlibs() {
sonames.add(prov)
if libdir_re.match(os.path.dirname(file)):
needs_ldconfig = True
- if snap_symlinks and (os.path.basename(file) != this_soname):
+ if needs_ldconfig and snap_symlinks and (os.path.basename(file) != this_soname):
renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
return (needs_ldconfig, needed, sonames, renames)