From 39728477f077d5d51b92c2424be69b3dcca28126 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Wed, 9 Jun 2021 11:37:23 +0200 Subject: [PATCH] Don't additionally link spdlog in every library. spdlog is linked "public" in BaseLib. Reason is the violation of odr for some globals defined in the spdlog library. ==1540297==ERROR: AddressSanitizer: odr-violation (0x7f5ea9c9d020): [1] size=40 'vtable for spdlog::spdlog_ex' _deps/spdlog-src/src/spdlog.cpp [2] size=40 'vtable for spdlog::spdlog_ex' _deps/spdlog-src/src/spdlog.cpp These globals were registered at these points: [1]: #0 0x5614686e0dfa in __asan_register_globals.part.0 (/home/naumov/w/ogs/d/bin/ogs+0x1bfdfa) #1 0x7f5e6cdbe7eb in asan.module_ctor (/home/naumov/w/ogs/d/bin/../lib/libMeshLib.so+0x17d37eb) [2]: #0 0x558bd62b6dfa in __asan_register_globals.part.0 (/home/naumov/w/ogs/d/bin/ogs+0x1bfdfa) #1 0x7f831c7e54ab in asan.module_ctor (/home/naumov/w/ogs/d/bin/../lib/libBaseLib.so+0x89a4ab) --- Applications/ApplicationsLib/CMakeLists.txt | 1 - Applications/DataExplorer/DataView/CMakeLists.txt | 1 - Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt | 1 - Applications/DataExplorer/VtkVis/CMakeLists.txt | 2 +- Applications/DataHolderLib/CMakeLists.txt | 2 +- Applications/FileIO/CMakeLists.txt | 2 +- ChemistryLib/CMakeLists.txt | 2 +- GeoLib/CMakeLists.txt | 2 +- MaterialLib/CMakeLists.txt | 2 +- MaterialLib/SolidModels/CMakeLists.txt | 2 +- MaterialLib/SolidModels/MFront/CMakeLists.txt | 2 +- MathLib/CMakeLists.txt | 1 - MeshGeoToolsLib/CMakeLists.txt | 1 - MeshLib/CMakeLists.txt | 1 - NumLib/CMakeLists.txt | 2 +- ParameterLib/CMakeLists.txt | 2 +- ProcessLib/BoundaryCondition/Python/CMakeLists.txt | 2 +- ProcessLib/CMakeLists.txt | 2 +- ProcessLib/SourceTerms/Python/CMakeLists.txt | 2 +- 19 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt index 8ba2d863897..731bd2c9fd4 100644 --- a/Applications/ApplicationsLib/CMakeLists.txt +++ b/Applications/ApplicationsLib/CMakeLists.txt @@ -14,7 +14,6 @@ target_link_libraries( MeshGeoToolsLib ParameterLib ProcessLib - spdlog::spdlog $<$<BOOL:${OGS_USE_PYTHON}>:pybind11::pybind11> $<$<BOOL:${OGS_USE_PETSC}>:petsc> ) diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt index e874467d194..f45733542d1 100644 --- a/Applications/DataExplorer/DataView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/CMakeLists.txt @@ -129,7 +129,6 @@ target_link_libraries( QtDiagramView QtStratView DataHolderLib - spdlog::spdlog Qt5::Core Qt5::Gui ) diff --git a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt index c39c4c5c99a..9f84f927085 100644 --- a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt @@ -28,7 +28,6 @@ ogs_add_library(QtDiagramView ${SOURCES} ${HEADERS} ${UIS}) target_include_directories(QtDiagramView PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries( QtDiagramView PRIVATE BaseLib GeoLib QtBase DataHolderLib Qt5::Gui - spdlog::spdlog ) add_autogen_include(QtDiagramView) diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index 2a5b6774077..de8cb98f63f 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -161,7 +161,7 @@ endif() # GEOTIFF_FOUND target_link_libraries( VtkVis PUBLIC BaseLib GeoLib MeshLib DataHolderLib QtBase VtkVisFilter - PRIVATE MathLib ApplicationsFileIO Qt5::Gui spdlog::spdlog + PRIVATE MathLib ApplicationsFileIO Qt5::Gui ) set_property(TARGET VtkVis PROPERTY FOLDER "DataExplorer") diff --git a/Applications/DataHolderLib/CMakeLists.txt b/Applications/DataHolderLib/CMakeLists.txt index a902c9c8d35..d549a7e01eb 100644 --- a/Applications/DataHolderLib/CMakeLists.txt +++ b/Applications/DataHolderLib/CMakeLists.txt @@ -5,5 +5,5 @@ get_source_files(SOURCES_DataHolderLib) ogs_add_library(DataHolderLib ${SOURCES_DataHolderLib}) target_link_libraries( - DataHolderLib PUBLIC GeoLib MeshLib PRIVATE BaseLib MathLib spdlog::spdlog + DataHolderLib PUBLIC GeoLib MeshLib PRIVATE BaseLib MathLib ) diff --git a/Applications/FileIO/CMakeLists.txt b/Applications/FileIO/CMakeLists.txt index 1c1b53a7927..93d91573bca 100644 --- a/Applications/FileIO/CMakeLists.txt +++ b/Applications/FileIO/CMakeLists.txt @@ -32,7 +32,7 @@ target_link_libraries( $<$<BOOL:${OGS_BUILD_GUI}>:QtBase> $<$<TARGET_EXISTS:shp>:shp> $<$<TARGET_EXISTS:SwmmInterface>:SwmmInterface> - PRIVATE MeshLib GitInfoLib std::filesystem spdlog::spdlog + PRIVATE MeshLib GitInfoLib std::filesystem ) configure_file( diff --git a/ChemistryLib/CMakeLists.txt b/ChemistryLib/CMakeLists.txt index 1cfb5a3464e..3af57489f78 100644 --- a/ChemistryLib/CMakeLists.txt +++ b/ChemistryLib/CMakeLists.txt @@ -8,7 +8,7 @@ append_source_files(SOURCES Common) ogs_add_library(ChemistryLib ${SOURCES}) target_link_libraries( - ChemistryLib PUBLIC iphreeqc PRIVATE NumLib spdlog::spdlog + ChemistryLib PUBLIC iphreeqc PRIVATE NumLib ) # See https://github.com/ufz/ogs/pull/2982#issuecomment-641086788 diff --git a/GeoLib/CMakeLists.txt b/GeoLib/CMakeLists.txt index a86f60bcc7d..04263e0a20e 100644 --- a/GeoLib/CMakeLists.txt +++ b/GeoLib/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries( PUBLIC BaseLib MathLib $<$<BOOL:${OGS_BUILD_GUI}>:rapidxml> $<$<BOOL:${OGS_BUILD_GUI}>:Qt5::Xml> $<$<BOOL:${OGS_BUILD_GUI}>:Qt5::XmlPatterns> - PRIVATE tet spdlog::spdlog + PRIVATE tet ) configure_file( diff --git a/MaterialLib/CMakeLists.txt b/MaterialLib/CMakeLists.txt index 6767d5f4dd5..9cd0317ce3c 100644 --- a/MaterialLib/CMakeLists.txt +++ b/MaterialLib/CMakeLists.txt @@ -40,5 +40,5 @@ ogs_add_library(MaterialLib ${SOURCES}) target_link_libraries( MaterialLib PUBLIC MaterialLib_SolidModels MaterialLib_FractureModels - PRIVATE MathLib MeshLib ParameterLib exprtk spdlog::spdlog + PRIVATE MathLib MeshLib ParameterLib exprtk ) diff --git a/MaterialLib/SolidModels/CMakeLists.txt b/MaterialLib/SolidModels/CMakeLists.txt index 88bd0a38c84..4a1170b0391 100644 --- a/MaterialLib/SolidModels/CMakeLists.txt +++ b/MaterialLib/SolidModels/CMakeLists.txt @@ -2,7 +2,7 @@ get_source_files(SOURCES) ogs_add_library(MaterialLib_SolidModels ${SOURCES}) target_link_libraries( - MaterialLib_SolidModels PUBLIC MathLib PRIVATE spdlog::spdlog ParameterLib + MaterialLib_SolidModels PUBLIC MathLib PRIVATE ParameterLib NumLib ) diff --git a/MaterialLib/SolidModels/MFront/CMakeLists.txt b/MaterialLib/SolidModels/MFront/CMakeLists.txt index f17d63d48ff..bc2e0f864fd 100644 --- a/MaterialLib/SolidModels/MFront/CMakeLists.txt +++ b/MaterialLib/SolidModels/MFront/CMakeLists.txt @@ -23,7 +23,7 @@ mfront_behaviours_check_library( target_link_libraries( MaterialLib_SolidModels_MFront PUBLIC BaseLib NumLib OgsMFrontBehaviour - PRIVATE MathLib MeshLib spdlog::spdlog + PRIVATE MathLib MeshLib ) # Disable warnings for generated OgsMFrontBehaviour diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index 4f52278230d..3189ea241c9 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -34,7 +34,6 @@ target_link_libraries( $<$<BOOL:${OGS_USE_CVODE}>:CVODE::CVODE> $<$<BOOL:${OGS_USE_PETSC}>:petsc> Eigen3::Eigen - PRIVATE spdlog::spdlog ) if(OGS_USE_LIS) diff --git a/MeshGeoToolsLib/CMakeLists.txt b/MeshGeoToolsLib/CMakeLists.txt index f6455befa13..9664541189a 100644 --- a/MeshGeoToolsLib/CMakeLists.txt +++ b/MeshGeoToolsLib/CMakeLists.txt @@ -6,5 +6,4 @@ ogs_add_library(MeshGeoToolsLib ${SOURCES}) target_link_libraries( MeshGeoToolsLib PUBLIC GeoLib MathLib PRIVATE BaseLib MeshLib - spdlog::spdlog ) diff --git a/MeshLib/CMakeLists.txt b/MeshLib/CMakeLists.txt index e88a2e9cfc4..69d1cc9aa16 100644 --- a/MeshLib/CMakeLists.txt +++ b/MeshLib/CMakeLists.txt @@ -42,7 +42,6 @@ target_link_libraries( $<$<TARGET_EXISTS:OgsXdmf>:OgsXdmf> $<$<TARGET_EXISTS:MPI::MPI_CXX>:MPI::MPI_CXX> $<$<TARGET_EXISTS:petsc>:petsc> - PRIVATE spdlog::spdlog ) target_include_directories(MeshLib PUBLIC ${VTK_INCLUDE_DIRS}) diff --git a/NumLib/CMakeLists.txt b/NumLib/CMakeLists.txt index 6fd30aa6110..d001882687d 100644 --- a/NumLib/CMakeLists.txt +++ b/NumLib/CMakeLists.txt @@ -19,5 +19,5 @@ set_target_properties(NumLib PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries( NumLib PUBLIC BaseLib GeoLib MathLib MeshLib $<$<TARGET_EXISTS:petsc>:petsc> - PRIVATE MeshGeoToolsLib spdlog::spdlog + PRIVATE MeshGeoToolsLib ) diff --git a/ParameterLib/CMakeLists.txt b/ParameterLib/CMakeLists.txt index 82aedf62e39..7cbba126113 100644 --- a/ParameterLib/CMakeLists.txt +++ b/ParameterLib/CMakeLists.txt @@ -2,5 +2,5 @@ get_source_files(SOURCES) ogs_add_library(ParameterLib ${SOURCES}) target_link_libraries( - ParameterLib PUBLIC MathLib PRIVATE BaseLib exprtk MeshLib spdlog::spdlog + ParameterLib PUBLIC MathLib PRIVATE BaseLib exprtk MeshLib ) diff --git a/ProcessLib/BoundaryCondition/Python/CMakeLists.txt b/ProcessLib/BoundaryCondition/Python/CMakeLists.txt index 78e34ba1c56..1e4dc304374 100644 --- a/ProcessLib/BoundaryCondition/Python/CMakeLists.txt +++ b/ProcessLib/BoundaryCondition/Python/CMakeLists.txt @@ -23,7 +23,7 @@ target_compile_definitions( target_link_libraries( ProcessLibBoundaryConditionPython PUBLIC BaseLib MathLib MeshLib NumLib ${Python3_LIBRARIES} - PRIVATE pybind11::pybind11 spdlog::spdlog + PRIVATE pybind11::pybind11 ) # For the embedded Python module diff --git a/ProcessLib/CMakeLists.txt b/ProcessLib/CMakeLists.txt index d2d2924e3a1..a84b271af04 100644 --- a/ProcessLib/CMakeLists.txt +++ b/ProcessLib/CMakeLists.txt @@ -38,7 +38,7 @@ target_link_libraries( $<$<TARGET_EXISTS:ProcessLibSourceTermPython>:ProcessLibSourceTermPython> $<$<TARGET_EXISTS:petsc>:petsc> nlohmann_json - PRIVATE ParameterLib GitInfoLib spdlog::spdlog + PRIVATE ParameterLib GitInfoLib $<$<TARGET_EXISTS:InSituLib>:InSituLib> ) diff --git a/ProcessLib/SourceTerms/Python/CMakeLists.txt b/ProcessLib/SourceTerms/Python/CMakeLists.txt index 578db2c2555..7d320026cb1 100644 --- a/ProcessLib/SourceTerms/Python/CMakeLists.txt +++ b/ProcessLib/SourceTerms/Python/CMakeLists.txt @@ -23,7 +23,7 @@ target_compile_definitions( target_link_libraries( ProcessLibSourceTermPython PUBLIC BaseLib MathLib MeshLib NumLib ${Python3_LIBRARIES} - PRIVATE pybind11::pybind11 spdlog::spdlog + PRIVATE pybind11::pybind11 ) # For the embedded Python module -- GitLab