使用CMake实用程序构建Azure物联网网关SDK解决方案

时间:2016-12-06 07:14:00

标签: azure visual-studio-2015 cmake iot gateway

我正在尝试使用适用于Windows 10平台上的Visual Studio 2015的CMake 3.71实用程序构建示例Azure IoT Gateway SDK项目。当我尝试分别在VS2015命令行和CMake GUI中构建项目时,我收到以下错误日志:

Determining if the _M_AMD64 exist failed with the following output:
Change Dir: C:/Users/nanos/Documents/GitHub/project/azure-iot-gateway-sdk/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_23e97.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1

Copyright (C) Microsoft Corporation. All rights reserved.



Build started 12/6/2016 1:53:03 AM.

Project "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" on node 1 (default targets).

PrepareForBuild:

  Creating directory "cmTC_23e97.dir\Debug\".

  Creating directory "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\Debug\".

  Creating directory "cmTC_23e97.dir\Debug\cmTC_23e97.tlog\".

InitializeBuildStatus:

  Creating "cmTC_23e97.dir\Debug\cmTC_23e97.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

ClCompile:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_23e97.dir\Debug\\" /Fd"cmTC_23e97.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c"

  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86

  Copyright (C) Microsoft Corporation.  All rights reserved.



  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_23e97.dir\Debug\\" /Fd"cmTC_23e97.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c"



  CheckSymbolExists.c

C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c(7): error C2065: '_M_AMD64': undeclared identifier [C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj]

Done Building Project "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" (default targets) -- FAILED.



Build FAILED.



"C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" (default target) (1) ->

(ClCompile target) -> 

  C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c(7): error C2065: '_M_AMD64': undeclared identifier [C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj]



    0 Warning(s)

    1 Error(s)



Time Elapsed 00:00:00.65


File C:/Users/nanos/Documents/GitHub/project/azure-iot-gateway-sdk/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */

int main(int argc, char** argv)
{
  (void)argv;
#ifndef _M_AMD64
  return ((int*)(&_M_AMD64))[argc];
#else
  (void)argc;
  return 0;
#endif
}

=============================================== ==========================

Output from the CMake GUI here

有人可以告诉我我做错了什么或指导我吗?我花了很多时间试图弄清楚如何解决这个问题。我在网上广泛搜索了解决方案,但没有成功。

提前致谢

1 个答案:

答案 0 :(得分:0)

似乎与此note

有关
  

注意:确保将repo克隆到目录heirachy with less   超过20个字符(如果路径是前缀\ azure-iot-gateway-sdk,   前缀必须少于20个字符)。 Windows有局限性   文件名的长度并将repo放在更深层次的层次结构中   超过20个字符将导致构建失败。我们的build.cmd脚本   如果最终会遇到此失败,则会抛出错误,但可以   在使用cmake手动构建项目时点击此项。

我杀了目录中的“项目”(... Documents / GitHub / project / azure-iot-gateway-sdk / ...),然后就可以了。

因此,您需要缩短将repo克隆到的目录的长度。