2017-09-18 92 views
0

我想编译Windows上的TensorFlow CMake内部版本,这需要64位工具链在编译期间不会耗尽内存。但是,即使在命令提示符中启用了Visual Studio 14 2015 Win64工具链,也可以使用32位工具链进行编译,如任务管理器所示,该任务管理器显示MSBuild (32 bit)Microsoft(R) C/C++ Compiler Driver (32 bit)进程。因此error: c1060: compiler is out of heap space被抛出了一点。尽管启用了Visual Studio 14 2015 Win64工具链,但仍使用32位工具链进行编译

这就是我迄今为止所做的:要启用64位工具链,我打开VS2015 x64 Native Tools Command Prompt。在配置CMake的,我得到的输出

-- Building for: Visual Studio 14 2015 
-- The C compiler identification is MSVC 19.0.24215.1 
-- The CXX compiler identification is MSVC 19.0.24215.1 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
-- Detecting CXX compile features 
-- Detecting CXX compile features - done 
-- Found PythonLibs: C:/Users/kasper/Anaconda3/libs/python35.lib (found version "3.5.2") 
-- Configuring done 
-- Generating done 

这样的CMake似乎已经拿起了64位编译器。 Futher, 在命令提示符下运行cl

Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64 
Copyright (C) Microsoft Corporation. All rights reserved. 

我也想跑"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall amd64" CMake的配置之前,但无济于事。 32位工具链最终仍然用于编译。

我错过了什么?

+0

需要注意的是,除非你以某种方式与你拨弄着VS安装时,CMake甚至可以从普通的'cmd'提示符中检测编译器的位置。所以没有理由打开VS提示符,你只需要指定你想用的'cmake'或'cmake-gui'编译器。 – ComicSansMS

回答

4

当执行CMake的,你必须指定您希望它在64位版本:

cmake -G "Visual Studio 14 2015 Win64" [...] 

否则,你的情况,默认情况下它一样

cmake -G "Visual Studio 14 2015" [...] 

和将其配置为32位模式。

+0

感谢您的输入。它让我更进一步。现在我卡在这里:https://stackoverflow.com/questions/46302725/how-to-pass-cmake-generator-to-a-cmake-external-project –

3

从CMake的--help命令行:

Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project 
files. 
Optional [arch] can be "Win64" or "ARM". 

如果你想建立针对x64目标,需要指定正确的CMake的生成:

CMake -G "Visual Studio 14 2015 Win64" .... 
+0

感谢您的输入! oLen首先不幸。看到我对他的回答的评论。 –

相关问题