遇到问题:
今天安装AMBER,这个分子模拟力场软件用cmake制作的的时候、需要用到c,c++,和fortran 的编译器。
c和c++的编译器都可以用微软的visual studio2019 的,但是fortran就不行了,报错。
我之间有安装fortran 的编译器:gfortran,通过mingw 安装的。cmd上也正常,但是仍然报错:
-- Setting Fortran compiler to gfortran
-- Amber source not found, only building AmberTools
-- The C compiler identification is MSVC 19.28.29336.0
-- The CXX compiler identification is MSVC 19.28.29336.0
-- The Fortran compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - failed
-- Check for working Fortran compiler: E:/cygwin64/bin/gfortran.exe
-- Check for working Fortran compiler: E:/cygwin64/bin/gfortran.exe - broken
CMake Error at E:/CMake/share/cmake-3.19/Modules/CMakeTestFortranCompiler.cmake:51 (message):
The Fortran compiler
...................
遇到报错问题,不能一味查百度,要先学会看报错的代码、认真看,才能知道遇到什么问题。
看到报错
– The Fortran compiler identification is unknown
– Detecting Fortran compiler ABI info - failed
cmake没办法识别 Fortran ,于是我就各种途径下载fortran编译器,还失败。后来临机一动,看有没有大厂有做fortran 的,还真有,intel家在做,叫做:Intel® Fortran Compiler,介绍:https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/fortran-compiler.html
https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-fortran-compiler-release-notes.html
下载阶段:
打开网站:https://software.intel.com/content/www/us/en/develop/articles/oneapi-standalone-components.html#fortran
找到
420M的,然后下载,会进入这个窗口,然后根据提示、把Fortran 搞进visual studio2019里… 我这个是已经按照好了的。
然后再次用cmake:
33/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Determine Intel Fortran Compiler Implicit Link Path -- Determine Intel Fortran Compiler Implicit Link Path - done
就成功了!