Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Anbox does not compile using gtest version 1.13.0-1 #2119

Open
omarmohamedkh opened this issue Jan 24, 2023 · 1 comment
Open

Anbox does not compile using gtest version 1.13.0-1 #2119

omarmohamedkh opened this issue Jan 24, 2023 · 1 comment

Comments

@omarmohamedkh
Copy link

Anbox doesn't compile using gtest version 1.13.0-1 on archlinux.
I'm using Aur and the PKGBUILD already disables tests but the error occurs in external/android-emugl/shared/emugl/common/mutex_unittest.cpp

Additional info:
downgrading to version 1.12.1-1 allows it to compile successfully.

error:

[ 21%] Building CXX object external/android-emugl/shared/emugl/common/CMakeFiles/emugl_common.dir/mutex_unittest.cpp.o
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from /home/omar/.cache/yay/anbox-git/src/anbox/external/android-emugl/shared/emugl/common/mutex_unittest.cpp:19:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++ versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
In file included from /usr/include/gtest/gtest-printers.h:115,
                 from /usr/include/gtest/gtest-matchers.h:48,
                 from /usr/include/gtest/internal/gtest-death-test-internal.h:47,
                 from /usr/include/gtest/gtest-death-test.h:43,
                 from /usr/include/gtest/gtest.h:65:
/usr/include/gtest/internal/gtest-internal.h:636:58: error: wrong number of template arguments (0, should be 1)
  636 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
      |                                                          ^
In file included from /usr/include/c++/12.2.1/string:48,
                 from /usr/include/c++/12.2.1/bits/locale_classes.h:40,
                 from /usr/include/c++/12.2.1/bits/ios_base.h:41,
                 from /usr/include/c++/12.2.1/iomanip:40,
                 from /usr/include/gtest/gtest.h:54:
/usr/include/c++/12.2.1/bits/stl_function.h:403:12: note: provided for ‘template<class _Tp> struct std::less’
  403 |     struct less : public binary_function<_Tp, _Tp, bool>
      |            ^~~~
/usr/include/gtest/internal/gtest-internal.h:636:59: error: template argument 3 is invalid
  636 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
      |                                                           ^~
/usr/include/gtest/internal/gtest-internal.h: In member function ‘bool testing::internal::TypedTestSuitePState::AddTestName(const char*, int, const char*, const char*)’:
/usr/include/gtest/internal/gtest-internal.h:613:23: error: request for member ‘insert’ in ‘((testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_’, which is of non-class type ‘testing::internal::TypedTestSuitePState::RegisteredTestsMap’ {aka ‘int’}
  613 |     registered_tests_.insert(
      |                       ^~~~~~
/usr/include/gtest/internal/gtest-internal.h: In member function ‘bool testing::internal::TypedTestSuitePState::TestExists(const std::string&) const’:
/usr/include/gtest/internal/gtest-internal.h:619:30: error: request for member ‘count’ in ‘((const testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_’, which is of non-class type ‘const testing::internal::TypedTestSuitePState::RegisteredTestsMap’ {aka ‘const int’}
  619 |     return registered_tests_.count(test_name) > 0;
      |                              ^~~~~
/usr/include/gtest/internal/gtest-internal.h: In member function ‘const testing::internal::CodeLocation& testing::internal::TypedTestSuitePState::GetCodeLocation(const std::string&) const’:
/usr/include/gtest/internal/gtest-internal.h:623:40: error: qualified-id in declaration before ‘it’
  623 |     RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
      |                                        ^~
/usr/include/gtest/internal/gtest-internal.h:624:5: error: ‘it’ was not declared in this scope; did you mean ‘int’?
  624 |     GTEST_CHECK_(it != registered_tests_.end());
      |     ^~~~~~~~~~~~
/usr/include/gtest/internal/gtest-internal.h:624:5: error: request for member ‘end’ in ‘((const testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_’, which is of non-class type ‘const testing::internal::TypedTestSuitePState::RegisteredTestsMap’ {aka ‘const int’}
  624 |     GTEST_CHECK_(it != registered_tests_.end());
      |     ^~~~~~~~~~~~
/usr/include/gtest/internal/gtest-internal.h:625:12: error: ‘it’ was not declared in this scope; did you mean ‘int’?
  625 |     return it->second;
      |            ^~
      |            int
make[2]: *** [external/android-emugl/shared/emugl/common/CMakeFiles/emugl_common.dir/build.make:146: external/android-emugl/shared/emugl/common/CMakeFiles/emugl_common.dir/mutex_unittest.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1326: external/android-emugl/shared/emugl/common/CMakeFiles/emugl_common.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
make: Leaving directory '/home/omar/.cache/yay/anbox-git/src/build'
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: anbox-git
@tmn505
Copy link
Contributor

tmn505 commented Feb 2, 2023

You can raise the standard which it's compiled with by:

--- a/external/android-emugl/CMakeLists.txt
+++ b/external/android-emugl/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Don't treat any warnings as error as we take the source directly from
 # upstream and just compile it.
 set(CMAKE_C_FLAGS "-Wall")
-set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")
+set(CMAKE_CXX_FLAGS "-std=c++14 -Wall")
 
 # Ensure -fPIC
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Then it's compiling fine.

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

No branches or pull requests

2 participants