真的已经好就不用C++了,但是一旦要移植项目或者进行项目部署,不用C++那是不可能的,所以下面仅仅是安装一个DLIB库是一个现代的C++工具包,包含机器学习算法和工具,用于在C++中创建复杂的软件来解决实际问题。
好了,这个都是官话。。。
首先要下载源码,对应地址在:http://dlib.net/
下载完后,解压后,cd到对应路径之下
cd dlib-19.17
mkdir build
cd build
cmake ..
cmake --build .
make install
其实这就安装好了,如果你认为结束了,那么可能就想多了,接下来重点来了
当LZ想要编译dlib19.17当中的examples的时候,结果就悲剧了。。。
cd examples
mkdir build
cmake ..
cmake --build .
报错开始
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFGetField@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_generate@UUID_1.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFClose@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFOpen@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFSetField@LIBTIFF_4.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_unparse_lower@UUID_1.0'
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
CMakeFiles/webcam_face_pose_ex.dir/build.make:131: recipe for target 'webcam_face_pose_ex' failed
make[2]: *** [webcam_face_pose_ex] Error 1
CMakeFiles/Makefile2:1954: recipe for target 'CMakeFiles/webcam_face_pose_ex.dir/all' failed
make[1]: *** [CMakeFiles/webcam_face_pose_ex.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
查了很多资料,有的说是权限问题,LZ加了sudo,然而并没有什么用。
第二种:注释掉Anaconda路径
sudo gedit ~/.bashrc
LZ把当中带有Anaconda字眼的全部注释,然而。。。并没有什么用。。。
第三种:强行安装
sudo apt-get install libtiff4-dev
然而也没有什么用。。。
解决方案来了
locate libtiff.so
结果显示:
/home/felaim/anaconda3/lib/libtiff.so
/home/felaim/anaconda3/lib/libtiff.so.5
/home/felaim/anaconda3/lib/libtiff.so.5.4.0
/home/felaim/anaconda3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so
/home/felaim/anaconda3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so.5
/home/felaim/anaconda3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so.5.4.0
/usr/lib/x86_64-linux-gnu/libtiff.so
/usr/lib/x86_64-linux-gnu/libtiff.so.5
/usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
/usr/local/MATLAB/R2015b/bin/glnxa64/libtiff.so.5
/usr/local/MATLAB/R2015b/bin/glnxa64/libtiff.so.5.0.5
果然是和anaconda冲突了,下面比较暴力的方法
mv /home/felaim/anaconda3/lib/libtiff.so* /home/felaim/Documents/temp/
你冲突了,我就暂时把你挪走,然后编译开始。。。问题解决。
有了前面的操作,后面又遇到一个问题:
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_generate@UUID_1.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_unparse_lower@UUID_1.0'
collect2: error: ld returned 1 exit status
CMakeFiles/webcam_face_pose_ex.dir/build.make:131: recipe for target 'webcam_face_pose_ex' failed
make[2]: *** [webcam_face_pose_ex] Error 1
CMakeFiles/Makefile2:1954: recipe for target 'CMakeFiles/webcam_face_pose_ex.dir/all' failed
make[1]: *** [CMakeFiles/webcam_face_pose_ex.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
LZ对libuuid也locate一下
locate libuuid
发现也是和anaconda冲突了,把anaconda中对应libuuid的库移走,然后就可以编译了。
PS:编译完成后别忘了挪回来
项目ddl提前了一个月/(ㄒoㄒ)/~~