TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.93k stars 1.85k forks source link

build fails with undefined reference to boost::filesystem::path_traits::dispatch #919

Open VincentKaras opened 3 years ago

VincentKaras commented 3 years ago

Describe the bug When I try to build OpenFace everything works until linking of the executables, then it fails with:

undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)'

To Reproduce run cmake like this:

OPENFACE=${HOME}/OpenFace
PREFIX=${HOME}/install/OpenFace

cmake -D CMAKE_INSTALL_PREFIX=${HOME}/install/OpenFace \
-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_CXX_COMPILER=g++ -D CMAKE_C_COMPILER=gcc \
-D OpenCV_DIR=${HOME}/install/OpenCV-4.5.0/lib/cmake/opencv4 -D dlib_DIR=${HOME}/install/dlib-19.21/lib/cmake/dlib/ \
-D OpenBLAS_INCLUDE_DIR=/usr/include/openblas -D OpenBLAS_LIB=/usr/lib/libopenblas.so \
-D CMAKE_INSTALL_PREFIX=$PREFIX $OPENFACE

This step runs without any errors or warnings.

Expected behavior Build succeeds

Screenshots

-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/karasvin/install/gcc-10.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/karasvin/install/gcc-10.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenBLAS libraries: /usr/lib/libopenblas.so
-- Found OpenBLAS include: /usr/include/openblas
OpenBLAS information:
  OpenBLAS_LIBRARIES: /usr/lib/libopenblas.so
  OpenBLAS_INCLUDE: /usr/include/openblas
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /home/karasvin/cuda-11.1 (found suitable exact version "11.1")
-- Found OpenCV: /home/karasvin/install/OpenCV-4.5.0 (found suitable version "4.5.0", minimum required is "4.0") found components: core imgproc calib3d highgui objdetect
OpenCV information:
  OpenCV_INCLUDE_DIRS: /home/karasvin/install/OpenCV-4.5.0/include/opencv4
  OpenCV_LIBRARIES: opencv_core;opencv_imgproc;opencv_calib3d;opencv_highgui;opencv_objdetect
  OpenCV_LIBRARY_DIRS:
-- Found Boost: /usr/local/include (found suitable version "1.58.0", minimum required is "1.5.9") found components: filesystem system
Boost information:
  Boost_VERSION: 105800
  Boost_INCLUDE_DIRS: /usr/local/include
  Boost_LIBRARIES: /usr/local/lib/libboost_filesystem.so;/usr/local/lib/libboost_system.so
  Boost_LIBRARY_DIRS: /usr/local/lib
dlib information:
  dlib version: 19.21.0
-- Standalone mode detected; Enabling configuration/targets export.
-- Configuring done
-- Generating done
-- Build files have been written to:  /home/karasvin/OpenFace/build
Scanning dependencies of target FaceLandmarkVidMulti
Scanning dependencies of target FaceLandmarkImg
Scanning dependencies of target FeatureExtraction
Scanning dependencies of target FaceLandmarkVid
[ 86%] Building CXX object exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/FaceLandmarkImg.cpp.o
[ 88%] Building CXX object exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/FaceLandmarkVid.cpp.o
[ 90%] Building CXX object exe/FeatureExtraction/CMakeFiles/FeatureExtraction.dir/FeatureExtraction.cpp.o
[ 90%] Building CXX object exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/FaceLandmarkVidMulti.cpp.o
[ 93%] Linking CXX executable ../../bin/FaceLandmarkVid
../../lib/local/Utilities/libUtilities.a(SequenceCapture.cpp.o): In function `std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > std::__copy_move_a<false, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > >(boost::filesystem::directory_iterator, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > >)':
SequenceCapture.cpp:(.text._ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_[_ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_]+0x11f): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
[ 95%] Linking CXX executable ../../bin/FeatureExtraction
collect2: error: ld returned 1 exit status
exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/build.make:135: recipe for target 'bin/FaceLandmarkVid' failed
make[2]: *** [bin/FaceLandmarkVid] Error 1
CMakeFiles/Makefile2:400: recipe for target 'exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all' failed
make[1]: *** [exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
../../lib/local/Utilities/libUtilities.a(SequenceCapture.cpp.o): In function `std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > std::__copy_move_a<false, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > >(boost::filesystem::directory_iterator, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > >)':
SequenceCapture.cpp:(.text._ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_[_ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_]+0x11f): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
[ 97%] Linking CXX executable ../../bin/FaceLandmarkVidMulti
collect2: error: ld returned 1 exit status
exe/FeatureExtraction/CMakeFiles/FeatureExtraction.dir/build.make:135: recipe for target 'bin/FeatureExtraction' failed
make[2]: *** [bin/FeatureExtraction] Error 1
CMakeFiles/Makefile2:460: recipe for target 'exe/FeatureExtraction/CMakeFiles/FeatureExtraction.dir/all' failed
make[1]: *** [exe/FeatureExtraction/CMakeFiles/FeatureExtraction.dir/all] Error 2
../../lib/local/Utilities/libUtilities.a(SequenceCapture.cpp.o): In function `std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > std::__copy_move_a<false, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > >(boost::filesystem::directory_iterator, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > >)':
SequenceCapture.cpp:(.text._ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_[_ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_]+0x11f): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
collect2: error: ld returned 1 exit status
exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/build.make:135: recipe for target 'bin/FaceLandmarkVidMulti' failed
make[2]: *** [bin/FaceLandmarkVidMulti] Error 1
CMakeFiles/Makefile2:430: recipe for target 'exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all' failed
make[1]: *** [exe/FaceLandmarkVidMulti/CMakeFiles/FaceLandmarkVidMulti.dir/all] Error 2
[100%] Linking CXX executable ../../bin/FaceLandmarkImg
../../lib/local/Utilities/libUtilities.a(ImageCapture.cpp.o): In function `std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > std::__copy_move_a<false, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > >(boost::filesystem::directory_iterator, boost::filesystem::directory_iterator, std::back_insert_iterator<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > >)':
ImageCapture.cpp:(.text._ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_[_ZSt13__copy_move_aILb0EN5boost10filesystem18directory_iteratorESt20back_insert_iteratorISt6vectorINS1_4pathESaIS5_EEEET1_T0_SA_S9_]+0x11f): undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
collect2: error: ld returned 1 exit status
exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/build.make:135: recipe for target 'bin/FaceLandmarkImg' failed
make[2]: *** [bin/FaceLandmarkImg] Error 1
CMakeFiles/Makefile2:370: recipe for target 'exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all' failed
make[1]: *** [exe/FaceLandmarkImg/CMakeFiles/FaceLandmarkImg.dir/all] Error 2
Makefile:148: recipe for target 'all' failed

Desktop (please complete the following information):

Additional context Possibly related to #678 - but my compiler is 10.2.0

I tried to dodge this problem by disabling Boost (changing the requirement version to > 1.58.0 in find_package).

-- Could NOT find Boost: Found unsuitable version "1.58.0", but required is at least "1.79.0" (found /usr/local/include, found components: filesystem system)
Boost not found in the system.

But that throws errors that boost is missing - it is not possible to build without it?

/usr/bin/ld: CMakeFiles/FaceLandmarkVid.dir/FaceLandmarkVid.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/local/lib/libboost_system.so.1.58.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/build.make:133: recipe for target 'bin/FaceLandmarkVid' failed
make[2]: *** [bin/FaceLandmarkVid] Error 1
CMakeFiles/Makefile2:400: recipe for target 'exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all' failed
make[1]: *** [exe/FaceLandmarkVid/CMakeFiles/FaceLandmarkVid.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
tashrifbillah commented 3 years ago

Hi @VincentKaras , I am getting the same error using GCC-9.3.0 on a RedHat Enterprise Linux computer. I also tried to dodge Boost but to no avail. Did you ever find a solution to this?

cc @TadasBaltrusaitis

tashrifbillah commented 3 years ago

I updated my boost to 1.7.0 and that helped!