Closed dmitry-ganyushin closed 3 years ago
I cannot reproduce this error with the Ubuntu 18.04.4 LTS, gcc 7.5.0 and cmake 3.17.3 or 3.16.5. Your system's difference is only cmake 3.17.2 otherwise the same.
@chuckatkins Do you have any idea what may go wrong here? I see the -pthread flag added in CMakeCache.txt if I run cmake. It does not seem to come from the adios2 installation (adios2-config -cxx-flags does not contain -pthread).
MPI_CXX_COMPILE_OPTIONS:STRING=-pthread
MPI_CXX_LINK_FLAGS:STRING=-Wl,-rpath -Wl,/opt/openmpi/4.0.3/lib -Wl,--enable-new-dtags -pthread
So why could this be excluded in his build?
@pnorbert we'd probably need to add find_package(Threads REQUIRED)
and link the Threads::Threads
target. We only have Ubuntu in CI.
Indeed, there is an example which is using threads, so we should explicitly add it here. This is not an adios or cmake problem.
That's another good reason to have adios2 in Debian and Fedora. We can build containers for CI more easily on projects like this.
Hello,
I tried to build examples using cmake and needed to add SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") into source/cpp/basics/CMakeLists.txt to be able to build adios2-thread-write-cpp
Linking CXX executable ../../../bin/adios2-thread-write-cpp /usr/bin/ld: CMakeFiles/adios2-thread-write-cpp.dir/thread-write.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status source/cpp/basics/CMakeFiles/adios2-thread-write-cpp.dir/build.make:109: recipe for target 'bin/adios2-thread-write-cpp' failed