From 23e406f76732f1c1ecd8590079a5f8b612d13566 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 17 Jan 2023 17:29:40 +0100 Subject: [PATCH] [cmake] Silence macOS linker warnings on -undefined dynamic_lookup: See https://github.com/root-project/root/issues/11937 for why that is currently needed. `flat_namespace` is not a solution. (cherry picked from commit 5ad4ab94d07b3b6a9b262f7c6746a2c1608d3a86) --- bindings/jupyroot/CMakeLists.txt | 2 +- bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt | 2 +- bindings/pyroot/pythonizations/CMakeLists.txt | 2 +- core/base/src/TSystem.cxx | 2 +- core/metacling/src/CMakeLists.txt | 2 +- interpreter/cling/tools/plugins/example/CMakeLists.txt | 2 +- montecarlo/pythia6/CMakeLists.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bindings/jupyroot/CMakeLists.txt b/bindings/jupyroot/CMakeLists.txt index 8510b4db10b14..c83bf9f7efa36 100644 --- a/bindings/jupyroot/CMakeLists.txt +++ b/bindings/jupyroot/CMakeLists.txt @@ -47,7 +47,7 @@ foreach(val RANGE ${how_many_pythons}) set_target_properties(${libname} PROPERTIES SUFFIX ".pyd") target_link_libraries(${libname} PUBLIC Core ${python_library}) elseif(APPLE) - target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-undefined -Wl,dynamic_lookup Core) + target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-w -Wl,-undefined -Wl,dynamic_lookup Core) else() target_link_libraries(${libname} PUBLIC -Wl,--unresolved-symbols=ignore-all Core) endif() diff --git a/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt b/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt index d41b649883f51..9ef1e3b0ab04e 100644 --- a/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt +++ b/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt @@ -63,7 +63,7 @@ foreach(val RANGE ${how_many_pythons}) set_target_properties(${libname} PROPERTIES PREFIX "lib") set_target_properties(${libname} PROPERTIES SUFFIX ".pyd") elseif(APPLE) - target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-undefined -Wl,dynamic_lookup cppyy_backend${python_under_version_string}) + target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-w -Wl,-undefined -Wl,dynamic_lookup cppyy_backend${python_under_version_string}) else() target_link_libraries(${libname} PUBLIC -Wl,--unresolved-symbols=ignore-all cppyy_backend${python_under_version_string}) endif() diff --git a/bindings/pyroot/pythonizations/CMakeLists.txt b/bindings/pyroot/pythonizations/CMakeLists.txt index c9501da46dbb4..9e853d1885f55 100644 --- a/bindings/pyroot/pythonizations/CMakeLists.txt +++ b/bindings/pyroot/pythonizations/CMakeLists.txt @@ -168,7 +168,7 @@ foreach(val RANGE ${how_many_pythons}) set_target_properties(${libname} PROPERTIES SUFFIX ".pyd") target_link_libraries(${libname} PUBLIC Core Tree cppyy${python_under_version_string}) elseif(APPLE) - target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-undefined -Wl,dynamic_lookup Core Tree cppyy${python_under_version_string}) + target_link_libraries(${libname} PUBLIC -Wl,-bind_at_load -Wl,-w -Wl,-undefined -Wl,dynamic_lookup Core Tree cppyy${python_under_version_string}) else() target_link_libraries(${libname} PUBLIC -Wl,--unresolved-symbols=ignore-all Core Tree cppyy${python_under_version_string}) endif() diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index a61f0288c0b82..c13076c28b576 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -3760,7 +3760,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, TString cmdAllowUnresolved = cmd; #ifdef R__MACOSX // Allow linking to succeed despite the missing symbols. - cmdAllowUnresolved.ReplaceAll("-dynamiclib", "-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress"); + cmdAllowUnresolved.ReplaceAll("-dynamiclib", "-dynamiclib -Wl,-w -Wl,-undefined,dynamic_lookup"); #endif if (verboseLevel > 3 && withInfo) { ::Info("ACLiC","compiling the dictionary and script files"); diff --git a/core/metacling/src/CMakeLists.txt b/core/metacling/src/CMakeLists.txt index 7bba0d1f2f740..1dd1254e99b64 100644 --- a/core/metacling/src/CMakeLists.txt +++ b/core/metacling/src/CMakeLists.txt @@ -190,7 +190,7 @@ if(MSVC) endif() if(APPLE) - target_link_libraries(Cling PUBLIC -Wl,-bind_at_load -Wl,-undefined -Wl,dynamic_lookup) + target_link_libraries(Cling PUBLIC -Wl,-w -Wl,-bind_at_load -Wl,-undefined,dynamic_lookup) elseif(NOT MSVC) target_link_libraries(Cling PUBLIC -Wl,--unresolved-symbols=ignore-in-object-files) endif() diff --git a/interpreter/cling/tools/plugins/example/CMakeLists.txt b/interpreter/cling/tools/plugins/example/CMakeLists.txt index 30dda3abafbf6..669682f9f3dd2 100644 --- a/interpreter/cling/tools/plugins/example/CMakeLists.txt +++ b/interpreter/cling/tools/plugins/example/CMakeLists.txt @@ -14,7 +14,7 @@ endif() set_target_properties(clingDemoPlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ".") if(APPLE) - target_link_libraries(clingDemoPlugin PUBLIC -Wl,-bind_at_load -Wl,-undefined -Wl,dynamic_lookup) + target_link_libraries(clingDemoPlugin PUBLIC -Wl,-w -Wl,-bind_at_load -Wl,-undefined,dynamic_lookup) elseif(NOT MSVC) target_link_libraries(clingDemoPlugin PUBLIC -Wl,--unresolved-symbols=ignore-in-object-files) endif() diff --git a/montecarlo/pythia6/CMakeLists.txt b/montecarlo/pythia6/CMakeLists.txt index 276f16741d494..a230064dc47f0 100644 --- a/montecarlo/pythia6/CMakeLists.txt +++ b/montecarlo/pythia6/CMakeLists.txt @@ -14,7 +14,7 @@ if(pythia6_nolink) if(CMAKE_SYSTEM_NAME STREQUAL Linux) string(REGEX REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -w -undefined dynamic_lookup") endif() else() if(MSVC)