diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2024-01-11 14:15:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-12 11:54:05 +0000 |
commit | ea9e07a3e25a687198f6fcda81daff77cf099909 (patch) | |
tree | 54c062fd9398659a113b517723605f9015a470e2 | |
parent | 405cc80b6b1b55c6aacd671024e83ca8eaa2920d (diff) | |
download | poky-ea9e07a3e25a687198f6fcda81daff77cf099909.tar.gz |
shadow: link executables statically for -native variant
shadow 4.14.x adds a number of libraries it dynamically links with
(md, bsd, attr). This causes troubles in setscene tasks where
shadow executables are used (such as useradd), as pulling in
the needed dynamic libraries needs unpleasant special-casing.
(From OE-Core rev: 495ff95eae14a91c94187f78a0b30c7957c9b168)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
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 | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/meta/conf/distro/include/no-static-libs.inc b/meta/conf/distro/include/no-static-libs.inc index 75359928a1..8898d53d75 100644 --- a/meta/conf/distro/include/no-static-libs.inc +++ b/meta/conf/distro/include/no-static-libs.inc | |||
@@ -21,6 +21,11 @@ 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 | |||
24 | EXTRA_OECONF:append = "${DISABLE_STATIC}" | 29 | EXTRA_OECONF:append = "${DISABLE_STATIC}" |
25 | 30 | ||
26 | EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True" | 31 | 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 c024746d4f..43f456251a 100644 --- a/meta/recipes-extended/shadow/shadow.inc +++ b/meta/recipes-extended/shadow/shadow.inc | |||
@@ -47,6 +47,16 @@ 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 | |||
50 | NSCDOPT = "" | 60 | NSCDOPT = "" |
51 | NSCDOPT:class-native = "--without-nscd" | 61 | NSCDOPT:class-native = "--without-nscd" |
52 | NSCDOPT:class-nativesdk = "--without-nscd" | 62 | NSCDOPT:class-nativesdk = "--without-nscd" |