Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting linking error with pthread #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichalNowicki
Copy link

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: #66

@MorganChabaud
Copy link

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)...

@MichalNowicki
Copy link
Author

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.

@MorganChabaud
Copy link

MorganChabaud commented Jul 28, 2017

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.

@yolingen23
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants