140-curl-fix-libressl-linking.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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. --- a/Utilities/cmcurl/CMakeLists.txt
  17. +++ b/Utilities/cmcurl/CMakeLists.txt
  18. @@ -362,6 +362,10 @@ set(HAVE_LIBSSL OFF)
  19. if(CMAKE_USE_OPENSSL)
  20. find_package(OpenSSL)
  21. if(OPENSSL_FOUND)
  22. + check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
  23. + if(HAVE_LIBRT)
  24. + list(APPEND OPENSSL_LIBRARIES rt)
  25. + endif()
  26. list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
  27. set(USE_OPENSSL ON)
  28. set(HAVE_LIBCRYPTO ON)