diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2024-01-19 13:43:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-21 12:27:12 +0000 |
commit | 4a61101478be8affd8bba69797e319b9e5657662 (patch) | |
tree | 4fbe489a48b830b680a1eb232fe4883ad1380ac1 | |
parent | 4a126e31704ab45d8da425fe4e57f3eec817f9f3 (diff) | |
download | poky-4a61101478be8affd8bba69797e319b9e5657662.tar.gz |
shadow: replace static linking with dynamic libraries in a custom location and bundled with shadow
Despite our efforts to make static linking work, there have
been new reports of bizarre build failures:
https://lists.openembedded.org/g/openembedded-core/message/194006
https://lists.openembedded.org/g/openembedded-core/message/193907
This commit changes back to dynamic linking, but places
the libraries in a custom location, per RP's suggestion.
(From OE-Core rev: b93562937737e97dbc8cb7c874e9913f6a285a34)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/conf/distro/include/no-static-libs.inc | 5 | ||||
-rw-r--r-- | meta/recipes-extended/shadow/shadow.inc | 24 |
2 files changed, 14 insertions, 15 deletions
diff --git a/meta/conf/distro/include/no-static-libs.inc b/meta/conf/distro/include/no-static-libs.inc index 8898d53d75..75359928a1 100644 --- a/meta/conf/distro/include/no-static-libs.inc +++ b/meta/conf/distro/include/no-static-libs.inc | |||
@@ -21,11 +21,6 @@ DISABLE_STATIC:pn-libusb1-native = "" | |||
21 | # needed by rust | 21 | # needed by rust |
22 | DISABLE_STATIC:pn-musl = "" | 22 | DISABLE_STATIC:pn-musl = "" |
23 | 23 | ||
24 | # needed by shadow-native to build static executables, particularly useradd | ||
25 | DISABLE_STATIC:pn-attr-native = "" | ||
26 | DISABLE_STATIC:pn-libbsd-native = "" | ||
27 | DISABLE_STATIC:pn-libmd-native = "" | ||
28 | |||
29 | EXTRA_OECONF:append = "${DISABLE_STATIC}" | 24 | EXTRA_OECONF:append = "${DISABLE_STATIC}" |
30 | 25 | ||
31 | EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True" | 26 | EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True" |
diff --git a/meta/recipes-extended/shadow/shadow.inc b/meta/recipes-extended/shadow/shadow.inc index 43f456251a..b8e5e285c4 100644 --- a/meta/recipes-extended/shadow/shadow.inc +++ b/meta/recipes-extended/shadow/shadow.inc | |||
@@ -47,16 +47,6 @@ EXTRA_OECONF += "--without-libcrack \ | |||
47 | 47 | ||
48 | CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY" | 48 | CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY" |
49 | 49 | ||
50 | # Force static linking of utilities so we can use from the sysroot/sstate for useradd | ||
51 | # without worrying about the dependency libraries being available | ||
52 | LDFLAGS:append:class-native = " -no-pie" | ||
53 | do_compile:prepend:class-native () { | ||
54 | sed -i -e 's#\(LIBS.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \ | ||
55 | -e 's#\(LIBBSD.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \ | ||
56 | -e 's#\(LIBATTR.*\)-lattr#\1 ${STAGING_LIBDIR}/libattr.a#g' \ | ||
57 | ${B}/lib/Makefile ${B}/src/Makefile | ||
58 | } | ||
59 | |||
60 | NSCDOPT = "" | 50 | NSCDOPT = "" |
61 | NSCDOPT:class-native = "--without-nscd" | 51 | NSCDOPT:class-native = "--without-nscd" |
62 | NSCDOPT:class-nativesdk = "--without-nscd" | 52 | NSCDOPT:class-nativesdk = "--without-nscd" |
@@ -161,6 +151,20 @@ do_install:append() { | |||
161 | touch ${D}${sysconfdir}/subgid | 151 | touch ${D}${sysconfdir}/subgid |
162 | } | 152 | } |
163 | 153 | ||
154 | # Make executables look for dynamically linked libraries in a custom location, and install | ||
155 | # the needed libraries there. That way we can use them from sstate | ||
156 | # in setscene tasks without worrying about the dependency libraries being available. | ||
157 | do_install:append:class-native() { | ||
158 | binaries=$(find ${D}${base_bindir}/ ${D}${base_sbindir}/ ${D}${bindir}/ ${D}${sbindir}/ -executable -type f) | ||
159 | chrpath -k -r ${STAGING_DIR_NATIVE}/lib-shadow-deps $binaries | ||
160 | mkdir -p ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/ | ||
161 | install ${STAGING_LIBDIR_NATIVE}/libattr.so.* ${STAGING_LIBDIR_NATIVE}/libbsd.so.* ${STAGING_LIBDIR_NATIVE}/libmd.so.* ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/ | ||
162 | install ${D}${libdir}/*.so.* ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/ | ||
163 | } | ||
164 | |||
165 | SYSROOT_DIRS:append:class-native = " ${STAGING_DIR_NATIVE}/lib-shadow-deps/" | ||
166 | INSANE_SKIP:${PN}:class-native = "already-stripped" | ||
167 | |||
164 | PACKAGES =+ "${PN}-base" | 168 | PACKAGES =+ "${PN}-base" |
165 | FILES:${PN}-base = "\ | 169 | FILES:${PN}-base = "\ |
166 | ${base_bindir}/login.shadow \ | 170 | ${base_bindir}/login.shadow \ |