Cyber环境搭建非docker环境(其中包括fastCDR,protobuf,fastrtps安装包)

1.替换阿里源
2.安装cmake3.12
2.1 卸载已经安装的旧版的CMAKE

sudo apt-get autoremove cmake

2.2 文件下载解压

wget https://cmake.org/files/v3.12/cmake-3.12.2-Linux-x86_64.tar.gz
tar zxvf cmake-3.12.2-Linux-x86_64.tar.gz 

2.3 安装cmake

#修改文件夹名字为cmake
sudo cp -r ~/software/cmake /usr/local  #第一个路径根据自己电脑路径修改
vi ~/.bashrc
#在最后添加export PATH=/usr/local/cmake/bin:$PATH
source ~/.bashrc
cmake --version   #查看版本 是否安装成功

3.安装tinyxml2
3.1 下载tinyxml2

git clone https://github.com/leethomason/tinyxml2.git

3.2 进入相应目录并编译
文件路径

cd tinyxml2 
make

3.3 测试版本的准确性(Fail=0为正确)

./xmltest

3.4 安装

sudo make install

4.安装eigen3

sudo apt-get install libeigen3-dev

5.安装fastCDR
https://download.csdn.net/download/qq_35066464/12689294

#先解压
cd Fast-CDR/build  #如果没有build这个文件夹 就自己创建一个
cmake ..
cmake --build . --target install
#如果没有权限可能会报以下错误
#-- Install configuration: "Release"
#CMake Error at cmake_install.cmake:41 (file):
#file cannot create directory: /usr/local/share/fastcdr.  Maybe need
# administrative privileges.
#则继续执行
sudo make install

6.安装protobuf
protobuf3.5.1下载地址
https://download.csdn.net/download/qq_35066464/12689304
安装建议 有anaconda环境的 先退出base环境 不然安装好后 使用which protoc // 查看可执行文件路径 时 路径会出现在anaconda里面 而不是/usr/local/bin 里面
6.1

#先解压
sudo apt-get install autoconf automake libtool curl make g++ unzip #必要的辅助安装包
unzip protobuf-3.5.1.1.zip # 可以直接git下载
cd protobuf-3.5.1.1
git submodule update --init --recursive # 如果该代码不能执行,先执行 git init
#当执行./autogen.sh时出现   Google Mock not present.  Fetching gmock-1.7.0 from the web...
#并且一直没反应时 进入6.2  然后再次执行./autogen.sh

当从git上直接clone protobuf时

git clone https://github.com/protocolbuffers/protobuf.git
git clone -b v3.6.1 https://github.com/protocolbuffers/protobuf.git
#两种版本任选其一

此时版本较高 需要用到gmock (即出现了Google Mock not present. Fetching gmock-1.7.0 from the web…报错)
低版本 如3.5 3.6时 直接快进到6.3步骤

6.2 下载gmock
1、下载并解压gmock
https://github.com/paulsapps/gmock-1.7.0
下载之后解压

2、把gmock解压出来的目录拷贝到protobuf目录下,改名为gmock

3、vim aotogen.sh将如下代码注释 或者直接使用文本编辑器打开进行注释
(注释与以下代码最相似的一段)

if test ! -e gmock; then
echo “Google Mock not present. Fetching gmock-1.7.0 from the web…”
curl -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
unzip -q gmock-1.7.0.zip
rm gmock-1.7.0.zip
mv gmock-1.7.0 gmock
fi
在这里插入图片描述

6.3.运行代码

./autogen.sh
./configure
make
make check
sudo make install
#运行时间需要几分钟  耐心等待

如果使用低版本 则到此为止安装成功
如果使用高版本 则继续

打开 /etc/ld.so.conf.d/libprotobuf.conf 文件
将以下路径写入其中

/usr/local/lib 

如果没有该文件可以自己创建
代码如下
在这里插入图片描述

cd /etc/ld.so.conf.d
sudo touch libprotobuf.conf
sudo vim libprotobuf.conf

进入protobuf文档路径后,最后再运行以下代码

sudo ldconfig #无论版本高低都有执行
protoc --version #查看版号

如果需要卸载重装protobuf 见
protobuf卸载教程

如果有需要其他版本protobuf 自行查找资料
7.安装fastrtps
fastrtps下载地址
https://download.csdn.net/download/qq_35066464/12689296
1.安装依赖库

sudo apt-get install libasio-dev libtinyxml2-dev
sudo apt install libssl-dev

2.修改cmakelists.txt文件
在这里插入图片描述
使用查找功能找到
add_subdirectory(examples)
并注释掉

3.编译
进入fastrtps文件运行

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON .
make

4.安装

sudo make install

8.安装cyber
apollo cyber下载地址
https://download.csdn.net/download/qq_35066464/12689285
解压之后 进入文件 创建一个build文件夹

cd build
camke ..
make
sudo make install
source /usr/local/bin/cyber/setup.bash

全部安装完成

参考文章
安装protobuf遇到的问题

ubuntu安装protobuf

protobuf指定版本安装

如有侵权,请联系博主删除

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值