rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
684 stars 339 forks source link

VERSION file at cr-libm interpreted as `<version>` header #1147

Open PeterBowman opened 1 year ago

PeterBowman commented 1 year ago

To reproduce, clone latest OpenRAVE master (currently at https://github.com/rdiankov/openrave/commit/e0badbcfe664a7b7e55877019f3cc8aa9b2621b9) and configure with:

cmake .. -DOPT_VIDEORECORDING=OFF -DOPT_PLUGINS=OFF -DOPT_PYTHON=OFF -DOPT_COLLADA=OFF -DOPT_CBINDINGS=OFF

Result:

[ 76%] Building CXX object src/CMakeFiles/boost_assertion_failed.dir/boost_assertion_failed.cpp.o
In file included from /usr/include/boost/config/detail/select_stdlib_config.hpp:24,
                 from /usr/include/boost/config.hpp:44,
                 from /usr/include/boost/config/workaround.hpp:41,
                 from /usr/include/boost/detail/workaround.hpp:8,
                 from /usr/include/boost/format.hpp:19,
                 from /home/bartek/wingit/openrave/src/boost_assertion_failed.cpp:7:
/home/bartek/wingit/openrave/3rdparty/crlibm-1.0beta4/version:1:1: error: expected unqualified-id before numeric constant
    1 | 1.0beta4
      | ^~~~~~~~

Here, Boost is trying to find a <version> header (introduced in C++20), then fall back to <cstddef> if missing (see select_stdlib_config.hpp or the below code excerpt). It appears to pick the plain-text file 3rdparty/crlibm-1.0beta4/VERSION (which contains the offending "1.0beta4" string) instead of any other system-installed header.

// from boost/config/detail/select_stdlib_config.hpp at Boost.config 1.74.0

#if defined(__cplusplus) && defined(__has_include)
#  if __has_include(<version>)
#    include <version>
#  else
#    include <cstddef>
#  endif
#elif defined(__cplusplus)
#  include <cstddef>
#else
#  include <stddef.h>
#endif

Environment:

CMake configuration output.

As a temporary workaround, I renamed VERSION to VERSION.txt.

PeterBowman commented 1 year ago

This issue has also hit other projects: https://github.com/boostorg/config/issues/345. A common suggestion is to rename or place the version file elsewhere.

cielavenir commented 1 year ago

GCC11's default is gnu++17 right? why 20 is used?

for now can you try -DCMAKE_CXX_STANDARD=17?

PeterBowman commented 1 year ago

I checked build/src/CMakeFiles/boost_assertion_failed.dir/flags.make and verified I'm actually building this target with the -std=gnu++14 C++ compiler flag. This is enforced by OpenRAVE itself. I also checked the outcome of using either C++17 or C++20 and got the same error anyway.

I'm baffled about the fact that a nearly equivalent build succeeds on GHA runners: logs.