severin-lemaignan / gazr

3D head pose estimation using monocular vision
Other
179 stars 55 forks source link

Compiling problems with dlib #32

Closed bach05 closed 3 years ago

bach05 commented 3 years ago

Hi,

I'm trying to compile the project. I would like to use it as a ROS package in my workspace, so I'm building with catkin build gazr. I installed dlib with sudo apt-get install libdlib-dev. I'm on ROS Melodic.

The first building gives me this error:

/home/alberto/tiago_dual_public_ws/src/gazr/src/head_pose_estimation.cpp: In member function ‘std::vector<std::vector<cv::Point_<int> > > HeadPoseEstimation::update(cv::InputArray)’:
/home/alberto/tiago_dual_public_ws/src/gazr/src/head_pose_estimation.cpp:51:20: error: ‘cvIplImage’ was not declared in this scope
     auto ipl_img = cvIplImage(image);
                    ^~~~~~~~~~
/home/alberto/tiago_dual_public_ws/src/gazr/src/head_pose_estimation.cpp:51:20: note: suggested alternative: ‘IplImage’
     auto ipl_img = cvIplImage(image);
                    ^~~~~~~~~~
                    IplImage

I easily solved following the suggestion of the compiler. Then I got:

/usr/bin/ld: /usr/lib/libdlib.a(threads_kernel_shared.o): relocation R_X86_64_PC32 against symbol `_ZN4dlib21threads_kernel_shared14thread_starterEPv' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [/home/alberto/tiago_dual_public_ws/devel/.private/gazr/lib/libgazr.so] Error 1
make[1]: *** [CMakeFiles/gazr.dir/all] Error 2
make: *** [all] Error 2

I don't know how to solve it. It seems is it due to a wrong compilation of dlib. Can someone help me?

bach05 commented 3 years ago

UPDATE: I have been able to compile by changing this line on the CMakeLists file:

target_link_libraries(gazr dlib ${OpenCV_LIBRARIES})

Hope this will be useful.

severin-lemaignan commented 3 years ago

Closing the issue as can not reproduce on current master. Please reopen if necessary.