diff --git a/package/libwebsockets/0003-lib-tls-CMakeLists.txt-fix-build-without-threads.patch b/package/libwebsockets/0003-lib-tls-CMakeLists.txt-fix-build-without-threads.patch new file mode 100644 index 0000000000..ae46602a53 --- /dev/null +++ b/package/libwebsockets/0003-lib-tls-CMakeLists.txt-fix-build-without-threads.patch @@ -0,0 +1,47 @@ +From c83cf48b9095a6914a0844bec4439763bb0c9138 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sat, 28 May 2022 23:15:40 +0200 +Subject: [PATCH] lib/tls/CMakeLists.txt: fix build without threads + +openssl can be built without threads resulting in the following build +failure: + +-- Looking for HMAC_CTX_new +-- Looking for HMAC_CTX_new - not found + +[...] + +In file included from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets.h:661, + from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/core/./private-lib-core.h:140, + from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/plat/unix/unix-misc.c:28: +/home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets/lws-genhash.h:85:18: error: field 'ctx' has incomplete type + 85 | HMAC_CTX ctx; + | ^~~ + +To fix this build failure, don't unconditionally add pthread if openssl +has been found through pkg-config as openssl.pc will contain the +appropriate dependencies (i.e. -lpthread but also -lz or -latomic) + +Fixes: + - http://autobuild.buildroot.org/results/2ae9e3249b6fcc9e6c30e7783e264fc6599e61df + +Signed-off-by: Fabrice Fontaine +[Retrieved from: +https://github.com/warmcat/libwebsockets/commit/c83cf48b9095a6914a0844bec4439763bb0c9138] +--- + lib/tls/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/tls/CMakeLists.txt b/lib/tls/CMakeLists.txt +index 559be9abb..a2b78c252 100644 +--- a/lib/tls/CMakeLists.txt ++++ b/lib/tls/CMakeLists.txt +@@ -311,7 +311,7 @@ endif() + if (UNIX AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "QNX")) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_DL_LIBS}) + endif() +-if ((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "QNX")) ++if ((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT ((${CMAKE_SYSTEM_NAME} MATCHES "QNX") OR PC_OPENSSL_FOUND)) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread) + endif() +