简体   繁体   中英

libtiff4 error with ROS

I am trying to compile a ROS-package from a friend with catkin under Ubuntu 14.04 and am getting the following error:

/usr/bin/ld: warning: libboost_system.so.1.49.0, needed by   
//usr/local/MATLAB/R2014a/bin/glnxa64/libut.so, may conflict with libboost_system.so.1.54.0
//usr/local/lib/libcvd.so: undefined reference to `TIFFWriteEncodedStrip@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFReadRGBAImageOriented@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFGetField@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFGetFieldDefaulted@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFStripSize@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFSetField@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined reference to `FT_Face_GetCharVariantIndex'
//usr/local/lib/libcvd.so: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
//usr/local/lib/libcvd.so: undefined reference to `TIFFReadScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined reference to `FT_Get_Advance'
collect2: error: ld returned 1 exit status

I have libcvd installed and also libtiff4-dev. Has anybody any idea, how to solve that issue?

Thanks a lot,

snow

EDIT: As suggest I include the CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(test)
set (test_VERSION "0.0.1")


find_package(OpenCV REQUIRED)

find_package(catkin REQUIRED COMPONENTS
  test_core
  cv_bridge
  image_transport
  roscpp
)

find_package(tracker)

set (CMAKE_CXX_FLAGS "-DNDEBUG -DNTIMING -DNRUN_UNIT_TESTS -g -O0 -std=c++11")

catkin_package(
  INCLUDE_DIRS include
)


include_directories (include
  ${CMAKE_CURRENT_SOURCE_DIR}/include
  ${tracker_INCLUDE_DIRS}
  ${TRIANGULATION_INCLUDE_DIRS}
  ${OPENCV_INCLUDE_DIRS}
)

include_directories(/usr/local/MATLAB/R2014a/extern/include)

include_directories (SYSTEM
  ${catkin_INCLUDE_DIRS}
)

set (SOURCE
  src/test/main.cc
  src/test/rosbridge.cc
  src/test/core.cc
)

add_executable (test ${SOURCE})

target_link_libraries(test
  /lib/x86_64-linux-gnu/libssl.so.1.0.0
  /lib/x86_64-linux-gnu/libcrypt.so.1
  /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
  /usr/local/MATLAB/R2014a/bin/glnxa64/libmx.so
  /usr/local/MATLAB/R2014a/bin/glnxa64/libeng.so
  /usr/local/MATLAB/R2014a/bin/glnxa64/libmat.so
  /usr/local/MATLAB/R2014a/bin/glnxa64/libut.so
  ${OpenCV_LIBS}
  ${tracker_LIBRARIES}
  cvd
  ${catkin_LIBRARIES}
  ${TRIANGULATION_LIBRARIES}
)

Just linking cvd seems to not work in your case. CMake comes with the great find_package feature, though, so let's use it:

  1. Add find_package(CVD REQUIRED) at the top of the file
  2. Add ${CVD_INCLUDE_DIRS} to include_directories
  3. Replace cvd in target_link_libraries with ${CVD_LIBRARIES}

This may not work immediately but throw an error like "FindCVD.cmake not found". This is a script that searches your file system for the actual location of this library on your system and stores the paths to the variables used above. Many libraries already bring such an file themselves, but if this is not the case you have to provide it manually. In most cases you don't have to write this file yourself, though, as there is usually a bunch of open source projects, that already created such a file, which you can reuse (for example here ). Just google "FindCVD.cmake" to find them.

Once you have this file:

  1. Create a new subdirectory called "cmake" in your project and store the file there.
  2. Add set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) at the top of your CMakeLists.txt (before the find_package call!)

Now it should hopefully work :)

I fixed it!

You have to link against the libtiff lib in your lib folder like this:

target_link_libraries(test
  .
  .
  .
  /usr/lib/x86_64-linux-gnu/libtiff.so.5  
  .
  .
  .
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM