dso
dso copied to clipboard
Correcting linking error with pthread
On Ubuntu 16.04 with gcc version 5.4.0 the system does not compile with:
/usr/bin/ld: CMakeFiles/dso_dataset.dir/src/main_dso_pangolin.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 CMakeFiles/dso_dataset.dir/build.make:151: recipe for target 'bin/dso_dataset' failed make[2]: *** [bin/dso_dataset] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dso_dataset.dir/all' failed make[1]: *** [CMakeFiles/dso_dataset.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
The proposed commit just explicitly adds pthread library in the linking process.
This is a corrected version of the pull request: https://github.com/JakobEngel/dso/pull/66
Good! You did another pull request.
Now, I think there might be some issues if people use it on Windows, as pthread is not directly supported (there seems to be possibilities though). And without platform checks, it will be an issue for these users if I am not mistaken.
I also ran into this issue (not sure if it was DSO or LSD-SLAM) but, as way of example it is not needed for DSO on Rasperry Pi 3. I am not sure why some Linux platforms do not need the pthread linking (boost_thread should be enough) and some do.
It would be great if someone could shed some light on this behavior (pthread not needed by all Linux platforms)...
I believe that issue occurs when GCC is in version > 4.9.
I googled a little bit and changed it to make it more portable. Now it should try to find thread library with:
FIND_PACKAGE(Threads QUIET)
It should properly work with Windows. Not sure about any other platform as I can't check but the QUIET option should make it optional.
Great!
It works on my Raspberry Pi 3 (Raspbian) which don't need pthread linking (gcc 4.9.2).
It would be good if someone working on Windows could check it.
CMakeFiles/dso.dir/build.make:518: recipe for target 'CMakeFiles/dso.dir/src/IOWrapper/OpenCV/ImageRW_OpenCV.cpp.o' failed make[2]: *** [CMakeFiles/dso.dir/src/IOWrapper/OpenCV/ImageRW_OpenCV.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dso.dir/all' failed make[1]: *** [CMakeFiles/dso.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error
This error occurs when I try to run the program. I am experiencing this problem in the operating system. What is the solution to this?