Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

c++ - google mock fails to compile on Unity Operating System with ARM

When I try to compile googletest and googlemock v1.10.0 on Unified Operating System with arm architecture, it always fails compile error. By the way, it is good to compile them on my Mac OSX and linux box (CentOS 7.4). Can anyone please help? Thanks in advance.

  1. Platform and toolchain:
$uname -a
Linux jinpin-PC 4.19.0-arm64-server #1635 SMP Mon Jan 13 16:07:12 CST 2020 aarch64 GNU/Linux

clang version 11.0.0 (http://git.linaro.org/toolchain/jenkins-scripts.git 8b6fa8104783bf002ea5f756d60aeb5f09d1037e)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/clang/bin
  1. googletest(v1.10.0) compiles ok while googlemock(v1.10.0) fails:
......
make[3]: Entering directory “/home/gpadmin/huor/repository/hornet-opensource/thirdparty/build/googletest-release-1.10.0”
[ 37%] Building CXX object googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/src/gmock-all.cc:39:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock.h:59:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-actions.h:51:
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:461:37: error: no template named 'IndexSequence'
auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>) -> decltype(
                                    ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:470:76: error: expected expression
                          MakeIndexSequence<std::tuple_size<Tuple>::value>())) {
                                                                           ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:470:27: error: use of undeclared identifier 'MakeIndexSequence'
                          MakeIndexSequence<std::tuple_size<Tuple>::value>())) {
                          ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:472:69: error: expected expression
                   MakeIndexSequence<std::tuple_size<Tuple>::value>());
                                                                    ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:472:20: error: use of undeclared identifier 'MakeIndexSequence'
                   MakeIndexSequence<std::tuple_size<Tuple>::value>());
                   ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:496:40: error: no template named 'MakeIndexSequence'
  using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type,
                                       ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/internal/gmock-internal-utils.h:501:34: error: unknown type name 'IgnoredValue'
  using MakeResultIgnoredValue = IgnoredValue(Args...);
                                 ^
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/src/gmock-all.cc:39:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock.h:59:
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-actions.h:903:46: error: no template named 'IndexSequence'
  std::vector<Action<void(Args...)>> Convert(IndexSequence<I...>) const {
                                             ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-actions.h:960:19: error: no type named 'IgnoredValue' in namespace 'testing::internal'
typedef internal::IgnoredValue Unused;
        ~~~~~~~~~~^
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/src/gmock-all.cc:39:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock.h:61:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-function-mocker.h:39:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-generated-function-mockers.h:47:
In file included from /home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-spec-builders.h:75:
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:88:42: error: unknown class name 'MatchResultListener'; did you mean 'StringMatchResultListener'?
class StringMatchResultListener : public MatchResultListener {
                                         ^~~~~~~~~~~~~~~~~~~
                                         StringMatchResultListener
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:88:7: note: 'StringMatchResultListener' declared here
class StringMatchResultListener : public MatchResultListener {
      ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:88:42: error: base class has incomplete type
class StringMatchResultListener : public MatchResultListener {
                                  ~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:88:7: note: definition of 'testing::StringMatchResultListener' is not complete until the closing '}'
class StringMatchResultListener : public MatchResultListener {
      ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:90:33: error: member initializer 'MatchResultListener' does not name a non-static data member or base class
  StringMatchResultListener() : MatchResultListener(&ss_) {}
                                ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:191:23: error: no template named 'MatcherInterface'
  class Impl : public MatcherInterface<T> {
                      ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:197:31: error: unknown type name 'MatchResultListener'
    bool MatchAndExplain(T x, MatchResultListener* listener) const override {
                              ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:215:47: error: only virtual member functions can be marked 'override'
    void DescribeTo(::std::ostream* os) const override {
                                              ^~~~~~~~~
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:219:55: error: only virtual member functions can be marked 'override'
    void DescribeNegationTo(::std::ostream* os) const override {
                                                      ^~~~~~~~~
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:334:27: error: unknown type name 'MatchResultListener'
                          MatchResultListener* listener) {
                          ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:489:31: error: no template named 'MatcherInterface'
class AnyMatcherImpl : public MatcherInterface<const T&> {
                              ^
/home/gpadmin/huor/repository/hornet-opensource/thirdparty/src/googletest-release-1.10.0/googlemock/include/gmock/gmock-matchers.h:492:24: error: unknown type name 'MatchResultListener'
                       MatchResultListener* /* listener */) const override {
                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [googlemock/CMakeFiles/gmock.dir/build.make:63:googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o] 错误 1
make[3]: Leaving directory “/home/gpadmin/huor/repository/hornet-opensource/thirdparty/build/googletest-release-1.10.0”
make[2]: *** [CMakeFiles/Makefile2:98:googlemock/CMakeFiles/gmock.dir/all] ERROR 2
make[2]: Leaving directory “/home/gpadmin/huor/repository/hornet-opensource/thirdparty/build/googletest-release-1.10.0”
make[1]: *** [Makefile:141:all] ERROR 2
make[1]: Leaving directory “/home/gpadmin/huor/repository/hornet-opensource/thirdparty/build/googletest-release-1.10.0”
make: *** [Makefile:327:/opt/dependency/package/version/googletest-release-1.10.0] ERROR 2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...