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

Building tests fails with gtest 1.14.0: error C++ versions less than C++14 are not supported #44

Open
badshah400 opened this issue Apr 25, 2024 · 0 comments

Comments

@badshah400
Copy link

Builds for ade (version 0.1.2d) are currently failing for openSUSE Tumbleweed when building tests using system installed gtest which is at version 1.14.0. This version of gtest requires at least whereas ade seems to enforce CMAKE_CXX_STANDARD=11 and passing -DCMAKE_CXX_STANDARD=14 when calling cmake does not help either.

Here is the relevant portion of the failing build log:

[   48s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/ade-0.1.2d/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=bin -DCMAKE_INSTALL_SBINDIR:PATH=sbin -DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var -DCMAKE_INSTALL_RUNSTATEDIR:PATH=run -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_INCLUDEDIR:PATH=include -DCMAKE_INSTALL_DATAROOTDIR:PATH=share -DCMAKE_INSTALL_DOCDIR:PATH=share/doc/packages/ade -DCMAKE_INSTALL_MANDIR:PATH=share/man -DCMAKE_INSTALL_INFODIR:PATH=share/info -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' '-DCMAKE_CXX_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' '-DCMAKE_Fortran_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' '-DCMAKE_EXE_LINKER_FLAGS=-flto=auto -ffat-lto-objects -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-flto=auto -ffat-lto-objects -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS=-flto=auto -ffat-lto-objects -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/ade -DCMAKE_CXX_STANDARD=14 -DGTEST_ROOT:PATH=/usr -DENABLE_ADE_TESTING=ON

---✀---

[   54s] [ 50%] Building CXX object sources/tests/common/CMakeFiles/common-tests.dir/checkedcast_test.cpp.o
[   54s] cd /home/abuild/rpmbuild/BUILD/ade-0.1.2d/build/sources/tests/common && /var/lib/build/ccache/bin/c++ -D_FORTIFY_SOURCE=2 -I/home/abuild/rpmbuild/BUILD/ade-0.1.2d/sources/ade/include -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g -O2 -g -DNDEBUG -std=gnu++11 -fstack-protector-strong -MD -MT sources/tests/common/CMakeFiles/common-tests.dir/checkedcast_test.cpp.o -MF CMakeFiles/common-tests.dir/checkedcast_test.cpp.o.d -o CMakeFiles/common-tests.dir/checkedcast_test.cpp.o -c /home/abuild/rpmbuild/BUILD/ade-0.1.2d/sources/tests/common/checkedcast_test.cpp
[   54s] In file included from /usr/include/gtest/gtest-message.h:57,
[   54s]                  from /usr/include/gtest/gtest-assertion-result.h:46,
[   54s]                  from /usr/include/gtest/gtest.h:64,
[   54s]                  from /home/abuild/rpmbuild/BUILD/ade-0.1.2d/sources/tests/common/checkedcast_test.cpp:12:
[   54s] /usr/include/gtest/internal/gtest-port.h:279:2: error: #error C++ versions less than C++14 are not supported.
[   54s]   279 | #error C++ versions less than C++14 are not supported.
[   54s]       |  ^~~~~
[   54s] /usr/include/gtest/gtest-assertion-result.h: In member function ‘void testing::AssertionResult::AppendMessage(const testing::Message&)’:
[   54s] /usr/include/gtest/gtest-assertion-result.h:207:48: error: ‘make_unique’ is not a member of ‘std’
[   54s]   207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
[   54s]       |                                                ^~~~~~~~~~~
[   54s] /usr/include/gtest/gtest-assertion-result.h:207:48: note: ‘std::make_unique’ is only available from C++14 onwards
[   54s] /usr/include/gtest/gtest-assertion-result.h:207:73: error: expected primary-expression before ‘>’ token
[   54s]   207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
[   54s]       |                                                                         ^
[   54s] /usr/include/gtest/gtest-assertion-result.h:207:75: error: expected primary-expression before ‘)’ token
[   54s]   207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
[   54s]       |                                                                           ^
[   54s] In file included from /usr/include/gtest/gtest-printers.h:122,
[   54s]                  from /usr/include/gtest/gtest-matchers.h:49,
[   54s]                  from /usr/include/gtest/internal/gtest-death-test-internal.h:47,
[   54s]                  from /usr/include/gtest/gtest-death-test.h:43,
[   54s]                  from /usr/include/gtest/gtest.h:65:
[   54s] /usr/include/gtest/internal/gtest-internal.h: At global scope:
[   54s] /usr/include/gtest/internal/gtest-internal.h:622:58: error: wrong number of template arguments (0, should be 1)
[   54s]   622 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
[   54s]       |                                                          ^
[   54s] In file included from /usr/include/c++/13/string:49,
[   54s]                  from /usr/include/c++/13/bits/locale_classes.h:40,
[   54s]                  from /usr/include/c++/13/bits/ios_base.h:41,
[   54s]                  from /usr/include/c++/13/iomanip:42,
[   54s]                  from /usr/include/gtest/gtest.h:54:
[   54s] /usr/include/c++/13/bits/stl_function.h:403:12: note: provided for ‘template<class _Tp> struct std::less’
[   54s]   403 |     struct less : public binary_function<_Tp, _Tp, bool>
[   54s]       |            ^~~~
[   54s] /usr/include/gtest/internal/gtest-internal.h:622:59: error: template argument 3 is invalid
[   54s]   622 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
[   54s]       |                                                           ^~
[   54s] /usr/include/gtest/internal/gtest-internal.h: In member function ‘bool testing::internal::TypedTestSuitePState::AddTestName(const char*, int, const char*, const char*)’:

Would be grateful for any suggestion about working around this. We could patch the ade CMakeLists.txt file to change the standard to 14, of course, but do not know whether that would be advisable.

Some additional info:

  • GCC 13.2.1
  • OS: Linux (openSUSE Tumbleweed)

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant