barinova_pedestrians_detection
barinova_pedestrians_detection copied to clipboard
Build errors with recent version of CMake (2.8.7)
I tried building the library in Ubuntu 12.04, OpenCV 2.2 (also attempted other configurations), and kept getting an error like the following:
/usr/bin/c++ -Wall -DNDEBUG -O3 -fopenmp -funroll-loops -march=native -mtune=native --fast-math -mfpmath=sse -msse3 CMakeFiles
/object_detection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/main_run_greedy_pedestrians.cpp.o CMakeFiles/
object_detection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/DenseGreedyDetection/GreedyDetection.cpp.o CMa
keFiles/object_detection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/Forests/HoughForest.cpp.o CMakeFiles/o
bject_detection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/Forests/IHoughForest.cpp.o CMakeFiles/object_de
tection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/Forests/IHoughTree.cpp.o CMakeFiles/object_detection.di
r/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/Forests/HoughTree.cpp.o CMakeFiles/object_detection.dir/home/kit/
Downloads/barinova_pedestrians_detection/ObjectDetection/Forests/Vote.cpp.o CMakeFiles/object_detection.dir/home/kit/Downloads/barino
va_pedestrians_detection/ObjectDetection/ImageWrapper/HoG.cpp.o CMakeFiles/object_detection.dir/home/kit/Downloads/barinova_pedestria
ns_detection/ObjectDetection/ImageWrapper/MultiImageTools.cpp.o CMakeFiles/object_detection.dir/home/kit/Downloads/barinova_pedestria
ns_detection/ObjectDetection/ImageWrapper/CRPatch.cpp.o -o object_detection -rdynamic -lboost_filesystem-mt -lboost_system-mt -lgomp
-ltbb -lrt -lpthread -lm -ldl
CMakeFiles/object_detection.dir/home/kit/Downloads/barinova_pedestrians_detection/ObjectDetection/main_run_greedy_pedestrians.cpp.o:
In function `HoG::~HoG()':
main_run_greedy_pedestrians.cpp:(.text._ZN3HoGD2Ev[_ZN3HoGD5Ev]+0x9): undefined reference to `cvReleaseMat'
main_run_greedy_pedestrians.cpp:(.text._ZN3HoGD2Ev[_ZN3HoGD5Ev]+0x12): undefined reference to `cvReleaseMat'
main_run_greedy_pedestrians.cpp:(.text._ZN3HoGD2Ev[_ZN3HoGD5Ev]+0x1b): undefined reference to `cvReleaseMat'
main_run_greedy_pedestrians.cpp:(.text._ZN3HoGD2Ev[_ZN3HoGD5Ev]+0x24): undefined reference to `cvReleaseMat'
main_run_greedy_pedestrians.cpp:(.text._ZN3HoGD2Ev[_ZN3HoGD5Ev]+0x2d): undefined reference to `cvReleaseMat'
etc...
The issue was cmake not finding the opencv libraries properly.
I needed to change pkg_check_modules(opencv REQUIRED opencv>=2.1)
to find_package( OpenCV 2.1 REQUIRED )
and target_link_libraries(... ${opencv_LIBRARIES} )
to target_link_libraries(... ${opencv_LIBS} )