FairRootGroup / DDS

The Dynamic Deployment System
http://dds.gsi.de
GNU Lesser General Public License v3.0
14 stars 14 forks source link

Clang 9 warning/error #249

Closed dennisklein closed 3 years ago

dennisklein commented 5 years ago

Affects: 2.5-36-g98ca41a Compiler: clang version 9.0.0 OS: OpenMandriva 4.0.1 0.2 (Nitrogen) (only Linux distro I could find that uses Clang/LLVM/libc++ as system compiler) Boost: 1.71.0

Came across this warning

cd /root/DDS/build/dds-commander && /usr/bin/c++  -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_LOG_DYN_LINK -DBOOST_LOG_SETUP_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -I/root/DDS/build/dds-commander -I/root/DDS/MiscCommon -I/root/DDS/dds-user-defaults/src -I/root/DDS/build/dds-user-defaults -I/root/DDS/build/dds-topology-lib -I/root/DDS/dds-topology-lib/src -I/root/DDS/dds-protocol-lib/src -I/root/DDS/build/dds-protocol-lib -I/root/DDS/MiscCommon/dds_ncf/src -I/root/DDS/build/dds-intercom-lib -I/root/DDS/dds-intercom-lib/src -I/root/DDS/build/dds-tools-lib -I/root/DDS/dds-tools-lib/src  -std=c++11 -pthread   -o CMakeFiles/dds-commander.dir/src/SSHScheduler.cpp.o -c /root/DDS/dds-commander/src/SSHScheduler.cpp
In file included from /root/DDS/dds-commander/src/SSHScheduler.cpp:5:
In file included from /root/DDS/dds-commander/src/SSHScheduler.h:9:
In file included from /root/DDS/dds-commander/src/AgentChannel.h:8:
In file included from /root/DDS/dds-protocol-lib/src/ServerChannelImpl.h:10:
In file included from /root/DDS/dds-protocol-lib/src/BaseChannelImpl.h:26:
In file included from /root/DDS/dds-protocol-lib/src/ChannelMessageHandlersImpl.h:9:
In file included from /root/DDS/dds-protocol-lib/src/CommandAttachmentImpl.h:21:
In file included from /root/DDS/dds-protocol-lib/src/SimpleMsgCmd.h:10:
/root/DDS/MiscCommon/Logger.h:9:9: warning: 'BOOST_LOG_DYN_LINK' macro redefined [-Wmacro-redefined]
#define BOOST_LOG_DYN_LINK
        ^
<command line>:6:9: note: previous definition is here
#define BOOST_LOG_DYN_LINK 1
        ^
1 warning generated.

and this error

cd /root/DDS/build/dds-octopus && /usr/bin/cmake -E cmake_link_script CMakeFiles/dds-octopus.dir/link.txt --verbose=1
/usr/bin/c++   -std=c++11 -pthread   CMakeFiles/dds-octopus.dir/src/main.cpp.o CMakeFiles/dds-octopus.dir/src/OctopusTestImpl.cpp.o CMakeFiles/dds-octopus.dir/src/OctopusProtocol.cpp.o CMakeFiles/dds-octopus.dir/src/TestPing.cpp.o CMakeFiles/dds-octopus.dir/src/TestBigCustomCmd.cpp.o  -o dds-octopus -Wl,-rpath,/root/DDS/build/dds-intercom-lib:/root/DDS/build/dds-protocol-lib:/root/DDS/build/dds-user-defaults: ../dds-intercom-lib/libdds_intercom_lib.so /usr/lib64/libboost_program_options.so.1.71.0 ../dds-protocol-lib/libdds_protocol_lib.so ../dds-user-defaults/libdds-user-defaults.so /usr/lib64/libboost_program_options.so.1.71.0 /usr/lib64/libboost_system.so.1.71.0 /usr/lib64/libboost_log_setup.so.1.71.0 /usr/lib64/libboost_log.so.1.71.0 /usr/lib64/libboost_filesystem.so.1.71.0 /usr/lib64/libboost_atomic.so.1.71.0 /usr/lib64/libboost_chrono.so.1.71.0 /usr/lib64/libboost_date_time.so.1.71.0 /usr/lib64/libboost_regex.so.1.71.0 /usr/lib64/libboost_thread.so.1.71.0 -lpthread
ld: error: ../dds-intercom-lib/libdds_intercom_lib.so: undefined reference to shm_unlink
ld: error: ../dds-intercom-lib/libdds_intercom_lib.so: undefined reference to shm_open
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

which can be fixed by this patch

diff --git a/dds-intercom-lib/CMakeLists.txt b/dds-intercom-lib/CMakeLists.txt
index b3db24a..18e901b 100644
--- a/dds-intercom-lib/CMakeLists.txt
+++ b/dds-intercom-lib/CMakeLists.txt
@@ -37,6 +37,7 @@ target_link_libraries(${PROJECT_NAME}
   Boost::log
   Boost::log_setup
   Boost::thread
+  $<$<PLATFORM_ID:Linux>:rt>
 )

 target_include_directories(${PROJECT_NAME}
AnarManafov commented 3 years ago

Thanks, @dennisklein . Fixed in the master now.