Skip to content

Commit

Permalink
[cmake] Silence macOS linker warnings on -undefined dynamic_lookup:
Browse files Browse the repository at this point in the history
See #11937
for why that is currently needed. `flat_namespace` is not a solution.

(cherry picked from commit 5ad4ab9)
  • Loading branch information
Axel-Naumann committed Jan 27, 2023
1 parent a567664 commit 23e406f
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bindings/jupyroot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyroot/pythonizations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion core/metacling/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion interpreter/cling/tools/plugins/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion montecarlo/pythia6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 23e406f

Please sign in to comment.