Fails to build with libasan using Clang (undefined symbols)
Utilizing the AddressSanitizer with Clang means that the binary exports some symbols and the shared libraries use those symobls at run time. Thus during linking -Wl,--no-undefined
must be replaced with -Wl,-z,undefs
.
- Permit linking evolution-data-server, evolution, evolution-ews with -Wl,-z,undefs.
I am not sure whether passing -no-undefined to the compiler for linking is good. GCC passes this to the Darwin linker.
diff --git a/cmake/modules/SetupBuildFlags.cmake b/cmake/modules/SetupBuildFlags.cmake
--- a/cmake/modules/SetupBuildFlags.cmake
+++ b/cmake/modules/SetupBuildFlags.cmake
@@ -21,7 +21,6 @@ macro(setup_build_flags _maintainer_mode)
-Wundef
-Wwrite-strings
-Wno-cast-function-type
- -no-undefined
-fno-strict-aliasing
)
@@ -76,10 +75,4 @@ macro(setup_build_flags _maintainer_mode)
unset(cxx_flag_${flag}_supported)
endforeach()
endif(CMAKE_CXX_COMPILER_ID)
-
- if(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD"))
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
- endif(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD" ))
endmacro()
Edited by Дилян Палаузов