0
votes

I want to test to build googletest basic example, but I fail...
[Steps]

$ cd ~/Test/  
$ git clone https://github.com/google/googletest  
$ cd googletest ---> It's the first dir  
$ mkdir mybuild  
$ cd mybuild  
$ cmake -Dgtest_build_samples=ON .. ---> One warning  

-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
gTest_build_samples
--Build files have been written to /home/hughesyang/Test/googletest/mybuild

$ make ---> error occur!

Error message(snippet first 17 lines):
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hughesyang/Test/googletest/mybuild
[ 3%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/hughesyang/Test/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h:38:0,
from /home/hughesyang/Test/googletest/googletest/include/gtest/gtest-death-test.h:40,
from /home/hughesyang/Test/googletest/googletest/include/gtest/gtest.h:62,
from /home/hughesyang/Test/googletest/googletest/src/gtest-all.cc:38:
/home/hughesyang/Test/googletest/googletest/include/gtest/gtest-matchers.h: In static member function ‘static constexpr bool testing::internal::MatcherBase::IsInlined()’:
/home/hughesyang/Test/googletest/googletest/include/gtest/gtest-matchers.h:414:12: error: ‘is_trivially_copy_constructible’ is not a member of ‘std’ std::is_trivially_copy_constructible::value &&
^ /home/hughesyang/Test/googletest/googletest/include/gtest/gtest-matchers.h:414:50: error: expected primary-expression before ‘>’ token std::is_trivially_copy_constructible::value &&
^ /home/hughesyang/Test/googletest/googletest/include/gtest/gtest-matchers.h:414:51: error: ‘::value’ has not been declared std::is_trivially_copy_constructible::value &&
...

[Environment]
OS: CentOS 7.7
CMake ver: 3.21.2
GNU Make ver: 4.2.1
gcc ver: 9.3.1-2

Any suggestion is very useful!

CentOS 7 comes with gcc 4.8 which is very outdated (current stable release is 11.2) and it looks is not supported by the gtest version you are trying to use (it says gcc 5.0+ is needed on github readme). Probably the easiest way is to install gtest-devel package from official EPEL repository with older version of gtest which should be compatible with old gcc compiler they ship.dewaffled
Hi dewaffled, Thanks for your reply! According to your suggestion. [First step] Updated gcc to 9.3.1-2, and then retry to "cmake -Dgtest_build_samples=ON ..". It don't show the warning now! But "make" shows the same error as topic. [Second step] Install gtest-devel by "yum --enablerepo=epel install gtest-devel-1.6.0-2.el7.x86_64". And retry "cmake -Dgtest_build_samples=ON .." & "make". However, it shows the same error message:(Hughes