[Buildroot] [git commit branch/2022.02.x] package/sudo: fix openssl static build
Peter Korsgaard
peter at korsgaard.com
Sun Mar 5 17:24:05 UTC 2023
commit: https://git.buildroot.net/buildroot/commit/?id=9b1f9449484b3a452479f68c8bbb194d15526141
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.02.x
Fix the following build failure with sparc raised since bump to version
1.9.11p2 in commit 9b7f8da96be549a52630cd87b30851d600f163a4 and
https://github.com/sudo-project/sudo/commit/9fbbca7b7a4cc60a8aa27d73de54278004a704c0:
hecking for X509_STORE_CTX_get0_cert
configure:21215: /home/thomas/autobuild/instance-3/output-1/host/bin/sparc-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -static -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DZLIB_CONST -static conftest.c -L/home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lssl -lz -pthread -latomic -lcrypto >&5
/home/thomas/autobuild/instance-3/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a(x509cset.o): in function `X509_CRL_up_ref':
x509cset.c:(.text+0x108): undefined reference to `__atomic_fetch_add_4'
[...]
In file included from ./hostcheck.c:38:
../../include/sudo_compat.h:342:41: error: conflicting types for 'ASN1_STRING_data'
342 | # define ASN1_STRING_get0_data(x) ASN1_STRING_data(x)
| ^~~~~~~~~~~~~~~~
Fixes:
- http://autobuild.buildroot.org/results/8be59dd94e4916f9457cb435104e36e62a28373b
Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
(cherry picked from commit 4655d84ff567e8ecc2665ac0760ef01023aae91d)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
...001-configure.ac-fix-openssl-static-build.patch | 49 ++++++++++++++++++++++
package/sudo/sudo.mk | 2 +
2 files changed, 51 insertions(+)
diff --git a/package/sudo/0001-configure.ac-fix-openssl-static-build.patch b/package/sudo/0001-configure.ac-fix-openssl-static-build.patch
new file mode 100644
index 0000000000..32edd148a0
--- /dev/null
+++ b/package/sudo/0001-configure.ac-fix-openssl-static-build.patch
@@ -0,0 +1,49 @@
+From 5cfc7e277d0b262a1d12e867c47a36301fb7edb7 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Date: Wed, 22 Feb 2023 10:01:25 +0100
+Subject: [PATCH] configure.ac: fix openssl static build
+
+Do not use AX_APPEND_FLAG as it will break static builds by removing
+duplicates such as -lz or -latomic which are needed by -lssl and
+-lcrypto. This will fix the following build failure with sparc which
+needs -latomic:
+
+Checking for X509_STORE_CTX_get0_cert
+configure:21215: /home/thomas/autobuild/instance-3/output-1/host/bin/sparc-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -static -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DZLIB_CONST -static conftest.c -L/home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lssl -lz -pthread -latomic -lcrypto >&5
+/home/thomas/autobuild/instance-3/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/thomas/autobuild/instance-3/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a(x509cset.o): in function `X509_CRL_up_ref':
+x509cset.c:(.text+0x108): undefined reference to `__atomic_fetch_add_4'
+
+[...]
+
+In file included from ./hostcheck.c:38:
+../../include/sudo_compat.h:342:41: error: conflicting types for 'ASN1_STRING_data'
+ 342 | # define ASN1_STRING_get0_data(x) ASN1_STRING_data(x)
+ | ^~~~~~~~~~~~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/8be59dd94e4916f9457cb435104e36e62a28373b
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+[Upstream status: https://github.com/sudo-project/sudo/pull/244]
+---
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8eccad7e4..523d8e56b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3082,7 +3082,9 @@ if test "${enable_openssl-no}" != no; then
+ SUDO_APPEND_LIBPATH([LIBTLS], [$f])
+ ;;
+ *)
+- AX_APPEND_FLAG([$f], [LIBTLS])
++ # Do not use AX_APPEND_FLAG as it will break static builds by removing
++ # duplicates such as -lz or -latomic which are needed by -lssl and -lcrypto
++ LIBTLS="$LIBTLS $f"
+ ;;
+ esac
+ done
+--
+2.39.0
+
diff --git a/package/sudo/sudo.mk b/package/sudo/sudo.mk
index c4eaafa6b1..3b5c898917 100644
--- a/package/sudo/sudo.mk
+++ b/package/sudo/sudo.mk
@@ -13,6 +13,8 @@ SUDO_LICENSE_FILES = LICENSE.md
SUDO_CPE_ID_VERSION = $(SUDO_VERSION_MAJOR)
SUDO_CPE_ID_UPDATE = $(SUDO_VERSION_MINOR)
SUDO_SELINUX_MODULES = sudo
+# We're patching configure.ac
+SUDO_AUTORECONF = YES
# This is to avoid sudo's make install from chown()ing files which fails
SUDO_INSTALL_TARGET_OPTS = INSTALL_OWNER="" DESTDIR="$(TARGET_DIR)" install
SUDO_CONF_OPTS = \
More information about the buildroot
mailing list