0001-src-CMakeLists.txt-fix-static-build-with-a-zlib-and-.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 0c2d85450e3eb77dfbe11e8612a5131c5f3f3938 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Tue, 1 Dec 2020 20:39:54 +0100
  4. Subject: [PATCH] src/CMakeLists.txt: fix static build with a zlib and mbedtls
  5. Static build with a zlib-enabled mbedtls fails on:
  6. [100%] Linking C executable example
  7. /home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: /home/buildroot/autobuild/instance-3/output-1/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/lib/libmbedtls.a(ssl_tls.c.o): in function `mbedtls_ssl_transform_free.part.24':
  8. ssl_tls.c:(.text+0xbc6): undefined reference to `deflateEnd'
  9. As mbedtls does not provide a pkg-config file, search for zlib and link
  10. with it if necessary
  11. Fixes:
  12. - http://autobuild.buildroot.org/results/5891d12e90182460cde1ddfa0ca75e9fd55e3dff
  13. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  14. [Upstream status: https://github.com/zhaojh329/libuhttpd/pull/13]
  15. ---
  16. src/CMakeLists.txt | 7 ++++++-
  17. 1 file changed, 6 insertions(+), 1 deletion(-)
  18. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  19. index 132f243..f00fc8f 100644
  20. --- a/src/CMakeLists.txt
  21. +++ b/src/CMakeLists.txt
  22. @@ -57,6 +57,7 @@ else()
  23. endif()
  24. find_package(WolfSSL)
  25. find_package(MbedTLS)
  26. + find_package(ZLIB)
  27. if(UHTTPD_USE_OPENSSL)
  28. if (NOT OPENSSL_FOUND)
  29. @@ -97,7 +98,11 @@ else()
  30. elseif(UHTTPD_USE_MBEDTLS)
  31. set(SSL_NAME "MbedTLS(PolarSSL)")
  32. set(SSL_INC ${MBEDTLS_INCLUDE_DIR})
  33. - set(SSL_LIB ${MBEDTLS_LIBRARIES})
  34. + if(ZLIB_FOUND)
  35. + set(SSL_LIB ${MBEDTLS_LIBRARIES} ${ZLIB_LIBRARIES})
  36. + else()
  37. + set(SSL_LIB ${MBEDTLS_LIBRARIES})
  38. + endif()
  39. set(UHTTPD_HAVE_MBEDTLS_CONFIG 1)
  40. endif()
  41. --
  42. 2.29.2