1
0

130-curl-fix-libressl-linking.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. From: Jo-Philipp Wich <jo@mein.io>
  2. Date: Wed, 11 Jan 2017 03:36:04 +0100
  3. Subject: [PATCH] cmcurl: link librt
  4. When cmake is linked against LibreSSL, there might be an indirect
  5. dependency on librt on certain systems if LibreSSL's libcrypto uses
  6. clock_gettime() from librt:
  7. [ 28%] Linking C executable LIBCURL
  8. .../lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
  9. getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime'
  10. getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime'
  11. collect2: error: ld returned 1 exit status
  12. make[5]: *** [Utilities/cmcurl/LIBCURL] Error 1
  13. Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt
  14. and unconditionally link the rt library when the symbol is found.
  15. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  16. ---
  17. --- a/Utilities/cmcurl/CMakeLists.txt
  18. +++ b/Utilities/cmcurl/CMakeLists.txt
  19. @@ -456,6 +456,10 @@ if(CMAKE_USE_OPENSSL)
  20. set(USE_OPENSSL ON)
  21. set(HAVE_LIBCRYPTO ON)
  22. set(HAVE_LIBSSL ON)
  23. + check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
  24. + if(HAVE_LIBRT)
  25. + list(APPEND OPENSSL_LIBRARIES rt)
  26. + endif()
  27. list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
  28. include_directories(${OPENSSL_INCLUDE_DIR})
  29. set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})