0001-configure.ac-fix-openssl-static-build.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 1fed5adc166d5f2190a6b6ad048ec2d803316327 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 22 Feb 2023 10:13:30 +0100
  4. Subject: [PATCH] configure.ac: fix openssl static build
  5. Do not use AX_APPEND_FLAG as it will break static builds by removing
  6. duplicates such as -lz or -latomic which are needed by -lssl and
  7. -lcrypto. This will fix the following build failure with sparc which
  8. needs -latomic:
  9. Checking for X509_STORE_CTX_get0_cert
  10. 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
  11. /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':
  12. x509cset.c:(.text+0x108): undefined reference to `__atomic_fetch_add_4'
  13. [...]
  14. In file included from ./hostcheck.c:38:
  15. ../../include/sudo_compat.h:342:41: error: conflicting types for 'ASN1_STRING_data'
  16. 342 | # define ASN1_STRING_get0_data(x) ASN1_STRING_data(x)
  17. | ^~~~~~~~~~~~~~~~
  18. Fixes:
  19. - http://autobuild.buildroot.org/results/8be59dd94e4916f9457cb435104e36e62a28373b
  20. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  21. [Retrieved from:
  22. https://github.com/sudo-project/sudo/commit/1fed5adc166d5f2190a6b6ad048ec2d803316327]
  23. ---
  24. m4/openssl.m4 | 4 +++-
  25. 1 file changed, 3 insertions(+), 1 deletion(-)
  26. diff --git a/m4/openssl.m4 b/m4/openssl.m4
  27. index a2e4941ae8..b4cbd821db 100644
  28. --- a/m4/openssl.m4
  29. +++ b/m4/openssl.m4
  30. @@ -44,7 +44,9 @@ AC_DEFUN([SUDO_CHECK_OPENSSL], [
  31. SUDO_APPEND_LIBPATH([LIBTLS], [$f])
  32. ;;
  33. *)
  34. - AX_APPEND_FLAG([$f], [LIBTLS])
  35. + # Do not use AX_APPEND_FLAG as it will break static builds by removing
  36. + # duplicates such as -lz or -latomic which are needed by -lssl and -lcrypto
  37. + LIBTLS="$LIBTLS $f"
  38. ;;
  39. esac
  40. done