当前位置:网站首页>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
边栏推荐
- Is it safe to open an account in Zheshang futures?
- Trying to use is on a network resource that is unavailable
- Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
- Screenshot in win10 system, win+prtsc save location
- 查看局域网中电脑设备
- Research and investment forecast report of citronellol industry in China (2022 Edition)
- Generator parameters incoming parameters
- String to leading 0
- 同一局域网的手机和电脑相互访问,IIS设置
- Introduction to the differences between compiler options of GCC dynamic library FPIC and FPIC
猜你喜欢
Bottom up - physical layer
PC easy to use essential software (used)
The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
Deep analysis of C language pointer
【ROS】usb_cam相机标定
Leetcode question brushing (5.28) hash table
CISP-PTE实操练习讲解
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
Verrouillage [MySQL]
egg. JS project deployment online server
随机推荐
Image,cv2读取图片的numpy数组的转换和尺寸resize变化
LDAP應用篇(4)Jenkins接入
Fibonacci sequence
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
egg. JS directory structure
【MySQL】日志
LDAP Application Section (4) Jenkins Access
sys.argv
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
torch建立的网络模型使用torchviz显示
egg. JS getting started navigation: installation, use and learning
Chrome浏览器的crash问题
Colorlog结合logging打印有颜色的日志
Sublime text using ctrl+b to run another program without closing other runs
Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)
leetcode刷题 (5.29) 哈希表
How to conduct interface test? What are the precautions? Nanny level interpretation
堆排序详解
2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
Char to leading 0