ROS 的 libtiff4 错误
libtiff4 error with ROS
我正在尝试在 Ubuntu 14.04 下从一位使用柔荑花的朋友那里编译一个 ROS 包,但出现以下错误:
/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
我安装了 libcvd 和 libtiff4-dev。有人知道如何解决这个问题吗?
非常感谢,
雪
编辑:按照建议我包括 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}
)
仅链接 cvd
似乎不适用于您的情况。
不过,CMake 具有出色的 find_package
功能,所以让我们使用它:
- 在文件顶部添加
find_package(CVD REQUIRED)
- 将
${CVD_INCLUDE_DIRS}
添加到 include_directories
- 将
target_link_libraries
中的cvd
替换为${CVD_LIBRARIES}
这可能不会立即起作用,但会抛出类似 "FindCVD.cmake not found" 的错误。这是一个脚本,用于在您的文件系统中搜索该库在您系统上的实际位置,并存储上述变量的路径。许多图书馆已经自带了这样的文件,但如果不是这种情况,您必须手动提供。不过,在大多数情况下,您不必自己编写此文件,因为通常有许多开源项目已经创建了这样一个文件,您可以重复使用该文件(例如 here)。只需 google "FindCVD.cmake" 即可找到它们。
获得此文件后:
- 在您的项目中创建一个名为 "cmake" 的新子目录,并将文件存储在那里。
- 在
CMakeLists.txt
的顶部添加 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
(在 find_package
调用之前!)
现在它应该可以工作了:)
我修好了!
您必须 link 像这样对您的 lib 文件夹中的 libtiff 库进行操作:
target_link_libraries(test
.
.
.
/usr/lib/x86_64-linux-gnu/libtiff.so.5
.
.
.
)
我正在尝试在 Ubuntu 14.04 下从一位使用柔荑花的朋友那里编译一个 ROS 包,但出现以下错误:
/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
我安装了 libcvd 和 libtiff4-dev。有人知道如何解决这个问题吗?
非常感谢,
雪
编辑:按照建议我包括 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}
)
仅链接 cvd
似乎不适用于您的情况。
不过,CMake 具有出色的 find_package
功能,所以让我们使用它:
- 在文件顶部添加
find_package(CVD REQUIRED)
- 将
${CVD_INCLUDE_DIRS}
添加到include_directories
- 将
target_link_libraries
中的cvd
替换为${CVD_LIBRARIES}
这可能不会立即起作用,但会抛出类似 "FindCVD.cmake not found" 的错误。这是一个脚本,用于在您的文件系统中搜索该库在您系统上的实际位置,并存储上述变量的路径。许多图书馆已经自带了这样的文件,但如果不是这种情况,您必须手动提供。不过,在大多数情况下,您不必自己编写此文件,因为通常有许多开源项目已经创建了这样一个文件,您可以重复使用该文件(例如 here)。只需 google "FindCVD.cmake" 即可找到它们。
获得此文件后:
- 在您的项目中创建一个名为 "cmake" 的新子目录,并将文件存储在那里。
- 在
CMakeLists.txt
的顶部添加set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
(在find_package
调用之前!)
现在它应该可以工作了:)
我修好了!
您必须 link 像这样对您的 lib 文件夹中的 libtiff 库进行操作:
target_link_libraries(test
.
.
.
/usr/lib/x86_64-linux-gnu/libtiff.so.5
.
.
.
)