flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.35k stars 415 forks source link

Make error (no match for ‘operator[]’, remove_const_t is not a member of std, compiler too old) #604

Open Hartvi opened 11 months ago

Hartvi commented 11 months ago

I'm sorry if an issue for this exists, but I haven't been able to find it. Also I haven't worked with libraries in C++ that much, sorry if this seems trivial. I have installed eigen3 and libccd and now I want to install fcl.

These are the commands I used:

git clone git@gitlab.com:libeigen/eigen.git cd eigen mkdir build cd build cmake .. sudo make install cd ../.. git clone git@github.com:danfis/libccd.git cd libccd/src make sudo make install cd ../.. git clone git@github.com:flexible-collision-library/fcl.git cd fcl mkdir build cd build cmake .. make >out.txt 2>&1

The compiler throws an error in the make step.

I have gcc9, which means it should support C++14, which eigen seems to need.

gcc --version

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.../fcl/build$ cmake ..

-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Set RPATH explicitly to '/usr/local/lib'
-- Performing Test _compiler_supports_sse
-- Performing Test _compiler_supports_sse - Success
-- Checking for one of the modules 'ccd;libccd'
-- Checking for module 'octomap'
--   No package 'octomap' found
-- FCL does not use OctoMap
-- Performing Test COMPILER_SUPPORTS_VISIBILITY
-- Performing Test COMPILER_SUPPORTS_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- The C compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hartvi/Documents/CVUT/diploma_thesis/fcl/build

And in the make step it says this:

make >out.txt 2>&1

[  0%] Building CXX object src/CMakeFiles/fcl.dir/broadphase/broadphase_SSaP.cpp.o
In file included from /usr/local/include/eigen3/Eigen/Core:19,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/common/types.h:46,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/math/bv/AABB.h:41,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/geometry/collision_geometry.h:43,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/narrowphase/collision_object.h:43,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_collision_manager.h:44,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_SSaP.h:42,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_SSaP-inl.h:41,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/src/broadphase/broadphase_SSaP.cpp:38:
/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
      |  ^~~~~
In file included from /usr/local/include/eigen3/Eigen/Core:169,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/common/types.h:46,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/math/bv/AABB.h:41,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/geometry/collision_geometry.h:43,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/narrowphase/collision_object.h:43,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_collision_manager.h:44,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_SSaP.h:42,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/include/fcl/broadphase/broadphase_SSaP-inl.h:41,
                 from /home/hartvi/Documents/CVUT/diploma_thesis/fcl/src/broadphase/broadphase_SSaP.cpp:38:
/usr/local/include/eigen3/Eigen/src/Core/util/Meta.h:143:37: error: ‘remove_const_t’ is not a member of ‘std’; did you mean ‘remove_const’?
  143 | struct is_void : is_same<void, std::remove_const_t<T>> {};
      |                                     ^~~~~~~~~~~~~~
      |                                     remove_const
/usr/local/include/eigen3/Eigen/src/Core/util/Meta.h:143:37: error: ‘remove_const_t’ is not a member of ‘std’; did you mean ‘remove_const’?
  143 | struct is_void : is_same<void, std::remove_const_t<T>> {};
      |                                     ^~~~~~~~~~~~~~
      |                                     remove_const

and so on for 10000 lines.

velecto1 commented 10 months ago

Hi,

I think there is some incompatibility with the newest Eigen. Try it with Eigen 3.3.7.

But if you find another solution, please tell me! (I have to use Eigen 3.4 anyway.)

velecto1 commented 10 months ago

I have tweaked the Meta.h header of Eigen to show the value of the __cplusplus macro. Indeed, it is 201103L, meaning the C++11 standard.

So why does it think (or why is it being complied) with C++11???

Consolidate compiler generated dependencies of target fcl
[  0%] Building CXX object src/CMakeFiles/fcl.dir/broadphase/broadphase_SSaP.cpp.o
In file included from /home/tomtom/git/eigen-git/eigen/Eigen/Core:19,
                 from /home/tomtom/git/eigen-git/eigen/Eigen/Dense:1,
                 from /home/tomtom/Downloads/fcl/include/fcl/common/types.h:46,
                 from /home/tomtom/Downloads/fcl/include/fcl/math/bv/AABB.h:41,
                 from /home/tomtom/Downloads/fcl/include/fcl/geometry/collision_geometry.h:43,
                 from /home/tomtom/Downloads/fcl/include/fcl/narrowphase/collision_object.h:43,
                 from /home/tomtom/Downloads/fcl/include/fcl/broadphase/broadphase_collision_manager.h:44,
                 from /home/tomtom/Downloads/fcl/include/fcl/broadphase/broadphase_SSaP.h:42,
                 from /home/tomtom/Downloads/fcl/include/fcl/broadphase/broadphase_SSaP-inl.h:41,
                 from /home/tomtom/Downloads/fcl/src/broadphase/broadphase_SSaP.cpp:38:
/home/tomtom/git/eigen-git/eigen/Eigen/src/Core/util/Macros.h:718:2: error: #error This compiler appears to be too old to be supported by Eigen
  718 | #error This compiler appears to be too old to be supported by Eigen
      |  ^~~~~
/home/tomtom/git/eigen-git/eigen/Eigen/src/Core/util/Macros.h:679:46: note: ‘#pragma message: The value of __cplusplus: 201103L’
  679 | #pragma message "The value of __cplusplus: " XSTR(__cplusplus)
      |                                              ^~~~
velecto1 commented 10 months ago

Got it!

One line of the CMake-generated file fcl/build/src/CMakeFiles/fcl.dir/flags.make is very telling:

CXX_FLAGS = -O3 -DNDEBUG -fPIC -std=c++11 -W -Wall -Wextra -Wpedantic -fPIC -fvisibility=hidden -mfpmath=sse -msse -msse2 -msse3 -mssse3

The issue is solved by pull request #563.

After adding a few includes (#include <cassert>), i.e., solving yet another issue, everything should be fine ;)

You can check my fork: https://github.com/velecto1/fcl