其他分享
首页 > 其他分享> > ubnutu: 编译libtorch有关的代码时opencv报错-undefined reference to `TIFF**********@LIBTIFF_4.0‘

ubnutu: 编译libtorch有关的代码时opencv报错-undefined reference to `TIFF**********@LIBTIFF_4.0‘

作者:互联网

报错如下:

[ 25%] Linking CXX executable yolov4
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFWriteEncodedStrip@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFTileSize@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFGetFieldDefaulted@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `_TIFFmalloc@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFReadTile@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `_TIFFfree@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFGetField@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFWriteDirectory@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libSM.so.6: undefined reference to `uuid_generate@UUID_1.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFNumberOfDirectories@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFReadRGBAImage@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFSetField@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libSM.so.6: undefined reference to `uuid_unparse_lower@UUID_1.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFSetDirectory@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFReadScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.3.so.6.3: undefined reference to `TIFFNumberOfTiles@LIBTIFF_4.0'
/usr/local/lib/libopencv_world.so.3.4.10: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
CMakeFiles/yolov4.dir/build.make:178: recipe for target 'yolov4' failed
make[2]: *** [yolov4] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/yolov4.dir/all' failed
make[1]: *** [CMakeFiles/yolov4.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

解决方法:

不同的人可能解决方法不一样,先放上该问题有关的GitHub链接供大家查阅:

1、https://github.com/colmap/colmap/issues/188

2、https://github.com/lagadic/visp/issues/109

一般这个问题是由于已经安装的anaconda3的lib文件夹下的某些库文件与环境/usr/lib中的冲突了,在终端中运行以下命令即可解决问题:

conda uninstall libtiff

按照GitHub上说的解决方案,还有一种就是注释掉.bashrc中的anaconda的环境设置,在编译完之后再恢复,但是这种方法我用了没反应,所以就是用了上面说的那种方式。

 

标签:undefined,reference,LIBTIFF,报错,usr,lib,4.0
来源: https://blog.csdn.net/Flag_ing/article/details/111044926