From a86e9f161d2ff140de4f636370b8fc5d184d9609 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 7 Jan 2024 01:26:24 -0500 Subject: [PATCH] Fix building on OpenBSD FAILED: lib/libopencv_core.so.13.0 ... ld: error: undefined symbol: __cxa_atexit Do not try to use --no-undefined on OpenBSD. OpenBSD does not link shared libraries with libc and thus linkage with --no-undefined is expected to fail. --- cmake/OpenCVCompilerOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 427189c079..af38484f5b 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -391,7 +391,7 @@ endif() # Apply "-Wl,--no-undefined" linker flags: https://github.com/opencv/opencv/pull/21347 if(NOT OPENCV_SKIP_LINK_NO_UNDEFINED) - if(UNIX AND (NOT APPLE OR NOT CMAKE_VERSION VERSION_LESS "3.2")) + if(UNIX AND ((NOT APPLE OR NOT CMAKE_VERSION VERSION_LESS "3.2") AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD")) set(_option "-Wl,--no-undefined") set(_saved_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_option}") # requires CMake 3.2+ and CMP0056