Eigen:此编译器似乎太旧,无法被 Eigen、Linux c++14 支持

问题描述 投票:0回答:0

我正在尝试构建一个大型项目(Amino),它依赖于开放运动规划库和 Eigen。它是用

makefile.am
构建的,并在运行
autoreconf
./configure
后创建一个 makefile。运行
make
会导致大约 20000 行错误,从几行“In file include from”之后开始:

/usr/local/include/eigen3/Eigen/src/Core/util/Macros.h:711:2: error: #error This compiler appears to be too old to be supported by Eigen

我的期望:

make
成功运行完成 我看到的是:很多错误。所有这些似乎都与读取/编译 Eigen 失败直接相关,并且与库无关。

我尝试解决问题的方法(均未解决/导致相同的错误):

(1) 将

/usr/lib/x86_64-linux-gnu/pkgconfig/ompl.pc
中的最后一行更改为:

Cflags: -std=c++14 -I${includedir} -I/usr/include
到:
Cflags: -std=c++14 -I${includedir} -I/usr/include/eigen3

按照 http://amino.golems.org/installation.html 上的说明

(2) 将 cflags 更改为 -std=c++11(导致

./configure
步骤出现错误)和
-std=c++17
(与默认错误相同)

(3) 完全删除

-std=
参数以完全符合上述说明

(4) 从源代码安装 Eigen 与 apt 存储库安装

(5) 检查我的编译器和 Eigen 版本,看看是否有特别旧或特别新的版本(它们不是)

更新

(6) 更改文件中的以下行

configure
:

for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA

for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++14 -std=c++0x -qlanglvl=extended0x -AA

这个想法是,这将确保编译是使用 c++14 而不是 c++11 完成的。也没有成功。

(7) 进一步更改该行以删除

-std=c++0x
部分,以防覆盖之前的
-std
参数。没有效果。

还有一些与此问题类似的其他答案,最值得注意的是 this 问题讨论了相同的错误,但它们都假设使用 CMake。

系统信息:

操作系统:Ubuntu 22.04.2 LTS x86_64

Eigen 版本:libeigen3-dev (3.3.7-2),从 apt 存储库安装

编译器:g++,使用

gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)

更新:根据问题1,

Eigen/src/Core/util/Macros.h
中的第711行如下:

// The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features
// but in practice we should not rely on them but rather on the availability of
// individual features as defined later.
// This is why there is no EIGEN_HAS_CXX17.
#if EIGEN_MAX_CPP_VER < 14 || EIGEN_COMP_CXXVER < 14 || \
  (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
  (EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || \
  (EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
  (EIGEN_COMP_CLANG_STRICT && EIGEN_COMP_CLANG < 390) || \
  (EIGEN_COMP_CLANGAPPLE && EIGEN_COMP_CLANGAPPLE < 9000000) || \
  (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 510)
#error This compiler appears to be too old to be supported by Eigen
#endif

根据问题 2,带有

V=1
的 make 命令输出以下内容:

/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -I./include -I./include -I./src/mac  -std=c++11 -I/usr/local/include -I/usr/local/include/eigen3 -Wwrite-strings -Wshadow -Wfloat-equal -Wpointer-arith -Wconversion -Wextra  -g -O2 -MT src/rx/libamino_collision_la-amino_fcl.lo -MD -MP -MF src/rx/.deps/libamino_collision_la-amino_fcl.Tpo -c -o src/rx/libamino_collision_la-amino_fcl.lo `test -f 'src/rx/amino_fcl.cpp' || echo './'`src/rx/amino_fcl.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./include -I./include -I./src/mac -std=c++11 -I/usr/local/include -I/usr/local/include/eigen3 -Wwrite-strings -Wshadow -Wfloat-equal -Wpointer-arith -Wconversion -Wextra -g -O2 -MT src/rx/libamino_collision_la-amino_fcl.lo -MD -MP -MF src/rx/.deps/libamino_collision_la-amino_fcl.Tpo -c src/rx/amino_fcl.cpp  -fPIC -DPIC -o src/rx/.libs/libamino_collision_la-amino_fcl.o
In file included from /usr/local/include/eigen3/Eigen/Core:19,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from /usr/include/fcl/common/types.h:46,
                 from /usr/include/fcl/math/bv/AABB.h:41,
                 from /usr/include/fcl/geometry/collision_geometry.h:43,
                 from /usr/include/fcl/narrowphase/collision_object.h:43,
                 from /usr/include/fcl/broadphase/broadphase_collision_manager.h:44,
                 from /usr/include/fcl/broadphase/broadphase_SSaP.h:42,
                 from /usr/include/fcl/fcl.h:45,
                 from src/rx/amino_fcl.cpp:53:
/usr/local/include/eigen3/Eigen/src/Core/util/Macros.h:711:2: error: #error This compiler appears to be too old to be supported by Eigen
  711 | #error This compiler appears to be too old to be supported by Eigen

下面有人建议标准可能会降低到 C++11,上面的命令证实了这一点。

makefile compiler-errors compilation eigen eigen3
© www.soinside.com 2019 - 2024. All rights reserved.