Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on Fedora 34 #181

Closed
richmattes opened this issue Mar 9, 2021 · 4 comments
Closed

Build failure on Fedora 34 #181

richmattes opened this issue Mar 9, 2021 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@richmattes
Copy link

Environment

  • OS Version: Fedora 34 (pre-release)
  • Source or binary build? Source - ignition-common-3.10.1

Description

When building ignition-common on Fedora 34 and higher, I am experiencing a build failure when compiling plugin.cc for the INTEGRATION_plugin test. The command line (see Output section) doesn't include the necessary -std=c++17, instead it includes -std=c++11.

There are a couple of conflicting C++ standards being set in different places:

  • libignition_common3 has an INTERFACE target_compile_features set for cxx_std_17
  • test/CMakeLists.txt appends std=c++11 to the CMAKE_CXX_FLAGS before building gtest targets and including test subdirectories.

Given that the build works as expected on Fedora 33 with CMake 3.18, my guess is something changed in CMake 3.19 where the CMAKE_CXX_FLAGS take precedence and isn't overridden by target properties.

The CMAKE_CXX_FLAGS in test/CMakeLists.txt should be removed in favor of target-specific standards version selection if needed for the gtest libraries.

  • Expected behavior:
    Package builds as expected, including all tests

  • Actual behavior:
    Building the INTEGRATION_plugin test fails with an error (C++17 required for string_view - see the Output section)

Steps to reproduce

  1. Download CMake 3.19 or higher
  2. Configure and build with the CMake 3.19 binary

Output

Successful, and failed logs are (here)[https://copr.fedorainfracloud.org/coprs/g/robotics-sig/gazebo-latest/build/2059613/] in the builder_live logs. Excerpt of a failure case is shown below

[ 56%] Building CXX object test/integration/CMakeFiles/INTEGRATION_plugin.dir/plugin.cc.o
cd /builddir/build/BUILD/ignition-common-3.10.1/aarch64-redhat-linux-gnu/test/integration && /usr/bin/g++  -I/builddir/build/BUILD/ignition-common-3.10.1/include -I/builddir/build/BUILD/ignition-common-3.10.1/aarch64-redhat-linux-gnu/include -I/builddir/build/BUILD/ignition-common-3.10.1/test/gtest/include -I/builddir/build/BUILD/ignition-common-3.10.1/test/gtest -I/builddir/build/BUILD/ignition-common-3.10.1/test -I/builddir/build/BUILD/ignition-common-3.10.1/aarch64-redhat-linux-gnu -I/builddir/build/BUILD/ignition-common-3.10.1 -I/builddir/build/BUILD/ignition-common-3.10.1/aarch64-redhat-linux-gnu/core/include -isystem /usr/include/uuid -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -std=c++11 -DNDEBUG  -Wall -Wextra -Wno-long-long -Wno-unused-value -Wfloat-equal -Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic  -I/usr/include/uuid -o CMakeFiles/INTEGRATION_plugin.dir/plugin.cc.o -c /builddir/build/BUILD/ignition-common-3.10.1/test/integration/plugin.cc
In file included from /builddir/build/BUILD/ignition-common-3.10.1/include/ignition/common/Console.hh:25,
                 from /builddir/build/BUILD/ignition-common-3.10.1/test/integration/plugin.cc:28:
/builddir/build/BUILD/ignition-common-3.10.1/include/ignition/common/Util.hh:197:60: warning: 'visibility' attribute ignored [-Wattributes]
  197 |     constexpr uint64_t IGNITION_COMMON_VISIBLE hash64(std::string_view _key)
      |                                                            ^~~~~~~~~~~
/builddir/build/BUILD/ignition-common-3.10.1/include/ignition/common/Util.hh:197:60: error: 'string_view' is not a member of 'std'
/builddir/build/BUILD/ignition-common-3.10.1/include/ignition/common/Util.hh:197:60: note: 'std::string_view' is only available from C++17 onwards
gmake[2]: *** [test/integration/CMakeFiles/INTEGRATION_plugin.dir/build.make:85: test/integration/CMakeFiles/INTEGRATION_plugin.dir/plugin.cc.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/ignition-common-3.10.1/aarch64-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:1984: test/integration/CMakeFiles/INTEGRATION_plugin.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
@richmattes richmattes added the bug Something isn't working label Mar 9, 2021
@richmattes
Copy link
Author

richmattes commented Mar 9, 2021

I've confirmed that changing c++11 to c++17, and removing the modification of CMAKE_CXX_FLAGS altogether in test/CMakeLists.txt both resolve the failure.

@chapulina
Copy link
Contributor

Thanks for the ticket.

I've confirmed that changing c++11 to c++17, and removing the modification of CMAKE_CXX_FLAGS altogether in test/CMakeLists.txt both resolve the failure.

Would you mind opening a PR with the flags removal approach?

@chapulina chapulina added help wanted Extra attention is needed bug Something isn't working and removed bug Something isn't working labels Mar 15, 2021
mjcarroll added a commit that referenced this issue May 6, 2021
Fixes #181

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll
Copy link
Contributor

@richmattes Can you check #214 for me?

mjcarroll added a commit that referenced this issue May 14, 2021
* Remove CMAKE_CXX_FLAGS from test targets
* Set target versions for test plugin libs
* Add <thread> to Util

Fixes #181

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll
Copy link
Contributor

Closed by #214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants