当前位置:网站首页>ROS compilation calls the third-party dynamic library (xxx.so)
ROS compilation calls the third-party dynamic library (xxx.so)
2022-07-06 08:35:00 【Will_ Ye】
1. Problem
In the process of doing the project , Inevitable , Sometimes you need to use some third-party open source libraries , Or write your own dynamic library , Then you need to CMakeLists Add the path corresponding to these dynamic libraries , Compile .
The suffix of the dynamic library that needs to be called is generally .so, Sometimes I will encounter something except libxxx.so, also libxxx.so.x and libxxx.so.x.y.z these , Such as libzzz.so, also libzzz.so.1 and libzzz.so.1.0.0
In the suffix .so These figures after , In fact, it represents different versions , Used for version management , So the file name of the whole dynamic library is exquisite . such as libzzz.so.1.2.3,lib It is a fixed representative shared library ,zzz Is the shared library name ,.so Is a fixed suffix ,1 Indicates the major version number ,2 Indicates the minor version number ,3 Indicates the release version number .
The major version number : Incompatibility between different version numbers
Sub version number : Incremental upgrade , Backward compatibility
Release number : Error correction and performance improvement corresponding to the next version , Does not affect compatibility
And the longest name libxxx.so.x.y.z, Is the actual library file , It contains executable binary code . So you can use instructions readelf -d libzzz.so.1.2.3 Read this file .
In fact, when generating the Library , You can also directly generate only one libzzz.so As the actual library file , It depends on the individual , The standard point is that we should do a good job in library version management .
2. Method
stay ROS Of package in , Generally, two folders are created (include and lib), Deposit .h The header file and .so Dynamic library files , therefore , We just put the third-party dynamic library files into lib In the folder , Don't forget to put the relevant libxxx.so.x and libxxx.so.x.y.z Also put it in , No one can do without .

After the dynamic library file is placed , Revise it CMakeList That's all right.
cmake_minimum_required(VERSION 2.8.3)
SET(CMAKE_BUILD_TYPE Debug)
add_compile_options( -std=c++11)
project(gazebo_mobile_manipulator)
find_package(PCL 1.8 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED COMPONENTS
nav_msgs
roscpp
rospy
serial
tf
std_msgs
std_srvs
actionlib
actionlib_msgs
message_generation
geometry_msgs
pcl_conversions
pcl_ros
PCL
)
catkin_package(
CATKIN_DEPENDS roscpp rospy serial std_msgs message_runtime
INCLUDE_DIRS include
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
link_directories(
${catkin_LIB_DIRS} lib
)
add_executable(test src/test1.cpp)
target_link_libraries(test ${PCL_LIBRARIES} ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} libzzz.so)
Pay attention to the last line , stay target_link_libraries Inside , Just add libzzz.so That's all right. , There is no need to add the version number that follows , adopt .so This will search for others .
then catkin_make Just compile it
边栏推荐
- MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
- sublime text中conda环境中plt.show无法弹出显示图片的问题
- Roguelike游戏成破解重灾区,如何破局?
- Deep analysis of C language data storage in memory
- 2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
- Is it safe to open an account in Zheshang futures?
- pytorch训练好的模型在加载和保存过程中的问题
- Permutation and combination function
- Mobile Test Engineer occupation yyds dry goods inventory
- LDAP application (4) Jenkins access
猜你喜欢

深度剖析C语言指针

2022.02.13 - NC004. Print number of loops

个人电脑好用必备软件(使用过)

C language double pointer -- classic question type

pytorch训练好的模型在加载和保存过程中的问题

Trying to use is on a network resource that is unavailable

Fibonacci sequence

Screenshot in win10 system, win+prtsc save location

On the day of resignation, jd.com deleted the database and ran away, and the programmer was sentenced

Ruffian Heng embedded bimonthly, issue 49
随机推荐
Golang force buckle leetcode 1020 Number of enclaves
JVM 快速入门
IoT -- 解读物联网四层架构
vulnhub hackme: 1
[2022 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
Browser thread
Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development
Research and investment forecast report of citronellol industry in China (2022 Edition)
Screenshot in win10 system, win+prtsc save location
VMware 虚拟化集群
tree树的精准查询
堆排序详解
角色动画(Character Animation)的现状与趋势
深度剖析C语言指针
ROS编译 调用第三方动态库(xxx.so)
企微服务商平台收费接口对接教程
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
Modify the video name from the name mapping relationship in the table
leetcode刷题 (5.29) 哈希表
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台