[PATCH] urngd: fixes compilation with glibc

Andre Heider a.heider at gmail.com
Fri Sep 15 22:04:41 PDT 2023


On 16/09/2023 05:55, Chukun Pan wrote:
> 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

See that comment, there was a reason for -O0, I don't know which, but if 
that's still required setting PKG_FORTIFY_SOURCE:=0 in the package's 
Makefile would be more appropriate?

> -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})
>   




More information about the openwrt-devel mailing list