reedhedges / AriaCoda

Fork and continuation of the old ARIA library for use with Pioneer-compatible mobile robots. AriaCoda is based on the GPL-licensed ARIA library from MobileRobots Inc, which is no longer maintained. Various bug fixes, changes and improvements have been made. See README.md for more infor
Other
29 stars 25 forks source link

Compile error with gcc 5.4.0 (Ubuntu Xenial) #11

Closed reedhedges closed 2 years ago

reedhedges commented 2 years ago

Building AriaCoda (at revision a3f4e40) on Ubuntu 16.04 Xenial (gcc version 5.4.0) with:

make EXTRA_CXXFLAGS=-DARIA_OMIT_DEPRECATED_MATH_FUNCS 

results in these errors in ariaUtil.h:

g++ -c -std=c++14 -g -O2 -Wall -Wextra -Wshadow -Wpedantic -Wsign-conversion -Wconversion -Woverloaded-virtual  -D_REENTRANT   -fPIC -fno-exceptions -DARIA_OMIT_DEPRECATED_MATH_FUNCS  -Iinclude  -DARIABUILD src/ArAction.cpp -o obj/ArAction.o
In file included from include/Aria/ArActionDesired.h:28:0,
                 from include/Aria/ArResolver.h:28,
                 from src/ArAction.cpp:26:
include/Aria/ariaUtil.h:2167:18: error: enclosing class of constexpr non-static member function ‘bool ArLineSegment::linePointIsInSegment(const ArPose&) const’ is not a literal type
   constexpr bool linePointIsInSegment(const ArPose& pose) const
                  ^
include/Aria/ariaUtil.h:1956:7: note: ‘ArLineSegment’ is not literal because:
 class ArLineSegment
       ^
include/Aria/ariaUtil.h:1956:7: note:   ‘ArLineSegment’ is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor
reedhedges commented 2 years ago

So based on comments found on the internet this seems like it might technically be a bug in g++ version 5.

  1. AriaCoda will build with clang 3.8 (if you update to include the recently-comitted 42657e5) (you can set CXX variable when running make to "clang++") (you can install clang 3.8 on Xenial with sudo apt install clang)
  2. I could move the constexpr related stuff to a parallel branch (since most typical code probably isn't using much of it.)
  3. Or abandon Xenial support and use a newer Ubuntu version as minimum supported version.

Let me know what you think

reedhedges commented 2 years ago

Or,

  1. Use the preprocessor to detect gcc version and omit constexpr from any problematic places in ariaUtil (i.e. ArLineSegment and getRandMax()). (There is already a bunch of this kind of preprocessor trickery in Aria.)
reedhedges commented 2 years ago

Should be fixed in 3482f97