Repository: facebookarchive/caffe2

Issue #1799: undefined reference to TIFFReadRGBAStrip@LIBTIFF_4.0
Created: 2018-01-24T11:31:54Z
Error came up when building caffe2.

[ 76%] Building CXX object caffe2/CMakeFiles/reshape_op_gpu_test.dir/operators/reshape_op_gpu_test.cc.o
[ 76%] Linking CXX executable ../bin/reshape_op_gpu_test
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFReadRGBAStrip@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFIsTiled@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFWriteScanline@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFGetField@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFScanlineSize@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFReadEncodedTile@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFReadRGBATile@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFClose@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFRGBAImageOK@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFOpen@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFSetField@LIBTIFF_4.0'
/usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFSetWarningHandler@LIBTIFF_4.0' /usr/local/lib/libopencv_highgui.so.2.4.13: undefined reference to TIFFSetErrorHandler@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/reshape_op_gpu_test.dir/build.make:134: recipe for target 'bin/reshape_op_gpu_test' failed
make[3]: *** [bin/reshape_op_gpu_test] Error 1
make[3]: Leaving directory '/home/gzx/caffe2/build'
CMakeFiles/Makefile2:1284: recipe for target 'caffe2/CMakeFiles/reshape_op_gpu_test.dir/all' failed
make[2]: *** [caffe2/CMakeFiles/reshape_op_gpu_test.dir/all] Error 2
make[2]: Leaving directory '/home/gzx/caffe2/build'
Makefile:138: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/gzx/caffe2/build'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

If this is a build issue, please fill out the template below.
System information

Operating system: ubuntu 16.04
Compiler version: gcc 5.4.0
CMake version:  3.5.1
CMake arguments:
Relevant libraries/versions (e.g. CUDA): CUDA 8.0 Cudnn 6.1

CMake summary output
******** Summary ********
There is no summary...

Duplicate issue #1693: Cannot link OpenCV because of libjpeg (Anaconda)
Created: 2018-01-03T08:45:55Z
-- GCC 5.4.0: Adding gcc and gcc_s libs to link line
-- Include NCCL operators
-- Include NNPACK operators
-- Including image processing operators
-- Excluding video processing operators due to no opencv
-- Excluding mkl operators as we are not using mkl
-- Include Observer library
-- Automatically generating missing __init__.py files.
-- 
-- ******** Summary ********
-- General:
--   Git version           : v0.8.1-890-g7a7afaa
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 5.4.0
--   Protobuf compiler     : /usr/bin/protoc
--   CXX flags             :  -std=c++11 -O2 -fPIC -Wno-narrowing
--   Build type            : Release
--   Compile definitions   : 
-- 
--   BUILD_BINARY          : ON
--   BUILD_PYTHON          : ON
--     Python version      : 2.7.13
--     Python library      : /home/frank/anaconda3/envs/caffe2/lib/libpython2.7.so
--   BUILD_SHARED_LIBS     : ON
--   BUILD_TEST            : ON
--   USE_ATEN              : OFF
--   USE_ASAN              : OFF
--   USE_CUDA              : ON
--     CUDA version        : 8.0
--     CuDNN version       : 7.0.5
--   USE_EIGEN_FOR_BLAS    : 1
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : ON
--   USE_GLOG              : ON
--   USE_GLOO              : ON
--   USE_LEVELDB           : ON
--     LevelDB version     : 1.18
--     Snappy version      : 1.1.3
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : ON
--     LMDB version        : 0.9.17
--   USE_METAL             : OFF
--   USE_MKL               : 
--   USE_MOBILE_OPENGL     : OFF
--   USE_MPI               : ON
--   USE_NCCL              : ON
--   USE_NERVANA_GPU       : OFF
--   USE_NNPACK            : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCV            : ON
--     OpenCV version      : 3.1.0
--   USE_OPENMP            : OFF
--   USE_PROF              : OFF
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_THREADS           : ON
--   USE_ZMQ               : OFF
-- Configuring done
-- Generating done



[ 75%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/iter_op_gpu.cc.o
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/learning_rate_op_gpu.cc.o
[ 76%] Linking CXX shared library ../lib/libcaffe2_gpu.so
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
[ 76%] Built target caffe2_gpu
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
Scanning dependencies of target caffe2_pybind11_state_gpu
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state.cc.o
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_dlpack.cc.o
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_mkl.cc.o
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_gpu.cc.o
[ 76%] Linking CXX shared module python/caffe2_pybind11_state_gpu.so
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
[ 76%] Built target caffe2_pybind11_state_gpu
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
Scanning dependencies of target caffe2_pybind11_state
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state.cc.o
[ 76%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state_dlpack.cc.o
[ 77%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state_mkl.cc.o
[ 77%] Linking CXX shared module python/caffe2_pybind11_state.so
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
[ 77%] Built target caffe2_pybind11_state
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
Scanning dependencies of target reshape_op_gpu_test
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
make[3]: Entering directory '/home/frank/Desktop/caffe2/build'
[ 78%] Building CXX object caffe2/CMakeFiles/reshape_op_gpu_test.dir/operators/reshape_op_gpu_test.cc.o
[ 78%] Linking CXX executable ../bin/reshape_op_gpu_test
/usr/bin/ld: warning: libjpeg.so.9, needed by /usr/local/lib/libopencv_imgcodecs.so.3.1.0, not found (try using -rpath or -rpath-link)
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_finish_decompress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_set_quality@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_quality_scaling@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_destroy_decompress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_resync_to_restart@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_CreateDecompress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_alloc_huff_table@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_set_defaults@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_CreateCompress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_stdio_src@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_finish_compress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_calc_output_dimensions@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_std_error@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_default_qtables@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_start_decompress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_write_scanlines@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_simple_progression@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_read_header@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_read_scanlines@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_start_compress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_destroy_compress@LIBJPEG_9.0'
/usr/local/lib/libopencv_imgcodecs.so.3.1.0: undefined reference to `jpeg_stdio_dest@LIBJPEG_9.0'
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/reshape_op_gpu_test.dir/build.make:133: recipe for target 'bin/reshape_op_gpu_test' failed
make[3]: *** [bin/reshape_op_gpu_test] Error 1
make[3]: Leaving directory '/home/frank/Desktop/caffe2/build'
CMakeFiles/Makefile2:1269: recipe for target 'caffe2/CMakeFiles/reshape_op_gpu_test.dir/all' failed
make[2]: *** [caffe2/CMakeFiles/reshape_op_gpu_test.dir/all] Error 2
make[2]: Leaving directory '/home/frank/Desktop/caffe2/build'
Makefile:140: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/frank/Desktop/caffe2/build'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2


I can find /usr/local/lib/libopencv_imgcodecs.so.3.1.0

Closing comment (2018-02-14T04:03:13Z): I noticed that @zhangxgu post is the same as #1799
Pieter's suggestions should solve this problem, so I will close this task.