On Mon, 2023-09-11 at 17:19 +0200, Alexander Kanavin wrote:
> On Thu, 7 Sept 2023 at 14:04, Richard Purdie
> <[email protected]> wrote:
> > See meta/conf/distro/include/no-static-libs.inc which does things like:
> >
> > meta/conf/distro/include/no-static-libs.inc:DISABLE_STATIC:pn-openssl-native
> > = ""
> > meta/conf/distro/include/no-static-libs.inc:DISABLE_STATIC:pn-nativesdk-openssl
> > = ""
> >
> > I wasn't sure how easy the shadow patch would be, that is hopefully the
> > main tricky part. sqlite-native used to be built allowing static for
> > pseudo iirc but I don't think we need to do that there any more.
>
> I poked around at passing options from the shadow recipe, but couldn't
> arrive at a working combination. libtool and automake insert too many
> abstraction layers on the way to the linker invocation.
>
> So there has to be a custom, most likely non-upstreamable patch for
> Makefile.am files all over the place, which I think is worse than
> manually unrolling setscene dependencies.
I was curious to see if I could make anything work, the best I could
come up with was this:
diff --git a/meta/conf/distro/include/no-static-libs.inc
b/meta/conf/distro/include/no-static-libs.inc
index 75359928a14..312629f394c 100644
--- a/meta/conf/distro/include/no-static-libs.inc
+++ b/meta/conf/distro/include/no-static-libs.inc
@@ -30,3 +30,8 @@ EXTRA_OECMAKE:append:pn-libjpeg-turbo-native = "
-DENABLE_STATIC=False"
EXCONFIG_ARGS:append:pn-ncurses = " --without-normal"
EXCONFIG_ARGS:append:pn-ncurses-native = " --without-normal"
EXCONFIG_ARGS:append:pn-nativesdk-ncurses = " --without-normal"
+
+# Needed so we can statically link shadow-native tools
+DISABLE_STATIC:pn-attr-native = ""
+DISABLE_STATIC:pn-libbsd-native = ""
+DISABLE_STATIC:pn-libmd-native = ""
diff --git a/meta/recipes-extended/shadow/shadow_4.14.0.bb
b/meta/recipes-extended/shadow/shadow_4.14.0.bb
index 4e554463125..8cd916d01bd 100644
--- a/meta/recipes-extended/shadow/shadow_4.14.0.bb
+++ b/meta/recipes-extended/shadow/shadow_4.14.0.bb
@@ -4,6 +4,14 @@ require shadow.inc
# libcrypt. This breaks chsh.
BUILD_LDFLAGS:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES',
'pam', '-lcrypt', '', d)}"
+# Force static linking of utilities so we can use from the sysroot/sstate for
useradd
+# without worrying about the dependency libraries being available
+do_compile:prepend:class-native () {
+ sed -i -e 's#\(mode=link.*CCLD.\s*\)#\1-all-static #g' \
+ -e 's#\(LIBS.*-lbsd\)#\1 -lmd#g' \
+ -e 's#\(LIBBSD.*-lbsd\)#\1 -lmd#g' ${B}/*/Makefile
+}
+
BBCLASSEXTEND = "native nativesdk"
# https://bugzilla.redhat.com/show_bug.cgi?id=884658
which isn't nice but probably isn't too bad to maintain and does give
us the static tools.
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#187590):
https://lists.openembedded.org/g/openembedded-core/message/187590
Mute This Topic: https://lists.openembedded.org/mt/101197363/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-