【发布时间】:2016-04-25 18:40:14
【问题描述】:
我正在使用 CMake 在 Windows 下准备一个 Fortran 项目。我用VC2015安装了一些入口Fortran编译器,当我cmake出现以下错误
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestFortranCompiler.cmake:54 (message):
The Fortran compiler "D:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/ifc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/Dev/plaf/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_f7da8\fast"
"D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f
CMakeFiles\cmTC_f7da8.dir\build.make /nologo -L
CMakeFiles\cmTC_f7da8.dir\build
Building Fortran object
CMakeFiles/cmTC_f7da8.dir/testFortranCompiler.f.obj
"D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe" -c
D:\Dev\plaf\build\CMakeFiles\CMakeTmp\testFortranCompiler.f -o
CMakeFiles\cmTC_f7da8.dir\testFortranCompiler.f.obj
usage: D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe
[subcommand] [options...]
subcommands:
OBJ Convert an interface file into a dummy object file which can be archived into a static lib.
EMBED Embed an interface file into an existing static lib, producing a new lib.
EXTRACT Extract an embedded interface file from an existing static lib, producing the ifc.
LOCATE Find all embedded interface files and print their offset + size to stdout.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\ifc.exe"' : return code '0x1'
我对错误的理解(如果我错了,请纠正我)是 cmake 使用带有错误标志的编译器,因此在示例程序编译期间它不起作用。
我该如何解决? (这个错误似乎与我在大多数其他帖子中看到的不同)
【问题讨论】:
-
如果你的意思是来自 Visual Studio,是的,我刚刚创建了一个新的 fortran hello world 项目,它编译和运行没有问题。
-
你的 CMake 版本是什么?有时需要调整一些东西以适应新版本。
-
这可能是身份错误的情况。 VS 2015 包含一个名为
ifc.exe的新工具,cmake完全有可能将此 exe 误认为是 Fortran 编译器(ifort以前称为ifc)。如果真是这样,最好的办法是降级到 VS2013 并让 cmake 开发人员知道。
标签: compilation cmake intel-fortran