libxcrypt: Enable static builds
PATCH 1/1 libxcrypt: Enable static builds
Whilst glibc builds static binaries libxcrypt doesn't, without which we can't build, for example, a static busybox. Enable static libraries here so that anyone who needs a static binary using just basic libraries has one fewer dependencies to track down post libxcrypt being split out of glibc.
---
meta/recipes-core/libxcrypt/libxcrypt.inc | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-core/libxcrypt/libxcrypt.inc +2 -0
@@ -32,4 +32,6 @@ CFLAGS += "-fcommon" API = "--disable-obsolete-api" EXTRA_OECONF += "${API}" +DISABLE_STATIC = "" + BBCLASSEXTEND = "nativesdk"
Signature · 1 line
2.17.1
Quoted 22 lines · Alex Kiernan
Whilst glibc builds static binaries libxcrypt doesn't, without which we
can't build, for example, a static busybox. Enable static libraries here
so that anyone who needs a static binary using just basic libraries has
one fewer dependencies to track down post libxcrypt being split out of
glibc.Signed-off-by Alex Kiernan <[email protected]>---
meta/recipes-core/libxcrypt/libxcrypt.inc | 2 ++ 1 file changed, 2 insertions(+)meta/recipes-core/libxcrypt/libxcrypt.inc +0
-0
meta/recipes-core/libxcrypt/libxcrypt.inc CFLAGS += "-fcommon" · line 36
Quoted 5 lines
meta/recipes-core/libxcrypt/libxcrypt.inc +2
-0@@ -32,4 +32,6 @@ CFLAGS += "-fcommon" API = "--disable-obsolete-api" EXTRA_OECONF += "${API}" +DISABLE_STATIC = "" +
My worry with this is where the line is drawn. We let glibc generate its static libs since turning them off turned out to be a nightmare, we disabled everything else we could, assuming the user would turn on what they need if they need it.
In some ways I'd much prefer this was in some example config rather than building things piecemeal that most people don't use?
Cheers,
Richard
Quoted 27 lines · Richard Purdie
Quoted 25 lines · Alex Kiernan
Whilst glibc builds static binaries libxcrypt doesn't, without which we
can't build, for example, a static busybox. Enable static libraries here
so that anyone who needs a static binary using just basic libraries has
one fewer dependencies to track down post libxcrypt being split out of
glibc.Signed-off-by Alex Kiernan <[email protected]>---
meta/recipes-core/libxcrypt/libxcrypt.inc | 2 ++ 1 file changed, 2 insertions(+)meta/recipes-core/libxcrypt/libxcrypt.inc +0
-0@@ -32,4 +32,6 @@ CFLAGS += "-fcommon" API = "--disable-obsolete-api" EXTRA_OECONF += "${API}"
Quoted 4 lines
meta/recipes-core/libxcrypt/libxcrypt.inc CFLAGS += "-fcommon" · line 36
Quoted 2 lines
meta/recipes-core/libxcrypt/libxcrypt.inc +2
-0+DISABLE_STATIC = "" +My worry with this is where the line is drawn.
I ummed and ahhed before sending it for precisely that reason...
Quoted 8 lines
We let glibc generate
its static libs since turning them off turned out to be a nightmare, we disabled everything else we could, assuming the user would turn on what they need if they need it.In some ways I'd much prefer this was in some example config rather than building things piecemeal that most people don't use?
Let me have a look at that - what got me here was trying to get a static busybox so I could OSTree's tests to pass, which all turned out to be way harder than I expected; this was just one of the things I tripped over.
Signature · 1 line
Alex Kiernan
Quoted 5 lines · Alex Kiernan
Let me have a look at that - what got me here was trying to get a static busybox so I could OSTree's tests to pass, which all turned out to be way harder than I expected; this was just one of the things I tripped over.
Busybox shouldn't need to link with libxcrypt if USE_BB_CRYPT is enabled (which it is in OE's default Busybox defconfig).
There's a long standing bug in Busybox whereby crypt.h gets included unconditionally (instead of being guarded by #if ENABLE_USE_BB_CRYPT etc) so the Busybox recipe still needs to depend on virtual/crypt but it's only a compile time dependency.
Quoted 8 lines · Andre McCurdy
Quoted 5 lines · Alex Kiernan
Let me have a look at that - what got me here was trying to get a static busybox so I could OSTree's tests to pass, which all turned out to be way harder than I expected; this was just one of the things I tripped over.
Quoted 7 lines
Busybox shouldn't need to link with libxcrypt if
USE_BB_CRYPTis enabled (which it is in OE's default Busybox defconfig).There's a long standing bug in Busybox whereby
crypt.hgets included unconditionally (instead of being guarded by #ifENABLE_USE_BB_CRYPTetc) so the Busybox recipe still needs to depend on virtual/crypt but it's only a compile time dependency.
It looks like that might've been fixed:
4767a5375e66 libbb: include <crypt.h> only if necessary
If I drop virtual/crypt, I still get the same link time failure to find crypt, which I think we're getting because this test
https://git.busybox.net/busybox/tree/Makefile.flags#n149 passes:
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}'
Quoted 2 lines
crypttest.c; $(CC) $(CFLAGS) -lcrypt -o/dev/nullcrypttest.c/dev/null2>&1 && echo "y"; rmcrypttest.c)
Not quite sure how that can pass tbh...
This ugly hack avoids needing a static crypt:
(quoted diff) +0 -0
b/meta/recipes-core/busybox/busybox.inc
index 1a82f23b0f3a..7335a846038f 100644
meta/recipes-core/busybox/busybox.inc +0 -1
@@ -18,7 +18,7 @@ BUSYBOX_SPLIT_SUID ?= "1" export EXTRA_CFLAGS = "${CFLAGS}" export EXTRA_LDFLAGS = "${LDFLAGS}" -EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH}
CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
+EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}' CRYPT_AVAILABLE=n"
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog
${PN}-mdev ${PN}-hwclock"
Not sure how to get that integrated nicely...
Signature · 1 line
Alex Kiernan
Quoted 13 lines · Alex Kiernan
Quoted 11 lines · Andre McCurdy
Quoted 5 lines · Alex Kiernan
Let me have a look at that - what got me here was trying to get a static busybox so I could OSTree's tests to pass, which all turned out to be way harder than I expected; this was just one of the things I tripped over.
Busybox shouldn't need to link with libxcrypt if
USE_BB_CRYPTis enabled (which it is in OE's default Busybox defconfig).
Quoted 8 lines
Quoted 4 lines
There's a long standing bug in Busybox whereby
crypt.hgets included unconditionally (instead of being guarded by #ifENABLE_USE_BB_CRYPTetc) so the Busybox recipe still needs to depend on virtual/crypt but it's only a compile time dependency.It looks like that might've been fixed:
4767a5375e66libbb: include <crypt.h> only if necessary
Yes, looks like a fix in the Busybox master branch (not in any release yet though).
Quoted 9 lines
If I drop virtual/crypt, I still get the same link time failure to find crypt, which I think we're getting because this test
https://git.busybox.net/busybox/tree/Makefile.flags#n149 passes:
CRYPT_AVAILABLE:= $(shell echo 'int main(void){return 0;}'Quoted 2 lines
crypttest.c; $(CC) $(CFLAGS) -lcrypt -o/dev/nullcrypttest.c/dev/null2>&1 && echo "y"; rmcrypttest.c)Not quite sure how that can pass tbh...
It looks like that test should just be skipped completely if Busybox is configured to use its own internal libcrypt? Probably something to raise on the Busybox mailing list rather than here.
Quoted 11 lines
This ugly hack avoids needing a static crypt:>
meta/recipes-core/busybox/busybox.inc +0
-1@@ -18,7 +18,7 @@ BUSYBOX_SPLIT_SUID ?= "1" export EXTRA_CFLAGS = "${CFLAGS}" export EXTRA_LDFLAGS = "${LDFLAGS}" -EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH}
Quoted 5 lines
CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
+EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}' CRYPT_AVAILABLE=n"
That's going to break for anyone who has their own busybox config with CONFIG_USE_BB_CRYPT disabled.
Quoted 7 lines
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog
${PN}-mdev ${PN}-hwclock"Not sure how to get that integrated nicely...
--
Alex Kiernan