[PATCH] urngd: fixes compilation with glibc

Chukun Pan amadeus at jmu.edu.cn
Fri Sep 15 20:55:36 PDT 2023


When compiling with glibc it will result in error:
1. #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
Fix this by compiling with optimization (-O2) by default.

2. jitterentropy-base.c:(.text+0x39f8): undefined reference to `pthread_join'
Fix this by always linking pthread.

Signed-off-by: Chukun Pan <amadeus at jmu.edu.cn>
---
 CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1ee0c1..20f4774 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,8 @@ ADD_EXECUTABLE(urngd
 TARGET_LINK_LIBRARIES(urngd ${ubox})
 
 # jitter RNG must not be compiled with optimizations
-SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES COMPILE_FLAGS -O0)
+SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES COMPILE_FLAGS -O2)
+TARGET_LINK_LIBRARIES(urngd pthread)
 
 INSTALL(TARGETS urngd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
 
-- 
2.25.1




More information about the openwrt-devel mailing list