问题
So trying to build OpenPose from source, and was running into a linking problem. Current environment is Ubuntu 16.04.4. OpenCV version is 3.3.1. GCC version is 5.4.0.
[ 87%] Built target openpose
[ 87%] Linking CXX executable 1_extract_from_image.bin
[ 87%] Linking CXX executable openpose.bin
[ 87%] Linking CXX executable 3_user_input_processing_and_output.bin
[ 87%] Linking CXX executable 2_extract_pose_or_heatmat_from_image.bin
[ 87%] Linking CXX executable 1_custom_post_processing.bin
[ 87%] Linking CXX executable 2_user_processing_function.bin
[ 88%] Linking CXX executable 1_openpose_read_and_display.bin
/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/libopencv_objdetect.so.3.3.1: undefined reference to
std::thread::_State::~_State()@GLIBCXX_3.4.22
/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/libopencv_objdetect.so.3.3.1: undefined reference to
std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())@GLIBCXX_3.4.22
/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/libopencv_objdetect.so.3.3.1: undefined reference to
typeinfo for std::thread::_State@GLIBCXX_3.4.22
collect2: error: ld returned 1 exit status
examples/openpose/CMakeFiles/openpose.bin.dir/build.make:150: recipe for target 'examples/openpose/openpose.bin' failed
make[2]: *** [examples/openpose/openpose.bin] Error 1
CMakeFiles/Makefile2:1135: recipe for target 'examples/openpose/CMakeFiles/openpose.bin.dir/all' failed
make[1]: *** [examples/openpose/CMakeFiles/openpose.bin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
回答1:
I just had the same issue and installed the latest versions of gcc and g++, which solved the problem. Like here: https://askubuntu.com/a/789417
I just installed version 8 (thus gcc-8 and g++-8). Then you have to call update-alternatives as described there.
来源:https://stackoverflow.com/questions/50361134/openpose-linking-error-on-stdthread