DLIB19.17編譯的一些問題(包括與Anaconda衝突問題解決)

真的已經好就不用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ㄒ)/~~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章