与“libopencv_highgui链接错误。因此,在Ubuntu 14.04下,有一个奇怪的结果是“libtiff.so.5”

时间:2022-06-02 13:19:53

Problem

I'm compiling the deep learning library Caffe in Ubuntu 14.04(64 bit).

我正在编辑Ubuntu 14.04(64位)的深度学习库Caffe。

OpenCV(Version: 2.4.8+dfsg1-2ubuntu1) is installed from ubuntu packages server with :

OpenCV(版本:2.4.8+dfsg1-2ubuntu1)安装在ubuntu包服务器上,有:

sudo apt-get install libopencv-dev

sudo apt-get安装libopencv-dev

Compile Caffe with CMake 2.8.

使用CMake 2.8编译Caffe。

Linking error:

连接错误:

Linking CXX executable caffe-

连接CXX执行咖啡-

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFOpen@LIBTIFF_4.0'

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: ' TIFFOpen@LIBTIFF_4.0'的未定义引用

Infomation

It seems some symbols of TIFF library were not found. I made some effort to find the reason(without luck). Here's some infomation about the libraries.

似乎找不到TIFF库的一些符号。我努力寻找原因(没有运气)。这里有一些关于图书馆的信息。

TIFF library linked by libopencv_highgui.so.2.4.8

libopencv_highgui.so.2.4.8链接的TIFF库

$ ldd libopencv_highgui.so.2.4.8 | grep tiff

$ ldd libopencv_highgui.so.2.4.8 | grep tiff

libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f978313b000)

libtiff.so。5 = > /usr/lib/x86_64-linux-gnu / libtiff.so。5(0 x00007f978313b000)

Import symbols of libopencv_highgui.so.2.4.8

进口libopencv_highgui.so.2.4.8的象征

$ readelf -s libopencv_highgui.so.2.4.8 |grep TIFFOpen

$ readelf -s libopencv_highgui.so.2.4.8 |grep

62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TIFFOpen@LIBTIFF_4.0 (9)

62: 000000000000000000000000 0 FUNC全局默认值和TIFFOpen@LIBTIFF_4.0 (9)

Note: There is one single @ in the symbol names.

注意:符号名中只有一个@。

$ nm -D libopencv_highgui.so.2.4.8| grep TIFFOpen

$ nm -D libopencv_highgui.so.2.4.8| grep

U TIFFOpen

U TIFFOpen

Export symbols of libtiff.so.5:

出口libtiff.so.5的象征:

$ nm -D /usr/lib/x86_64-linux-gnu/libtiff.so.5

nm - d /usr/lib/x86_64-linux-gnu / libtiff.so.5美元

0000000000000000 A LIBTIFF_4.0

0000000000000000一个LIBTIFF_4.0

...

00000000000429f0 T TIFFOpen

00000000000429 f0 T TIFFOpen

...

$ readelf -s /usr/lib/x86_64-linux-gnu/libtiff.so.5|grep TIFFOpen

readelf - s /usr/lib/x86_64-linux-gnu / libtiff.so美元。5 | grep TIFFOpen

99: 00000000000429f0 239 FUNC GLOBAL DEFAULT 12 TIFFOpen@@LIBTIFF_4.0

99: 000000000000000429f0 239 FUNC全局默认值12 tiffopen@libtiff_4.0

Note: There are two @(@@) in the symbol names.

注意:符号名中有两个@(@@)。

My confusion

  1. Is it because libtiff.so.5 has @@ in the symbol names instead of @ that made the linking error

    libopencv_highgui.so.2.4.8: undefined reference to 'TIFFIsTiled@LIBTIFF_4.0'

    libopencv_highgui.so.2.4.8:“tiffistiled@tiff_lib_4.0”的未定义引用

  2. What's the difference between @ and @@ in symbol names?
  3. 符号名中的@和@有什么区别?
  4. What's the meaning of the suffix LIBTIFF_4.0 of symbols names in libtiff.so.5?
  5. libtiffany _4.0符号名称的后缀是什么意思?
  6. Many people said it's because OpenCV need libtiff4-dev which is not provided by Ubuntu 14.04. Then why the Ubuntu guys put a broken package on the package server.
  7. 很多人说这是因为OpenCV需要libtiff4-dev,这是Ubuntu 14.04所没有的。然后为什么Ubuntu的家伙在包服务器上放了一个坏包。
  8. How to solve the linking problem?
  9. 如何解决链接问题?


I'm not a profession on compiling and linking. Sorry for such a long post. Just what to provide enough infomation for you guys to help me. Appreciate for any suggestions.

我并不擅长编译和链接。抱歉这么长时间发邮件。给你们提供足够的信息来帮助我。欣赏的任何建议。

P.S. If you need more infomation of those libs, feel free to say in the comment.

附注:如果你需要更多的信息,请在评论中畅所欲言。

5 个解决方案

#1


1  

Install libtiff4-dev:

安装libtiff4-dev:

sudo apt-get install libtiff4-dev

sudo apt-get安装libtiff4-dev

#2


1  

This is what worked for me: Go to Tiff website, and follow the instructions to download Tiff and build it, and install it. Then in your make file add this:

这就是我的工作:访问Tiff网站,按照说明下载Tiff并构建它,然后安装它。然后在制作文件中添加以下内容:

-L/[path to libtiff.so] -ltiff

If you want to know the path to the libtiff.so try this:

如果您想知道libtiff的路径。那么试试这个:

sudo find /usr/ -name libtiff.so

#3


1  

Old question but still without an answer so here it goes (I came across the same error today):

老问题,但仍然没有答案,所以在这里(我今天遇到了同样的错误):

  1. That is not why the linker fails. If it was able to find libtiff.so.5 it would have linked just fine.

    这并不是链接器失败的原因。如果它能找到利伯蒂。5 . it would have connected just just just just right .它本来可以很好地链接。

  2. @ vs @@ is just a way to track difference versions of the function. More details here https://sourceware.org/binutils/docs/ld/VERSION.html

    @ vs @@只是跟踪函数不同版本的一种方法。更多细节在这里https://sourceware.org/binutils/docs/ld/VERSION.html

  3. LIBTIFF_4.0 means it is that specific version of TIFFOpen that is required when dynamically loading the symbol.

    LIBTIFF_4.0的意思是,当动态加载这个符号时,它是必需的。

  4. That is probably a good way to fix the issue. It's likely that without the libtiff-dev package the libtiff.so symbolic linked file doesn't exit in /usr/lib/x86_64-linux-gnu/ so the linker will not be able to find the library (it knows nothing about libtiff.so.5 unless you tell it explicitly).

    这可能是解决这个问题的好办法。很可能在没有libtiff-dev包的情况下,libtiff就会被使用。因此,符号链接文件不会退出/usr/lib/x86_64-linux-gnu/因此链接器将无法找到库(它不了解libtiffso)。除非你明确地说出来。

  5. a. You may be able to test 4. by invoking the linker command line yourself from the command line. If you compiled caffe with cmake you'll find the linker command under tools/CMakeFiles/caffe.bin.dir/link.txt. Just add /usr/lib/x86_64-linux-gnu/libtiff.so.5 to the command line and it should work.

    你可以考4分。通过从命令行调用链接器命令行。如果您使用cmake编译caffe,您将在tools/ cmakefile / caffe.dir /link.txt下找到链接器命令。只是添加/usr/lib/x86_64-linux-gnu / libtiff.so。5到命令行,它应该可以工作。

    b. Alternatively manually create the symbolic link /usr/lib/x86_64-linux-gnu/libtiff.so

    或者手动创建符号链接/usr/lib/x86_64 linux-gnu/ tifflibso

    c. install the dev package, which should do that for you. Also make sure that cmake knows about /usr/lib/x86_64-linux-gnu/ by specify extra library path

    c.安装dev包,它应该为您做这件事。还要确保cmake通过指定额外的库路径来了解/usr/lib/x86_64-linux-gnu/

    d. check that there are no other libtiff.so library lurking in your system if previous steps don't work (e.g. anconda type thing)

    检查是否没有其他libtiff。因此,如果前面的步骤不起作用,则隐藏在系统中的库(例如anconda之类的)

Hope it helps.

希望它可以帮助。

#4


1  

I had similiar problems and it was due to Anaconda messing up

我有类似的问题,这是由于蟒蛇搞砸了

I simply had to execute the following command:

我只需要执行以下命令:

conda remove libtiff

I installed opecv via:

我安装了opecv通过:

sudo apt-get install opencv-dev

and libtiff via:

和libtiff通过:

sudo apt-get install libtiff4-dev

#5


0  

As you can see in

正如你所看到的。

62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TIFFOpen@LIBTIFF_4.0 (9)

there's an UND which I think means undefined. I guess when ubuntu is producing libopencv_highgui, it fails to find TIFFOpen@LIBTIFF 4.0. So I think I should have libtiff at hand and compile libopencv_xxx again.

有一个UND,我认为意思是没有定义的。我猜当ubuntu在生成libopencv_highgui时,它没有找到tiffopen@lib4.0。所以我认为我应该手边有libtiff并再次编译libopencv_xxx。

I like to include things in conda. So I install opencv again with conda, and point my LIBRARY_PATH to the conda lib directory and things go well.

我喜欢在conda中包含一些东西。因此,我再次使用conda安装opencv,并将LIBRARY_PATH指向conda lib目录,一切顺利。

#1


1  

Install libtiff4-dev:

安装libtiff4-dev:

sudo apt-get install libtiff4-dev

sudo apt-get安装libtiff4-dev

#2


1  

This is what worked for me: Go to Tiff website, and follow the instructions to download Tiff and build it, and install it. Then in your make file add this:

这就是我的工作:访问Tiff网站,按照说明下载Tiff并构建它,然后安装它。然后在制作文件中添加以下内容:

-L/[path to libtiff.so] -ltiff

If you want to know the path to the libtiff.so try this:

如果您想知道libtiff的路径。那么试试这个:

sudo find /usr/ -name libtiff.so

#3


1  

Old question but still without an answer so here it goes (I came across the same error today):

老问题,但仍然没有答案,所以在这里(我今天遇到了同样的错误):

  1. That is not why the linker fails. If it was able to find libtiff.so.5 it would have linked just fine.

    这并不是链接器失败的原因。如果它能找到利伯蒂。5 . it would have connected just just just just right .它本来可以很好地链接。

  2. @ vs @@ is just a way to track difference versions of the function. More details here https://sourceware.org/binutils/docs/ld/VERSION.html

    @ vs @@只是跟踪函数不同版本的一种方法。更多细节在这里https://sourceware.org/binutils/docs/ld/VERSION.html

  3. LIBTIFF_4.0 means it is that specific version of TIFFOpen that is required when dynamically loading the symbol.

    LIBTIFF_4.0的意思是,当动态加载这个符号时,它是必需的。

  4. That is probably a good way to fix the issue. It's likely that without the libtiff-dev package the libtiff.so symbolic linked file doesn't exit in /usr/lib/x86_64-linux-gnu/ so the linker will not be able to find the library (it knows nothing about libtiff.so.5 unless you tell it explicitly).

    这可能是解决这个问题的好办法。很可能在没有libtiff-dev包的情况下,libtiff就会被使用。因此,符号链接文件不会退出/usr/lib/x86_64-linux-gnu/因此链接器将无法找到库(它不了解libtiffso)。除非你明确地说出来。

  5. a. You may be able to test 4. by invoking the linker command line yourself from the command line. If you compiled caffe with cmake you'll find the linker command under tools/CMakeFiles/caffe.bin.dir/link.txt. Just add /usr/lib/x86_64-linux-gnu/libtiff.so.5 to the command line and it should work.

    你可以考4分。通过从命令行调用链接器命令行。如果您使用cmake编译caffe,您将在tools/ cmakefile / caffe.dir /link.txt下找到链接器命令。只是添加/usr/lib/x86_64-linux-gnu / libtiff.so。5到命令行,它应该可以工作。

    b. Alternatively manually create the symbolic link /usr/lib/x86_64-linux-gnu/libtiff.so

    或者手动创建符号链接/usr/lib/x86_64 linux-gnu/ tifflibso

    c. install the dev package, which should do that for you. Also make sure that cmake knows about /usr/lib/x86_64-linux-gnu/ by specify extra library path

    c.安装dev包,它应该为您做这件事。还要确保cmake通过指定额外的库路径来了解/usr/lib/x86_64-linux-gnu/

    d. check that there are no other libtiff.so library lurking in your system if previous steps don't work (e.g. anconda type thing)

    检查是否没有其他libtiff。因此,如果前面的步骤不起作用,则隐藏在系统中的库(例如anconda之类的)

Hope it helps.

希望它可以帮助。

#4


1  

I had similiar problems and it was due to Anaconda messing up

我有类似的问题,这是由于蟒蛇搞砸了

I simply had to execute the following command:

我只需要执行以下命令:

conda remove libtiff

I installed opecv via:

我安装了opecv通过:

sudo apt-get install opencv-dev

and libtiff via:

和libtiff通过:

sudo apt-get install libtiff4-dev

#5


0  

As you can see in

正如你所看到的。

62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TIFFOpen@LIBTIFF_4.0 (9)

there's an UND which I think means undefined. I guess when ubuntu is producing libopencv_highgui, it fails to find TIFFOpen@LIBTIFF 4.0. So I think I should have libtiff at hand and compile libopencv_xxx again.

有一个UND,我认为意思是没有定义的。我猜当ubuntu在生成libopencv_highgui时,它没有找到tiffopen@lib4.0。所以我认为我应该手边有libtiff并再次编译libopencv_xxx。

I like to include things in conda. So I install opencv again with conda, and point my LIBRARY_PATH to the conda lib directory and things go well.

我喜欢在conda中包含一些东西。因此,我再次使用conda安装opencv,并将LIBRARY_PATH指向conda lib目录,一切顺利。