Problem
I'm compiling the deep learning library Caffe in Ubuntu 14.04(64 bit).
OpenCV(Version: 2.4.8+dfsg1-2ubuntu1
) is installed from ubuntu packages server with :
sudo apt-get install libopencv-dev
Compile Caffe
with CMake 2.8.
Linking error:
Linking CXX executable caffe-
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `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 library linked by libopencv_highgui.so.2.4.8
$ ldd libopencv_highgui.so.2.4.8 | grep tiff
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f978313b000)
Import symbols of libopencv_highgui.so.2.4.8
$ readelf -s libopencv_highgui.so.2.4.8 |grep TIFFOpen
62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TIFFOpen@LIBTIFF_4.0 (9)
Note: There is one single @
in the symbol names.
$ nm -D libopencv_highgui.so.2.4.8| grep TIFFOpen
U TIFFOpen
Export symbols of libtiff.so.5
:
$ nm -D /usr/lib/x86_64-linux-gnu/libtiff.so.5
0000000000000000 A LIBTIFF_4.0
...
00000000000429f0 T 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
Note: There are two @
(@@
) in the symbol names.
My confusion
- Is it because
libtiff.so.5
has@@
in the symbol names instead of@
that made the linking errorlibopencv_highgui.so.2.4.8: undefined reference to 'TIFFIsTiled@LIBTIFF_4.0'
- What's the difference between
@
and@@
in symbol names? - What's the meaning of the suffix
LIBTIFF_4.0
of symbols names inlibtiff.so.5
? - 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. - How to solve the linking problem?
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.
libopencv-dev
package was not build with TIFF library, anyway your can build OpenCV from source. – Verina