我正在尝试使用外部库构建项目,但系统一直认为它需要使用损坏的 usr/lib 中的库。我希望改用地址中构建的库:/home/CMake-hdf5-1.8.18/build/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/include。这是 CMakeLists.txt。我想要的解决方案是 #Add hdf5 库下的两行。
cmake_minimum_required(VERSION 2.8.3)
project(scan_to_cloud_converter)
# List C++ dependencies on ros packages
set( ROS_CXX_DEPENDENCIES
roscpp
pcl_ros
pcl_conversions)
# Find catkin and all required ROS components
find_package(catkin REQUIRED COMPONENTS ${ROS_CXX_DEPENDENCIES})
find_package(PCL REQUIRED QUIET)
# Set include directories
include_directories(include ${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})
# Declare info that other packages need to import library generated here
catkin_package( )
#Create node
add_executable( scan_to_cloud_converter_node
src/scan_to_cloud_converter_node.cpp
src/scan_to_cloud_converter.cpp )
#Add hdf5 library
link_directories(/home/CMake-hdf5-1.8.18/build/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/include)
target_link_libraries(scan_to_cloud_converter_node libhdf5)
# No need to link against pcl (using header only libraries)
target_link_libraries( scan_to_cloud_converter_node ${catkin_LIBRARIES})
add_dependencies(scan_to_cloud_converter_node ${catkin_EXPORTED_TARGETS})
#Install node
install(TARGETS scan_to_cloud_converter_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )
这是我仍然收到的错误消息:
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so', needed by '/home/catkin_ws/devel/lib/scan_to_cloud_converter/scan_to_cloud_converter_node'. Stop.
我已经对此错误进行了研究,这是因为它仍在查看 /usr/lib,并且没有库 libhdf5.so,因为符号链接已损坏。那么如何让它查看该库的另一个地址呢?任何帮助消除此错误将不胜感激