1.下载fastdds
git clone https://github.com/eProsima/Fast-DDS.git
cd Fast-DDS
下载完后出现目录Fast-DDS,cd进入Fast-DDS目录,然后切换到2.14.1的分支,master分支编译失败
git checkout remotes/origin/2.14.1
git branch -a
2.下载子模块
git submodule update --init --recursive
3.下载、编译memory
git clone https://github.com/foonathan/memory
mkdir memory/build
cd memory/build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ON
cmake --build . --target install
或make install
4.下载、编译fastcdr
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
5.boost库编译
wget boost_1_83_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.gz/download
tar -zxvf boost_1_83_0.tar.gz
cd boost_1_83_0
./bootstrap.sh --prefix=/home/dds/Fast-DDS/install
./b2 -j32
./b2 install
6.asio编译
cd Fast-DDS/thirdparty/asio/asio/
sudo apt install autoconf
./autogen.sh
./configure --with-boost=/home/dds/Fast-DDS/install/include
make -j32
sudo make install
7.fastdds编译
mkdir Fast-DDS/build
cd Fast-DDS/build
cmake .. -DCMAKE_INSTALL_PREFIX=/home/dds/Fast-DDS/install
make -j32
make install
8.编译测试程序
cd ~/Fast-DDS/Fast-DDS/examples/cpp/dds/HelloWorldExample
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/dds/Fast-DDS/install
make
9.设置环境变量
vim ~/.bashrc
export LD_LIBRARY_PATH=/home/farben/Fast-DDS/install/lib
source ~/.bashrc
10.运行测试程序
./DDSHelloWorldExample publisher
./DDSHelloWorldExample subscriber