2017-01-11 02:41:10 +00:00
|
|
|
From: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
Date: Wed, 11 Jan 2017 03:36:04 +0100
|
|
|
|
Subject: [PATCH] cmcurl: link librt
|
|
|
|
|
|
|
|
When cmake is linked against LibreSSL, there might be an indirect
|
|
|
|
dependency on librt on certain systems if LibreSSL's libcrypto uses
|
|
|
|
clock_gettime() from librt:
|
|
|
|
|
|
|
|
[ 28%] Linking C executable LIBCURL
|
|
|
|
.../lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
|
|
|
|
getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime'
|
|
|
|
getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime'
|
|
|
|
collect2: error: ld returned 1 exit status
|
|
|
|
make[5]: *** [Utilities/cmcurl/LIBCURL] Error 1
|
|
|
|
|
|
|
|
Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt
|
|
|
|
and unconditionally link the rt library when the symbol is found.
|
|
|
|
|
|
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
2017-09-30 09:00:32 +00:00
|
|
|
---
|
2017-01-11 02:41:10 +00:00
|
|
|
--- a/Utilities/cmcurl/CMakeLists.txt
|
|
|
|
+++ b/Utilities/cmcurl/CMakeLists.txt
|
2022-12-06 10:33:58 +00:00
|
|
|
@@ -611,6 +611,14 @@ if(CURL_USE_OPENSSL)
|
2020-08-23 14:11:11 +00:00
|
|
|
endif()
|
|
|
|
set(SSL_ENABLED ON)
|
2017-10-02 11:56:50 +00:00
|
|
|
set(USE_OPENSSL ON)
|
2017-09-30 09:00:32 +00:00
|
|
|
+ check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
|
|
|
|
+ if(HAVE_LIBRT)
|
|
|
|
+ list(APPEND OPENSSL_LIBRARIES rt)
|
2018-04-14 21:33:41 +00:00
|
|
|
+ endif()
|
|
|
|
+ check_library_exists("pthread" pthread_once "" HAVE_PTHREAD)
|
|
|
|
+ if(HAVE_PTHREAD)
|
|
|
|
+ list(APPEND OPENSSL_LIBRARIES pthread)
|
2017-09-30 09:00:32 +00:00
|
|
|
+ endif()
|
2017-10-02 11:56:50 +00:00
|
|
|
list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
|
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
2018-12-29 16:27:20 +00:00
|
|
|
|