Closed hakostra closed 8 years ago
Hi, can you let us know if this is resolved on the latest devel? I think e2375c0f7f2d should have fixed the link issue.
I pulled last devel, deleted my build directory and tried again, but still same problem.
Please enable CMAKE_VERBOSE_MAKEFILE
and have a look at / post the command line when linking libospray_common.so
. This is how it looks like for me (I use icc
, but this should not matter):
[2/3] : /opt/intel/compilers_and_libraries/linux/bin/intel64/icpc -fPIC -Wall -fPIC -no-ansi-alias -std=c++11 -DNOMINMAX -static-intel -Wall -fPIC -no-ansi-alias -std=c++11 -DNOMINMAX -static-intel -DNDEBUG -O3 -g -Wl,--exclude-libs=ALL -Wl,--exclude-libs=ALL -shared -Wl,-soname,libospray_common.so.0 -o libospray_common.so.1.0.1 builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/common.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/FileName.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/sysinfo.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/malloc.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/library.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/thread.cpp.o builddir/ospcommon/intel64/CMakeFiles/ospray_common.dir/vec.cpp.o -lpthread -ldl -Wl,-rpath,:::::::::::::::::::::: && :
It contains -lpthread
at the end, as it should be the case.
Pulled last devel today to be sure, and retried with CMAKE_VERBOSE_MAKEFILE:
[ 16%] Linking CXX executable ../../../ospCvtParaViewTfcn
cd /opt/ospray/git-master/build/apps/common/tfn_lib && /opt/cmake/3.6.1/install/bin/cmake -E cmake_link_script CMakeFiles/ospCvtParaViewTfcn.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -fno-strict-aliasing -std=c++11 -Wno-narrowing -fPIC -fno-strict-aliasing -std=c++11 -Wno-narrowing -DNDEBUG -O3 -Wstrict-aliasing=1 -ffast-math CMakeFiles/ospCvtParaViewTfcn.dir/convertParaViewTfcn.cpp.o CMakeFiles/ospCvtParaViewTfcn.dir/jsoncpp.cpp.o -o ../../../ospCvtParaViewTfcn -rdynamic ../../../libospray_tfn.so.1.0.1 ../../../libospray_common.so.1.0.1 -ldl -Wl,-rpath,/opt/ospray/git-master/build:
../../../libospray_common.so.1.0.1: undefined reference to `pthread_create'
../../../libospray_common.so.1.0.1: undefined reference to `pthread_attr_setstacksize'
../../../libospray_common.so.1.0.1: undefined reference to `pthread_setaffinity_np'
../../../libospray_common.so.1.0.1: undefined reference to `pthread_join'
../../../libospray_common.so.1.0.1: undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status
apps/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/build.make:125: recipe for target 'ospCvtParaViewTfcn' failed
make[2]: *** [ospCvtParaViewTfcn] Error 1
make[2]: Leaving directory '/opt/ospray/git-master/build'
CMakeFiles/Makefile2:1159: recipe for target 'apps/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/all' failed
So no -lpthread at all.
Configured with:
cmake -DCMAKE_INSTALL_PREFIX=/opt/ospray/git-master/install -DOSPRAY_BUILD_MPI_DEVICE=On -DCMAKE_VERBOSE_MAKEFILE=On ../source
Could you try fully cleaning and recreating your build directory? It looks like libospray_common
is still being linked in when it should no longer be linked with ospCvtParaViewTfcn
as of e2375c0
Ok, you posted the line for ospCvtParaViewTfcn
, but I guess -lpthread
is also missing for libospray_common.so
. It looks like a CMake issue (though CMake finds pthread it could also add it as /path/to/libpthread.so
, depending on compiler / system).
Let's try to track this down. Can you please add
PRINT(CMAKE_THREAD_LIBS_INIT)
to ospcommon/CMakeLists.txt
at line 19 (after FIND_PACKAGE(Threads REQUIRED)
) and run cmake
again to print the value of CMAKE_THREAD_LIBS_INIT
?
PS: That ospCvtParaViewTfc
is still linked against libospray_common
is fine: CMake adds dependencies of dependencies automatically (libospray_tfn
needs libospray_common
).
Twinklebear: I did a rm -rf *
in the build directory first in the first place, sorry I forgot to mention.
And CMAKE_THREAD_LIBS_INIT is empty... See below.
-- Found Threads: TRUE
CMAKE_THREAD_LIBS_INIT =
And for the reference, I'm still using CMake 3.6.1.
Ok. I found the problem. Du to another software piece (with some strange non-standard configuration scripts), I had set the CC-variable to 'mpicc'. Once i unset this, OSPRay builds nicely, both master and devel branches. CMAKE_THREAD_LIBS_INIT = -lpthread
as it should.
I am really sorry I annoyed you with this. Thanks for your help.
I have a computer with freshly installed Linux Mint 18 (based on Ubuntu 16.04), and have a linking issue when building OSPRay. I get the following error:
[ 16%] Linking CXX executable ../../../../../ospCvtParaViewTfcn ../../../../../libospray_common.so.1.0.0: undefined reference to
pthread_create' ../../../../../libospray_common.so.1.0.0: undefined reference topthread_attr_setstacksize' ../../../../../libospray_common.so.1.0.0: undefined reference to
pthread_setaffinity_np' ../../../../../libospray_common.so.1.0.0: undefined reference topthread_join' ../../../../../libospray_common.so.1.0.0: undefined reference to
pthread_cancel' collect2: error: ld returned 1 exit status builddir/apps/intel64/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/build.make:122: recipe for target 'ospCvtParaViewTfcn' failed make[2]: [ospCvtParaViewTfcn] Error 1 CMakeFiles/Makefile2:1124: recipe for target 'builddir/apps/intel64/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/all' failed make[1]: [builddir/apps/intel64/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....`I run CMake with the following command:
cmake -DCMAKE_INSTALL_PREFIX=/opt/ospray/git-master/install -DOSPRAY_BUILD_MPI_DEVICE=On ../source
The issue can be fixed by inserting the flag "-lpthread" at the end of the linking command in the file "builddir/apps/intel64/common/tfn_lib/CMakeFiles/ospCvtParaViewTfcn.dir/linx.txt". I have tried setting the CMAKE_EXE_LINKER_FLAGS="-lpthread", but this insert the flag too early in the link instructions. When this issue is fixed, there is a similar one later on in the build process that is fixed in the same way.
I am not sure if this is a CMake issue or if it is a problem with the OSPRay CMake files. I have tried building OSPRay with both the standard CMake version 3.5.1 that comes with the distro and the most recent 3.6.1 downloaded from source. Both behave the same way.
I attach the output from cmake and make. cmake.txt make.txt