Fast-DDS源码编译安装

编译环境:ubuntu 20.04
Fast-DDS官网地址:https://fast-dds.docs.eprosima.com/en/latest/
github地址:https://github.com/eProsima

根据官网安装说明进行安装:


图片.png

Fast-DDS 安装分为三部分:foonathan_memory_vendor, fastcdr,fastrtps

图片.png

1.安装 cmake g++ python3-pip wget git

sudo apt install cmake g++ python3-pip wget git

  1. 安装 libasio-dev libtinyxml2-dev
    sudo apt install libasio-dev libtinyxml2-dev
  2. 安装 libssl-dev
    sudo apt install libssl-dev
  3. 安装 libp11-dev libengine-pkcs11-openssl 和softhsm2 (此步骤可选)
    sudo apt install libp11-dev libengine-pkcs11-openssl
    sudo apt install softhsm2

softhsm2包创建了一个名为softhsm的新组。需要将当前用户添加到这个组中,才能获取访问权
sudo usermod -a -G softhsm

sudo apt install libengine-pkcs11-openssl

检查p11kit是否能够找到使用的SoftHSM模块

p11-kit list-modules

检查OpenSSL是否能够访问PKCS#11使用:
openssl engine pkcs11 -t

  1. 安装Gtest, 单元测试时需要,(可选)
    git clone https://github.com/google/googletest src/googletest-distribution

6.选择cmake方式安装,本地安装
mkdir ~/Fast-DDS
foonathan_memory_vendor 安装

cd ~/Fast-DDS
git clone https://github.com/eProsima/foonathan_memory_vendor.git
mkdir foonathan_memory_vendor/build
cd foonathan_memory_vendor/build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ON
cmake --build . --target install

Fast-CDR 安装

cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-CDR.git
mkdir Fast-CDR/build
cd Fast-CDR/build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
cmake --build . --target install

Fast-DDS 安装

cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-DDS.git
mkdir Fast-DDS/build
cd Fast-DDS/build
cmake ..  -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
cmake --build . --target install

7.全局安装
将本地安装路径修改为 /usr/local/ :
foonathan_memory_vendor: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
Fast-CDR: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/
Fast-DDS: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/
用sudo 安装: sudo cmake --build . --target install

  1. 运行Fast DDS,需要配置环境变量
    临时配置:export LD_LIBRARY_PATH=/usr/local/lib/
    永久配置:echo 'export LD_LIBRARY_PATH=/usr/local/lib/' >> ~/.bashrc

你可能感兴趣的:(Fast-DDS源码编译安装)