安装Sophus前要先安装:eigen、fmt才可以装Sophus。
这边安装的是模板类的。
一、安装eigen
eigen是代数库,一定要安装3.3以上,不可以直接用sudo apt-get install libeigen3-dev这个代码,下来也用不了。
1.先卸载老版本
可以先检查有没有老版本,代码为:
sudo updatedb
locate eigen3
有的话用sudo rm -rf 把locate的地址都清了,最后再重复上面代码,应该都没有了。
2.安装新版本
进入官网下载eigen3.4-rc1
下载完后
wget https://gitlab.com/libeigen/eigen/-/archive/3.4-rc1/eigen-3.4-rc1.zip
unzip eigen-3.4-rc1.zip
cd eigen-3.4-rc1
mkdir build
cd build
cmake ..
sudo make install
至此,eigen安装完成。
二、安装fmt
在github直接搜fmt,克隆下载
git clone https://github.com/fmtlib/fmt.git
cd fmt
mkdir build
cd build
cmake ..
make
sudo make install
三、安装Sophus
一开始我直接在github搜Sophus,下载了报错为:
static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
接着参照Sophus库安装踩坑(SLAM十四讲)_白色小靴的博客-CSDN博客_安装sophus
还是报错static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
应该是fmt不匹配,要改fmt版本或者Sophus版本,根据搜索,有大佬回答说fmt下载了右边release版本的fmt-8.1.1.zip重新安装fmt再编译安装Sophus就没有这个问题了。但是我没找到。我安装了Sophus的v1.0.0版本,重新编译就可以了。
wget https://github.com/strasdat/Sophus/archive/refs/tags/v1.0.0.zip
unzip V1.0.0.zip
cd Sophus-1.0.0
mkdir build
cd build
cmake ..
make
sudo make install
一定要sudo make install,不然以后用的时候会有路径问题!
我下了好几次才连上这个github链接,大家有点耐心。
没有报错的话,到这里,就安装完毕了,经检验,可以使用。