bogongjie
望风的懒蜗牛
采纳率33.3%
2017-04-17 03:50

关于gmock交叉编译的问题

有一份源码,目录结构如下:

 --Project
   --A
     --src
         --include
     --B
       --src
         --include
     ..  //像A,B这样的还有几个
     --build
     --doc
     --Thirdparty
       --googletest-release-1.8.0
           --googlemock
             --docs
                 --src
                 --tool
                 ...
                 --CMakeLists.txt
           --googletest
             -- 目录结构同googlemock
           --CMakeLists.txt
       --MultipartParser
         --rapidjson
         --CMakeLists.txt
         --googletest.cmake
     --tools
     --CMakeLists.txt

使用cmake -> make是可以编译成功的,也可以在本地运行。
但是在使用arm进行交叉编译的时候报错,修改了project下的CMakeList.txt文件,增加下面的内容:

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "../../toolschain/4.4.3/bin/arm-linux-gcc")
SET(CMAKE_CXX_COMPILER "../../toolschain/4.4.3/bin/arm-linux-g++")

哪位大神帮帮忙,看一下该怎么修改?
感激不尽!!!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • shen_wei shen_wei 4年前
  • bogongjie 望风的懒蜗牛 4年前

    补充错误信息:
    报错信息:

     Scanning dependencies of target gmock_main
    [  1%] Building CXX object ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/__/googletest/src/gtest-all.cc.o
    [  2%] Building CXX object ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o
    In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:58,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-actions.h: In static member function 'static Result testing::internal::ReturnNullAction::Perform(const ArgumentTuple&)':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-actions.h:631: error: 'nullptr' was not declared in this scope
    In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-spec-builders.h:75,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h:43,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:61,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'bool testing::internal::IsNullMatcher::MatchAndExplain(const Pointer&, testing::MatchResultListener*) const':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:983: error: 'nullptr' was not declared in this scope
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'bool testing::internal::NotNullMatcher::MatchAndExplain(const Pointer&, testing::MatchResultListener*) const':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1003: error: 'nullptr' was not declared in this scope
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1560: sorry, unimplemented: cannot expand 'Tail ...' into a fixed-length argument list
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: 'ListType' in class 'int' does not name a type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: template argument 2 is invalid
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: expected '::' before 'ListType'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In static member function 'static int testing::internal::MatcherList<kSize, Head, Tail>::BuildList(const Head&, const Tail& ...)':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'BuildList' is not a member of 'int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In static member function 'static testing::Matcher<T> testing::internal::MatcherList<kSize, Head, Tail>::CreateMatcher(const int&)':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1578: error: request for member 'first' in 'matchers', which is of non-class type 'const int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'CreateMatcher' is not a member of 'int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1580: error: request for member 'second' in 'matchers', which is of non-class type 'const int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1577: error: expected primary-expression before '(' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1578: error: request for member 'first' in 'matchers', which is of non-class type 'const int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'CreateMatcher' is not a member of 'int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: expected primary-expression before ',' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: missing template arguments before '>' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1580: error: request for member 'second' in 'matchers', which is of non-class type 'const int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1623: sorry, unimplemented: cannot expand 'Args ...' into a fixed-length argument list
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1625: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1625: error: 'ListType' in class 'int' does not name a type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In constructor 'testing::internal::VariadicMatcher<CombiningMatcher, Args>::VariadicMatcher(const Args& ...)':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'BuildList' is not a member of 'int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'testing::internal::VariadicMatcher<CombiningMatcher, Args>::operator testing::Matcher<T>() const':
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'CreateMatcher' is not a member of 'int'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: expected primary-expression before ',' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: missing template arguments before '>' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1631: error: expected unqualified-id before 'using'
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1725: error: expected unqualified-id before 'using'
    In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-spec-builders.h:75,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h:43,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:61,
                     from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40:
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:4363: error: expected initializer before '<' token
    /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:4368: error: expected initializer before '<' token
    make[2]: *** [ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o] Error 1
    make[1]: *** [ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/all] Error 2
    make: *** [all] Error 2
    
    
    点赞 评论 复制链接分享

相关推荐