Ubuntu14.04一切正常,迁移到Ubuntu16.04后编译报错,提示:

/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed:YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
  EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);

vip@Alienware-15-R2:~/work/ORB_SLAM2$ ./build.sh
Configuring and building Thirdparty/DBoW2 ...
mkdir: 无法创建目录"build": 文件已存在
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/Thirdparty/DBoW2/build
[100%] Built target DBoW2
Configuring and building Thirdparty/g2o ...
mkdir: 无法创建目录"build": 文件已存在
-- BUILD TYPE:Release
-- Compiling on Unix
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/Thirdparty/g2o/build
[100%] Built target g2o
Uncompress vocabulary ...
Configuring and building ORB_SLAM2 ...
mkdir: 无法创建目录"build": 文件已存在
Build type: Release
-- Using flag -std=c++11.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/build
Scanning dependencies of target ORB_SLAM2
[ 3%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o
In file included from /usr/include/eigen3/Eigen/Core:297:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/include/eigen3/Eigen/Eigen:1,
from /usr/local/include/pangolin/gl/gl.h:40,
from /usr/local/include/pangolin/pangolin.h:38,
from /home/vip/work/ORB_SLAM2/include/MapDrawer.h:27,
from /home/vip/work/ORB_SLAM2/include/Viewer.h:26,
from /home/vip/work/ORB_SLAM2/include/Tracking.h:28,
from /home/vip/work/ORB_SLAM2/include/LocalMapping.h:27,
from /home/vip/work/ORB_SLAM2/include/LoopClosing.h:25,
from /home/vip/work/ORB_SLAM2/include/Optimizer.h:31,
from /home/vip/work/ORB_SLAM2/src/Optimizer.cc:21:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h: In instantiation of ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Matrix<int, -1, 1>; Src = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; Func = Eigen::internal::assign_op<int>]’:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:712:27: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename Eigen::internal::enable_if<(! Eigen::internal::evaluator_assume_aliasing<Src>::value), void*>::type) [with Dst = Eigen::Matrix<int, -1, 1>; Src = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; Func = Eigen::internal::assign_op<int>; typename Eigen::internal::enable_if<(! Eigen::internal::evaluator_assume_aliasing<Src>::value), void*>::type = void*]’
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:693:18: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Matrix<int, -1, 1>; Src = Eigen::Matrix<long int, -1, 1, 0, -1, 1>]’
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:682:32: required from ‘Derived& Eigen::PlainObjectBase<Derived>::_set(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; Derived = Eigen::Matrix<int, -1, 1>]’
/usr/include/eigen3/Eigen/src/Core/Matrix.h:225:24: required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; _Scalar = int; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1]’
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:367:17: required from ‘Eigen::PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>& Eigen::PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>::operator=(const Eigen::PermutationBase<OtherDerived>&) [with Other = Eigen::PermutationMatrix<-1, -1, long int>; int SizeAtCompileTime = -1; int MaxSizeAtCompileTime = -1; _StorageIndex = int]’
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:68:18: required from ‘void g2o::LinearSolverEigen<MatrixType>::CholeskyDecomposition::analyzePatternWithPermutation(g2o::LinearSolverEigen<MatrixType>::SparseMatrix&, const PermutationMatrix&) [with MatrixType = Eigen::Matrix<double, 7, 7, 0, 7, 7>; g2o::LinearSolverEigen<MatrixType>::SparseMatrix = Eigen::SparseMatrix<double, 0>; g2o::LinearSolverEigen<MatrixType>::PermutationMatrix = Eigen::PermutationMatrix<-1, -1, long int>]’
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:195:9: required from ‘void g2o::LinearSolverEigen<MatrixType>::computeSymbolicDecomposition(const g2o::SparseBlockMatrix<MatrixType>&) [with MatrixType = Eigen::Matrix<double, 7, 7, 0, 7, 7>]’
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:100:37: required from ‘bool g2o::LinearSolverEigen<MatrixType>::solve(const g2o::SparseBlockMatrix<MatrixType>&, double*, double*) [with MatrixType = Eigen::Matrix<double, 7, 7, 0, 7, 7>]’
/home/vip/work/ORB_SLAM2/src/Optimizer.cc:1244:1: required from here
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
^
CMakeFiles/ORB_SLAM2.dir/build.make:350: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

error log

 
问题原因:Eigen3的bug
解决方法:打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码
1 template <typename MatrixType>
2 class LinearSolverEigen: public LinearSolver<MatrixType>
3 {
4 public:
5 typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
6 typedef Eigen::Triplet<double> Triplet;
7 typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

改为

1 template <typename MatrixType>
2 class LinearSolverEigen: public LinearSolver<MatrixType>
3 {
4 public:
5 typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
6 typedef Eigen::Triplet<double> Triplet;
8 typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;
9 /**

ORB_SLAM2 Ubuntu16.04编译错误的更多相关文章

  1. Ubuntu16.04编译安装php

    #Ubuntu16.04编译安装php Ubuntu16.04上面搭建基于Nginx的php服务.Nginx使用apt直接安装的. sudo apt install nginx php的安装部署步骤主 ...

  2. Ubuntu16.04编译Android6.0/cm13.0教程及相关错误解决办法

    一.必备工作 1.安装依赖库 sudo apt--dev libesd0-dev git-core gnupg flex bison gperf build-essential zip curl zl ...

  3. ubuntu16.04编译安装mysql-boost-5.7.21并编译成php扩展测试与使用

    我之前的文章已经改造了自定义MVC框架中的工具类(验证码,图片上传,图像处理,分类)4个类,接下来,就要改造模型类,模型类肯定要连接数据库,由于我的Ubuntu Linux是裸装的php(目前只编译了 ...

  4. Ubuntu16.04编译安装tensorflow,2018最新血泪踩坑之后的全面总结!绝对成功!【转】

    本文转载自:https://blog.csdn.net/pzh11001/article/details/79683133 大家好,我是 (深度学习硬件DIY总群)(719577294)群主:    ...

  5. Ubuntu16.04编译tensorflow的C++接口

    原文:https://www.bearoom.xyz/2018/09/27/ubuntu1604buildtf4cpp/ 之前有一篇介绍到在windows下利用VS2015编译tensorflow的C ...

  6. Ubuntu16.04编译Openjdk8,笔者亲测编译成功

    现在很多语言都不开发运行环境了,都选择在JRE上运行,足以证明JVM的优越.你精通了JVM,未来的路才可能走得轻松.这篇文章是你走近jvm的第一篇,编译Openjdk8源码 编译环境 操作系统:Ubu ...

  7. Ubuntu16.04 编译 OpenJDK7

    <深入理解Java虚拟机>第二版第一章实践 准备 Mercurial sudo apt-get install mercurial OpenJDK7 hg clone http://hg. ...

  8. ubuntu16.04 编译出错:fatal error: SDL/SDL.h: No such file or directory

    在ubuntu 16.04编译神经网络代码时候,遇到了这样一种错误? fatal error: SDL/SDL.h: No such file or directory 原因是SDL库没有安装,根据你 ...

  9. ubuntu16.04编译QT5.6所依赖的库

    首先在QT的根目录下,阅读README文件! 里面介绍了ubuntu环境下,编译该版本的QT需要安装的包 New dependencies in Qt 5    ------------------- ...

随机推荐

  1. 开源协同办公平台部署教程:O2OA PAAS平台部署

    一.镜像制作1.将安装介质o2server-5.0.3-linux.zip上传至镜像制作服务器上.(上传目录为/paas/xxhpaas/moka/o2oa)2.使用unzip命令解压安装包,参考命令 ...

  2. 【模拟】报名签到 luogu-4445

    AC代码 #include <bits/stdc++.h> using namespace std; #define ms(a,b) memset(a,b,sizeof(a)) typed ...

  3. ODOO14 ---系统启动方式

    一.通过pycharm启动 1.配置启动面板: 点击启动即可: 第二种.通过CMD窗口启动:进入到odoo-bin的目录下,执行:python E:\odoo14\odoo14\odoo-bin  这 ...

  4. 第一篇 -- Jmeter的安装下载

    参考链接:https://blog.csdn.net/wust_lh/article/details/86095924 本篇介绍的是在Windows下安装Jmeter. 一.下载Jmeter 官网下载 ...

  5. (python函数03)zip()函数

    (python函数03)zip()函数 zip是用来压缩的,它接受一系列可迭代的对象作为参数,将对象中对应的元素打包成一个个元组(tuple),然后返回有这些tuples组成的对象,可强制转化为列表和 ...

  6. Pytorch指定GPU的方法总结

    Pytorch指定GPU的方法 改变系统变量 改变系统环境变量仅使目标显卡,编辑 .bashrc文件,添加系统变量 export CUDA_VISIBLE_DEVICES=0 #这里是要使用的GPU编 ...

  7. 大数据学习(20)—— Zookeeper介绍

    ZooKeeper是什么 就像相声大师冯巩每次出场都说:"亲爱的观众朋友们,我想死你们啦"一样,我再强调一次,学习大数据官网很重要.Zookeeper官网看这里ZooKeeper ...

  8. 2021陕西省大学生网络安全技能大赛 Web ez_checkin

    web ez_checkin 进去看了一会,啥也没找到,直接上dirsearch 扫到一个index.php~,打开看一看,是php审计 <?php error_reporting(0); in ...

  9. 自学linux——15.云主机的购买流程及域名的购买备案解析

    项目上线流程 一.服务器选配购买 项目上线的服务器必须是外网服务器 1.服务器购买情况 真实服务器(成本过高,购买内部自用) 云服务器(上线首选):阿里云,腾讯云,华为云 2.购买阿里云服务器:htt ...

  10. 用VirtualBox搭建虚拟局域网

    用 Oracle VM VirtualBox 安装虚拟机,我在Windows 7上安装了ubuntu 11.10和xubuntu12.04两个虚拟机: 将这两个虚拟机的"网络"属性 ...