OpenFAST / openfast

Main repository for the NREL-supported OpenFAST whole-turbine and FAST.Farm wind farm simulation codes.
http://openfast.readthedocs.io
Apache License 2.0
684 stars 457 forks source link

Error in Compiling openFAST Windows 10 through visual studio #1249

Open TheAfzalAmanullah opened 2 years ago

TheAfzalAmanullah commented 2 years ago

I am trying to compile openFAST on windows using the visual studio method from here https://openfast.readthedocs.io/en/dev/source/install/install_vs_windows.html.

After doing the Build>Build Solution step, I got errors . How can I overcome this issue?

error #11018: Cannot open mkl_intel_lp64
error #11018: Cannot open mkl_core
error #11018: Cannot open mkl_sequential
fatal error LNK1104: cannot open file 'mkl_intel_lp64.lib'

warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ISNAN]
warning #7410: Fortran 2003 does not allow this keyword. [CONVERT]
warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [INITOUT]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA]
warning #7410: Fortran 2003 does not allow this keyword. [DIRECTORY]
warning #7410: Fortran 2003 does not allow this keyword. [CARRIAGECONTROL]
warning #7410: Fortran 2003 does not allow this keyword. [CONVERT]
warning #7416: Fortran 2003 does not allow this intrinsic procedure. [EXIT]
warning #7025: This directive is not standard F2003.
warning #7025: This directive is not standard F2003.
warning #7025: This directive is not standard F2003.

Error

I am using windows 10, visual studio 2022, have downloaded the intel FORTRAN compiler as directed. Many Thanks Afzal

bjonkman commented 2 years ago

When you installed the Fortran compiler, did you also install the MKL (math kernel library)? There could be a checkbox during the install or it might be in a separate install of a different OneAPI toolkit, depending on which version of the compiler you are using.

Otherwise, I'd suggest looking at the comments in issue https://github.com/OpenFAST/openfast/issues/1133 to see if any of those problems are similar to yours. There have been issues with using later version of Visual Studio 2022.

TheAfzalAmanullah commented 2 years ago

When I was installing I got these options in Microsoft Visual Studio, Where I checked "Desktop development with C++". error1

In Fortan error2

error3

I didn't find any checkbox during the installation API toolkit, please see third pic. How should I install API toolkit?

deslaughter commented 2 years ago

The Intel oneAPI is comprised of several Toolkits, the HPC Toolkit includes the Fortran compiler and it looks like that's the one you've installed. You'll also need to install the Base Toolkit which can be found at https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#base-kit. This installer provides the option to install the Math Kernel Library (mkl).

TheAfzalAmanullah commented 2 years ago

I installed OneAPI toolkit, but again I am getting too much error and warnings. Can anyone please help. error4

bjonkman commented 2 years ago

First, I would suggest that you try to rebuild the solution (build -> rebuild solution) if you haven't done so already.

If that doesn't solve the issue, I'd need to see some more information. You are showing different errors than the first time, and I need to see exactly what configuration you are building and how you are trying to build it.

  1. Can you explain what you are trying to build: Which solution file did you open? What solution configuration (Release, Debug, etc) and platform (Win32, x64) are you building? It may be helpful if you just share a screenshot of your entire Visual Studio window, including toolbars and the solution explorer window.
  2. Can you show us the full text from your output window instead of the error list (the second tab on the bottom left)?
TheAfzalAmanullah commented 2 years ago

I tried to rebuild the solution but got the same error.

  1. I am doing what is written in section of 2.2.3.1.2 https://openfast.readthedocs.io/en/dev/source/install/install_vs_windows.html. In that suggestion I navigate to the directory openfast\vs-build\FAST and double-click on the FAST.sln Visual Studio solution file.

After that Solution Configuration, such as Release, and the desired Solution Platform, such as x64 by using the drop down boxes located below the menu bar. Build the solution using the Build->Build Solution menu option.

  1. Output window

Build started... 1>------ Build started: Project: FAST_Registry, Configuration: Release Win32 ------ 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(460,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". 1>Done building project "FAST_Registry.vcxproj" -- FAILED. 2>------ Build started: Project: MAP_dll, Configuration: Release x64 ------ 2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 2>Done building project "MAP_dll.vcxproj" -- FAILED. 3>------ Build started: Project: FASTlib (IFORT), Configuration: Release x64 ------ 3>Performing Pre-Build Event... 3>Running Registry for FEAMooring 3>====================================================================== 3>'....\build\bin\Registry.exe' is not recognized as an internal or external command, 3>operable program or batch file. 3>Error running FAST Registry for FEAMooring. 3>  3>====================================================================== 3>Project : error PRJ0019: A tool returned an error code from "Running Registry for FEAMooring" 3> 3>Build log written to "file://C:\Users\DELL\WTurbine\openfast\vs-build\FASTlib\x64\Release\BuildLog.htm" 3>FASTlib - 2 error(s), 0 warning(s) 4>------ Skipped Build: Project: OpenFAST-Simulink (IFORT), Configuration: Release_Matlab x64 ------ 4>Project not selected to build for this solution configuration 5>------ Build started: Project: FAST (IFORT), Configuration: Release x64 ------ 5>Compiling with Intel® Fortran Compiler Classic 2021.6.0 [Intel(R) 64]... 5>FAST_Prog.f90 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(34): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [FAST_SUBS] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(39): error #6683: A kind type parameter must be a compile-time constant. [DBKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(39): warning #8586: Implicit type is given to allow out-of-order declaration. Non-standard extension. [DBKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(39): error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [DBKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(39): error #6975: A kind-param must be a digit-string or a scalar-int-constant-name. [DBKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(40): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(43): error #6457: This derived type name has not been declared. [FAST_TURBINETYPE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(45): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(46): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(47): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(48): warning #8586: Implicit type is given to allow out-of-order declaration. Non-standard extension. [ERRMSGLEN] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(48): warning #6187: Fortran 2003 requires an INTEGER data type in this context. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(54): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(179): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(184): error #6683: A kind type parameter must be a compile-time constant. [INTKI] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(61): error #6404: This name does not have a type, and must have an explicit type. [PROGNAME] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(61): warning #6931: Fortran 2003 does not allow this assignment statement. ['OpenFAST'] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(65): error #6632: Keyword arguments are invalid without an explicit interface. [FLAG] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(65): error #6632: Keyword arguments are invalid without an explicit interface. [ARG2] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(68): error #6404: This name does not have a type, and must have an explicit type. [TURBINE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(77): error #6404: This name does not have a type, and must have an explicit type. [ERRID_NONE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(77): error #6632: Keyword arguments are invalid without an explicit interface. [SKIPRUNTIMEMSG] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(122): warning #6187: Fortran 2003 requires an INTEGER data type in this context. [N_TMAX_M1] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): error #6363: The intrinsic data types of the arguments must be the same. [MOD] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): error #6460: This is not a component name that is defined in the encompassing structure. [FOUNDSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. [FOUNDSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): warning #6192: Fortran 2003 does not allow this data type conversion. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(128): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(129): error #6362: The data types of the argument(s) are invalid. [TRIM] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(129): error #6404: This name does not have a type, and must have an explicit type. [NUM2LSTR] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(129): error #6362: The data types of the argument(s) are invalid. [TRIM] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(132): error #6404: This name does not have a type, and must have an explicit type. [ABORTERRLEV] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(132): error #6404: This name does not have a type, and must have an explicit type. [ERRID_SEVERE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(133): error #6363: The intrinsic data types of the arguments must be the same. [MIN] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(134): error #6404: This name does not have a type, and must have an explicit type. [NEWLINE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(134): error #6054: A CHARACTER data type is required in this context. [NEWLINE] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(152): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. [FOUNDSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(152): error #6341: A logical data type is required in this context. [FOUNDSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(158): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. [CALCSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(158): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. [FOUNDSTEADY] 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(158): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(158): warning #6188: Fortran 2003 requires a LOGICAL data type in this context. 5>C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90(159): error #6404: This name does not have a type, and must have an explicit type. [ERRID_FATAL] 5>C:\Users\DELL\AppData\Local\Temp\1604413.i90(211): catastrophic error: Too many errors, exiting 5>compilation aborted for C:\Users\DELL\WTurbine\openfast\glue-codes\openfast\src\FAST_Prog.f90 (code 1) 5> 5>Build log written to "file://C:\Users\DELL\WTurbine\openfast\vs-build\FAST\x64\Release\BuildLog.htm" 5>FAST - 31 error(s), 14 warning(s) ========== Build: 0 succeeded, 4 failed, 0 up-to-date, 1 skipped ==========

bjonkman commented 2 years ago

From the first error, it looks like you need to retarget the solution to use a newer version of the C/C++ compiler. You apparently don't have the VS1.40 toolkit, so you will have to select the toolkit you do have installed with your version of Visual Studio. As the message states, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution"

After retargeting the solution, you can build again and that should fix the current issue. (You may have to build the solution a second time if the types files are missing after your last rebuild.)

TheAfzalAmanullah commented 2 years ago

Thanks to everyone finally I compiled. But I getting a problem when I tried to follow the command as specified in https://openfast.readthedocs.io/en/dev/source/install/index.html#github-releases . After downloading the OpenFast v2.0.0 version (as mentioned ) I extracted the file then running a simple test command (as mentioned) - cd C:\Users\DELL\Desktop\openfast_v2.0.0_binaries>openfast_x64.exe /h

but I got error. image

What should I do? Please help me. Thank you

jjonkman commented 2 years ago

Dear @TheAfzalAmanullah,

The /h is just an optional argument indicating that you want help understanding the syntax to call OpenFAST. The name of the primary OpenFAST input file is a required argument, and you have left it blank. The error is telling you that you must specify the name of the primary OpenFAST input file (*.fst file) that you would like to run.

Best regards,

TheAfzalAmanullah commented 2 years ago

I installed visual studio and Intel Fortan compiler as mentioned in 2.2.3.1 documents, Now I want to run TurbSim and AeroDyn file. How to do it? What is the procedure? Lots of confusion after going through documents. Is it necessary to CMake or other thing?

TheAfzalAmanullah commented 2 years ago

Dear @jjonkman, Thanks a lot sir for your answers.

TheAfzalAmanullah commented 2 years ago

When I tried to run openfast\vs-build\FAST and then run FAST.sln with solution configuration, Release, and the desired Solution Platform, x64, it compiled but again do other openfast\vs-build\Discon and then run Discon.sln, Release configuration with x64 platform, I got the error. image

and output

image

How to solve these issues?

bjonkman commented 2 years ago

If you are attempting to build the DISCON dlls (necessary only to run 5MW Baseline models), you will have to get the files from the r-test submodule. The errors from your Visual Studio build indicate that it doesn't have any source files in "c:\Users\DELL\Wind\openfast\reg_tests\r-test\glue-codes\openfast\5MW_Baseline\ServoData\"

ietqlw commented 1 year ago

Dear @bjonkman and @jjonkman,

Recently, I have upgraded openfast from Version 3.0.0 to Version 3.4.1. Anything went well with Version 3.0.0. When I employed visual studio 2019 to compile openfast 3.4.1, I was told to upgrade “Windows SDK Version” to 10.0. I selected to upgrade. However, "Configuration Type" in “MAP_dll Property Pages ” was altered as “Static library (.lib)” automatically. Hence, when I rebuilt the solution, MAP_x64.dll did not generate. Other files could generated normally. I tried to change the "Configuration Type" as “Dynamic Library (.dll)” and then rebuilt the solution. MAP_x64.dll could generated normally while MAP_x64.lib was missing. As a result, error was reported as "Severity Code Description Project File Line Suppression State Error fatal error LNK1181: cannot open input file '....\build\bin\MAP_x64.lib' LINK".

I came up a solution to this bug: 1) compile "MAP_dll" project alone to generate MAP_x64.dll by setting "Configuration Type" in “MAP_dll Property Pages ” as “Dynamic Library (.dll)”. 2) build the whole solution (instead of “rebuild”) by setting "Configuration Type" in “MAP_dll Property Pages ”as “Static library (.lib)”.

By doing this, all files including MAP_x64.dll and MAP_x64.lib can generate normally. But I do not know whether it has potential deficiencies. I have conducted a regression test the compiled program. 36 cases passed and 2 case failed. 微信图片_20230225222128

KanwarOsama commented 1 year ago

I installed OneAPI toolkit, but again I am getting too much error and warnings. Can anyone please help. error4

Hi, I have the same issues as you. Can you please help me solve these issues?