一、安装双系统Windows+Ubuntu22.04
1.安装教程:Windows+Ubuntu20.04双系统安装教程 - 知乎 (zhihu.com)
2.遇到的问题:
(1)制作启动U盘
ISO镜像文件应保存在电脑端,不能保存在U盘。U盘在写入硬盘映像时会格式化。
(2)为Ubuntu分配磁盘空间及创建分区
分配磁盘空间:在系统盘(C盘)分出300M-500M的空间用于Ubuntu的/boot分区来作为启动引导文件,否则无法启动Ubuntu。非系统盘分出合适空间用于存放Ubuntu系统文件和用户文件
安装ubuntu时创建分区:
- 1./swap交换分区(虚拟内存),逻辑分区, 8G及以下RAM选择两倍大小,以上跟RAM大小一样
- 2./boot分区 ,逻辑分区,默认ext4。空间配置为系统盘分出的空间,放置Ubuntu的启动引导文件。
- 3./ 根分区(root分区),逻辑分区,默认ext4,20G
- 4./home分区,主分区,默认ext4,余下所有空间。
二、安装GTSAM并配置MATLAB-toolbox
1.在CMakeList.txt中找不到使能MATLAB-toolbox编译的代码:
解决:下载的GTSAM版本不支持,下载GTSAM4.0.3Release版本源码
git clone https://bitbucket.org/gtborg/gtsam.git
2.在编译GTSAM源码过程中出现的问题
①报错信息:
CMake Error at cmake/FindTBB.cmake:187 (file):
file failed to open for reading (No such file or directory):
/usr/include/tbb/tbb_stddef.h
Call Stack (most recent call first):
CMakeLists.txt:210 (find_package)
解决:在MakeList.txt中注释find_package(TBB COMPONENTS tbb tbbmalloc)
②报错信息
'library_version_type’ in namespace ‘boost::serialization’ does not name a type; did you mean ‘item_version_type’?
解决:boost版本问题,重新安装合适版本boost 在Ubuntu上安装Boost的五种方法(全网最全,建议收藏)_ubuntu安装boost_小熊coder的博客-CSDN博客
③报错信息:
fatal error: mex.h: 没有那个文件或目录
32 | #include <mex.h>
| ^~~~~~~1.
compilation terminated.
解决:将matlab matlab/extern/include/路径下的 中mex.h matrix.h tmwtypes.h复制到gtsam下
④报错信息:
error: invalid initialization of reference of type ‘const std::vector<bool>&’ from expression of type ‘const std::vector<long unsigned int, std::allocator<long unsigned int> >’
解决:对照新版本的GTSAM源码将‘const std::vector<bool>&’更改为‘const std::vector<size_t>&’
三、MATLAB配置
①报错信息:
MATLAB运行出现警告:
MATLAB 遇到了低级的图形错误,可能绘制不正确。
解决:在 MATLAB 命令提示符处键入 opengl('save','software')。然后,重新启动 MATLAB
②报错信息
MEX 文件 lsd.mexw64'无效: 找不到指定的模块。
解决:用最高权限运行MATLAB
③报错信息
gtsam_wrapper.mexa64: undefined symbol:_ZNK5gtsam16NoiseModelFactor5printERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN5boost8functionIFS6_mEEE
解决:重新install编译后的GTSAM文件
四、配置完成: