# Instructions for Compiling FAST

**URL:** <https://forums.nlr.gov/t/instructions-for-compiling-fast/514>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [May 25, 2012, 7:15pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514 "2012-05-25T19:15:27Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [January 21, 2015, 9:41pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/101 "2015-01-21T21:41:27Z")

</div>

Andre,

You shouldn’t have to recompile the DLL, but you could try.

I recall having some segmentation faults with gfortran reading the DLL due to an incredible obscure difference in my interface block. A while ago I pulled some FAST v8 code for using a Bladed DLL with gfortran into FAST v7. I dug it up this afternoon and removed a few lines that were specialized for the project I was helping with. You are welcome to use it, but I really can’t support questions on it (it may not even compile right now). Here’s a link: [wind.nrel.gov/public/bjonkman/De … ortran.f90](http://wind.nrel.gov/public/bjonkman/DesignCodes/AlphaVersions/BladedDLLInterface_v7_gfortran.f90).

My guess is the problem with the “mexprintf” vs “mexPrintf” is the calling convention. You might be able to fix that with a compiler switch, but I don’t know what it is off the top of my head.

---

<div class="post-metadata">

**Author:** ![Andre.Fettouhi](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Andre.Fettouhi](https://forums.nlr.gov/u/Andre.Fettouhi)\
**Post date:** [January 22, 2015, 10:28am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/102 "2015-01-22T10:28:11Z")

</div>

> [@Bonnie.Jonkman](#):
>
> Andre,
> 
> You shouldn’t have to recompile the DLL, but you could try.
> 
> I recall having some segmentation faults with gfortran reading the DLL due to an incredible obscure difference in my interface block. A while ago I pulled some FAST v8 code for using a Bladed DLL with gfortran into FAST v7. I dug it up this afternoon and removed a few lines that were specialized for the project I was helping with. You are welcome to use it, but I really can’t support questions on it (it may not even compile right now). Here’s a link: [wind.nrel.gov/public/bjonkman/De … ortran.f90](http://wind.nrel.gov/public/bjonkman/DesignCodes/AlphaVersions/BladedDLLInterface_v7_gfortran.f90).
> 
> My guess is the problem with the “mexprintf” vs “mexPrintf” is the calling convention. You might be able to fix that with a compiler switch, but I don’t know what it is off the top of my head.

Thanks for the new source. But this one also fails to run. It compiles but doing a calculation gives the same segmentation fault sadly.

---

<div class="post-metadata">

**Author:** ![Nagore.Zestafe](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nagore.Zestafe](https://forums.nlr.gov/u/Nagore.Zestafe)\
**Post date:** [March 9, 2015, 5:18pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/103 "2015-03-09T17:18:37Z")

</div>

Hello Bonnie and Marshall,

I want to make a simulation with Adams using the output (Adams.adm or Adams.acf) extracted from Fast.  
I suppose I have to compile fast using CompileLinkA2AD.bat but it has been impossible. I get the adams.f and adams.f90 but I have this problem:

```auto
Compiling ADAMS2AD and AeroDyn routines to create ADAMS.obj:
Intel(R) Visual Fortran Compiler for applications running on IA-32, Version 10.1
    Build 20080602 Package ID: w_fc_p_10.1.024
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
ifort: command line warning #10121: overriding '/automatic' with '/Qsave'

Intel(R) Visual Fortran Compiler for applications running on IA-32, Version 10.1
    Build 20080602 Package ID: w_fc_p_10.1.024
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
ifort: command line warning #10121: overriding '/automatic' with '/Qsave'

Linking ADAMS2AD and AeroDyn routines with ADAMS 2008r1:
"ADAMS08r1" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
```

The versions of the programs I am working with are the next ones:  
 Intel visual fortran 10.1.024  
 Microsoft Visual Studio 2008  
 Fast v7  
 Msc Adams 2013 2.0 (x64)

I have read older posts and I suppose that the problem is because of the version of Adams I have installed and I know you recommended using Adams 2008r1, but I have only access to the 2013 version.  
So, what changes do I have to make to compile with adams 2013? Or is any possibility of making the simulation I need without compiling?  
Thank you very much,  
Nagore

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [March 10, 2015, 4:32am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/104 "2015-03-10T04:32:18Z")

</div>

Hi, Nagore.

It’s been a while since I’ve looked at compiling Adams, and I’m not sure version 2013 will work well with the A2AD source code.

However, the first thing you need to do is find out how to call Adams. Version 2008 provided batch files like “ADAMS08r1”, which you could use to easily call the program. Later version do not have these shortcuts, so you’ll need to find out where the mdi.bat files are stored. The easiest way to do this is to find the shortcut to “Adams Command”. Go to your Windows start menu and navigate to MSC.Software, then right-click on the “Adams Command” shortcut. Go to properties and copy the “target” field into the A2AD batch script, replacing “ADAMS08r1” in the following line `
CALL ADAMS08r1 cr-user n %ROOT_NAME%.obj %ROOT_NAME%f.obj -n %DLLName%.dll exit < NewLine.txt
`with the shortcut’s target.

Good luck!

---

<div class="post-metadata">

**Author:** ![Nagore.Zestafe](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nagore.Zestafe](https://forums.nlr.gov/u/Nagore.Zestafe)\
**Post date:** [March 10, 2015, 9:10pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/105 "2015-03-10T21:10:15Z")

</div>

Hi Bonnie,

Thank you for your fast reply. I think I have made the changes you suggested me. I have found the “mdi.bat” file and I have put it in the line you told me:

[code]ECHO Linking ADAMS2AD and AeroDyn routines with ADAMS 2008r1:  
SET DLLName=%ROOT\_NAME%  
IF /I “%1”==“DLL” SET DLLName=%DLLName%\_forBladedDLL

CALL mdi cr-user n %ROOT\_NAME%.obj %ROOT\_NAME%f.obj -n %DLLName%.dll exit \< NewLine.txt

GOTO end[/code]

But I have had the next error:

[code]Linking Adams/Solver (User) DLL…  
Microsoft (R) Incremental Linker Version 9.00.21022.08  
Copyright (C) Microsoft Corporation. All rights reserved.

“ADAMS.obj”  
“ADAMSf.obj”  
“-out:ADAMS.dll”  
-def:mysolver.def  
-debug:none  
-nodefaultlib  
-dll  
“-libpath:C:\MSC~1.SOF\ADAMS\_~1\2013\_2\win64”  
msvcrt.lib msvcprt.lib  
ws2\_32.lib  
kernel32.lib  
libifcoremd.lib libmmd.lib libifportmd.lib  
libirc.lib svml\_dispmd.lib  
asutility\_imp.lib mdiloader\_imp.lib  
abgtire\_imp.lib vpgutility\_imp.lib  
tire\_imp.lib amd\_imp.lib  
Creando biblioteca ADAMS.lib y objeto ADAMS.exp  
ADAMS.obj : error LNK2019: símbolo externo \_TIMGET@4 sin resolver al que se hace  
referencia en la función \_VFOSUB  
ADAMS.obj : error LNK2019: símbolo externo \_SYSFNC@24 sin resolver al que se hac  
e referencia en la función \_VFOSUB  
ADAMS.obj : error LNK2019: símbolo externo \_SYSARY@28 sin resolver al que se hac  
e referencia en la función \_VFOSUB  
ADAMS.obj : error LNK2019: símbolo externo \_GETMOD@4 sin resolver al que se hace  
referencia en la función \_A2AD\_MOD\_mp\_PSEUDO\_HANDLER  
ADAMS.obj : error LNK2019: símbolo externo \_GTARAY@16 sin resolver al que se hac  
e referencia en la función \_A2AD\_MOD\_mp\_PSEUDO\_HANDLER  
ADAMS.obj : error LNK2019: símbolo externo \_GTSTRG@20 sin resolver al que se hac  
e referencia en la función \_A2AD\_MOD\_mp\_PSEUDO\_HANDLER  
ADAMS.obj : error LNK2019: símbolo externo \_GETVER@8 sin resolver al que se hace  
referencia en la función \_A2AD\_MOD\_mp\_PSEUDO\_HANDLER  
ADAMS.obj : error LNK2019: símbolo externo \_GTUNTS@16 sin resolver al que se hac  
e referencia en la función \_A2AD\_MOD\_mp\_UNITCHK  
ADAMS.obj : error LNK2019: símbolo externo \_INFARY@28 sin resolver al que se hac  
e referencia en la función \_A2AD\_MOD\_mp\_AEROINPUT  
ADAMS.obj : error LNK2019: símbolo externo \_INFFNC@24 sin resolver al que se hac  
e referencia en la función \_A2AD\_MOD\_mp\_GETADAEROMARKERS  
ADAMS.dll : fatal error LNK1120: 10 externos sin resolver  
Adams/Solver (User) has been linked…

Microsoft (R) Manifest Tool version 5.2.3790.2075  
Copyright (c) Microsoft Corporation 2005.  
All rights reserved.

mt.exe : general error c10100b1: Failed to load file “ADAMS.dll”. El sistema no  
puede encontrar el archivo especificado.  
[/code]

So do you have any idea about how can I solve this problem?  
Thank you very much,

Nagore

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [March 11, 2015, 3:23pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/106 "2015-03-11T15:23:31Z")

</div>

The linking errors you are getting are all ADAMS routines, which makes me think there is something wrong with some of the paths Adams is using. Actually, looking back at your previous post, it looks like you’re using a 32-bit compiler with 64-bit Adams. You should use the 64-bit platform of the compiler (intel64) so that the libraries are compatible.

---

<div class="post-metadata">

**Author:** ![Nagore.Zestafe](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nagore.Zestafe](https://forums.nlr.gov/u/Nagore.Zestafe)\
**Post date:** [March 25, 2015, 11:03am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/107 "2015-03-25T11:03:53Z")

</div>

Hi Bonnie,

First of all, thanks for your quick answers.  
I have been able to acquire the dll and the library files. But when I try to simulate with Adams the “acf” or “adm” files obtained from the Fast simulation, I get the next errors:

[code]C:\Users\Nagore\Desktop\Fast v7\Prueba 5\>adams2013\_2\_x64

```
 +------------------------------------------------------+
 | | Adams 2013.2 | |
 | ------------------------------------ |
 |Action Selection Code|
 |------ --------------|
 | |
 |Create Adams/Solver with |
 | Adams User-DLL cr-user |
 | |
 |Run Adams/Solver with |
 | Standard Adams executable ru-standard|
 | User executable ru-user |
 | |
 |Pre- or Post-process with |
 | Adams/View aview |
 | Adams/Car acar |
 | Adams/Driveline adriveline |
 | Adams/PostProcessor appt |
 | Adams/Insight ainsight |
 | Adams/Flex Toolkit flextk |
 | Adams/Durability Toolkit durtk |
 | MSC Registry Editor redit |
 | MSC Registry Shell Tool rtool |
 | Custom Memory Model (uconfg_user) cmm |
 +------------------------------------------------------+

 Enter your selection code or EXIT: ru-user

```

Enter name of your Adams/Solver User-DLL, or EXIT:  
ADAMS.dll

Enter the name of the Adams command file or EXIT (=none):  
Test01\_ADAMS.acf

* * *

| .. .. |  
| ####\*. ####. |  
| `###*. `#. MSC Software |  
| `###. #. ------------ | | `##. ## |  
| `##. ## | | `## ##’ A d a m s C++ S o l v e r |  
| #### [Build: 2013.2.0-CL221316] |  
| ###. Version: 2013.2 |  
| ###`#. Patch Version: None | | .### `# |  
| #### `# | | #### #. | | ##### `# [http://www.mscsoftware.com](http://www.mscsoftware.com) |  
| .##### |  
| #####’ |  
| #### |  
| |  
| \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* |  
| \* \* |  
| \* MSC Software Corporation \* |  
| \* \* |  
| \* A d a m s \* |  
| \* \* |  
| \* Automatic Dynamic Analysis of Mechanical Systems \* |  
| \* \* |  
| \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* |  
| \* \* |  
| \* LEGAL INFORMATION \* |  
| \* \* |  
| \* Warning: This computer program is protected by copyright law \* |  
| \* and international treaties. Unauthorized reproduction or \* |  
| \* distribution of this computer program, or any portion of it, \* |  
| \* may result in severe civil and criminal penalties. \* |  
| \* \* |  
| \* Copyright (C) 2013 MSC Software Corporation and its licensors. \* |  
| \* All rights reserved. \* |  
| \* \* |  
| \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* |

| |
| --- |
| |
| \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* |
| \* \* |
| \* Local Time: 2015-03-24 14:28:31 \* |
| \* Host Name: Nagore1 \* |
| \* Uname: MS Windows NT \* |
| \* OS Info: 6.2 \* |
| \* User: Nagore \* |
| \* Customer ID: 0897E1FA-D938F5BC \* |
| \* Current dir: C:\Users\Nagore\Desktop\Fast v7\Prueba 5 \* |
| \* \* |
| \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* |
| |

* * *

command: FILE/MODEL=Test01\_ADAMS, OUTPUT\_PREFIX=Test01\_ADAMS

Running NWTC Subroutine Library (v1.07.02a-mlb, 21-May-2013).

## Running A2AD (v13.01.00a-bjj, 15-Feb-2012).

| Model Title |  
|=============================================================================|  
| |  
| !ADAMS/View model name: FAST certification Test #01: AWT-27CR2 with many DOFs  
wi|

| |
| --- |

command: INTEGRATOR/GSTIFF, ERROR = 0.001, HMAX = 4.000000E-03, INTERPOLATE =  
ON  
command: SIMULATE/DYNAMICS, END = 4.000000E-03, DTOUT = 2.000000E-02

Begin Simulation

\*\*\*\*\*\* Performing Dynamic Simulation using Gstiff I3 Integrator \*\*\*\*\*\*

---- START: WARNING ----  
The data set is kinematically determinate. However, a dynamic analysis  
has been requested. A kinematic analysis with the SIMULATE/KINEMATICS  
command would be more efficient and possibly more accurate for some of  
the computed quantities.  
As requested, the simulation will continue with a dynamic analysis.

---- END: WARNING ----  
The system is modelled with INDEX-3 DAEs.  
The integrator is GSTIFF, CORRECTOR = original  
Integration error = 1.000000E-03

Detected system force units of kilonewtons (kN).

---- START: ERROR ----  
GFOSUB(11010, 1, 1) has been illegally defined. A new functional dependency on  
the measure  
TDISP(4000,1,1) has been encountered during execution.

---- END: ERROR ----

Error calling INFARY for hub position coordinates.

Aborting A2AD.[/code]

I want to make that simulation, so can you help me with the errors I have obtained?  
Thank you very much,

Nagore

---

<div class="post-metadata">

**Author:** ![AhmedJenan.Mostafa](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@AhmedJenan.Mostafa](https://forums.nlr.gov/u/AhmedJenan.Mostafa)\
**Post date:** [March 26, 2015, 2:58pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/108 "2015-03-26T14:58:53Z")

</div>

Hello,

I am trying to install FAST v8 in Linux in a cloud.

I was wondering in which platform it has been tested previously. I have two other questions regarding the make file in the FAST\_V\_8/FAST/Compiling \> compiling folder .

1. Was there any flag used?
2. What were the compiling options used

Thanks.

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [March 26, 2015, 5:38pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/109 "2015-03-26T17:38:42Z")

</div>

I have not tested FAST v8 on Linux. It compiles using gfortran for Windows, but as of yet, the offshore cases do not properly run using gfortran. The \Compiling folder contains a makefile you can use to compile with gfortran; you should be able to use it on Linux with little change. Please read the FAST8 ReadMe and compiling instructions that are distributed in the FAST archive.

---

<div class="post-metadata">

**Author:** ![Nagore.Zestafe](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nagore.Zestafe](https://forums.nlr.gov/u/Nagore.Zestafe)\
**Post date:** [April 12, 2015, 7:32pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/110 "2015-04-12T19:32:05Z")

</div>

Hello Bonnie,

I do not know if you had read my last post. I have been hardly trying to solve my problem, but I have not been able to find a solution.  
The fact is that I created the DLL file with CompileLinkA2AD.bat. And when I try to make a simulation with Adams, I get the next error.

[code]---- START: ERROR ----  
GFOSUB(11010, 1, 1) has been illegally defined. A new functional dependency on  
the measure  
TDISP(4000,1,1) has been encountered during execution.

---- END: ERROR ----

Error calling INFARY for hub position coordinates.

Aborting A2AD.  
[/code]

If you require any further information (the complete code or the versions of the programs I am using) it is detailed in my previous post.  
I am developing my final degree project and I need this simulation to continue with it.  
Thank you very much and I hope you could help me.  
Regards,

Nagore

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [April 13, 2015, 8:12pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/111 "2015-04-13T20:12:36Z")

</div>

Hi, Nagore.

Thanks for drawing my attention to your last post.

I haven’t used Adams in quite some time, so I’m a little rusty with this. But, my first thought is to make sure you are using the Fortran solver (under Adams - Settings, make sure ASolver / solverSelection) is F77. It seems to be complaining about InfAry, which isn’t supported in the C++ solver.

Hope that solves the problem.

---

<div class="post-metadata">

**Author:** ![Nagore.Zestafe](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nagore.Zestafe](https://forums.nlr.gov/u/Nagore.Zestafe)\
**Post date:** [April 14, 2015, 10:32am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/112 "2015-04-14T10:32:59Z")

</div>

Hi Bonnie,

Thank you very much for your answers. I have solved my problem!  
Kind regards,

Nagore

---

<div class="post-metadata">

**Author:** ![Keshan.He](https://avatars.discourse-cdn.com/v4/letter/k/ba9def/32.png) [@Keshan.He](https://forums.nlr.gov/u/Keshan.He)\
**Post date:** [April 18, 2015, 4:00pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/113 "2015-04-18T16:00:48Z")

</div>

Dear all  
I am a beginner. I want to design an controller for wind turbine smart blade( use flaps). The FAST\_SFunc block have 3 control signal inputs (the Generator torque, nacelle yaw, and pitch), now i want to add an flap control signal input to the FAST\_SFunc block. So far as I know, I need to modify FASTSimulink.f90 (add flap control signal input) and AeroSubs.f90 (choose the flap aerodata) , and recompile the mex function. But I met a problem.  
Could FASTSimulink.f90 compile with FAST program package? I could successfully compile the FAST program package by IVF, but when I add FASTSimulink.f90 and FASTGateway.f90 to the IVF project, then compile it, lots of errors occur. I don’t know if FASTSimulink.f90 could compile with FAST program package by IVF, if no, how can I check the modification of program package is correct?

Best regards,  
keshan

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [April 20, 2015, 3:33pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/114 "2015-04-20T15:33:39Z")

</div>

When you use FAST\_SFunc (for FAST v7), you need to compile the FAST source code using MATLAB with the “make\_FAST\_SFunc.m” script found in the Simulink\Source folder of the archive. This will create a dynamic library with a “.mex\*” extension; it is completely separate from the main FAST executable (FAST.exe).

The main FAST program used to generated FAST.exe does not compile with FASTSimulink.f90 or FASTGateway.f90. Those two files are used only when compiling in MATLAB (and are used instead of FAST\_Prog.f90).

---

<div class="post-metadata">

**Author:** ![JeanMarc.Cherfils](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JeanMarc.Cherfils](https://forums.nlr.gov/u/JeanMarc.Cherfils)\
**Post date:** [April 24, 2015, 11:23am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/115 "2015-04-24T11:23:24Z")

</div>

Dear all,

I am performing tests with FAST on Linux and OSX platforms, compiled using gfortran or Intel Fortran Compiler. I mode little modifications on the FAST makefile and on SysGnuLinux.f90 (to allow dll loading).  
I can send you my modified scripts when everything will be ready but I’m still experiencing a problem:

Both Gfortran and Ifort compilations work succesfully and give the same results as Windows executables on certification tests, but when turning on the new TMD module, the gfortran-compiled executable crashes (not the Ifort one), with this output:

```auto

 **************************************************************************************************
 FAST (v8.10.00a-bjj, 31-Mar-2015)

 Copyright (C) 2015 National Renewable Energy Laboratory

 This program comes with ABSOLUTELY NO WARRANTY. See the "license.txt" file distributed with this
 software for details.
 **************************************************************************************************

  Running FAST (v8.10.00a-bjj, 31-Mar-2015), compiled as a 64-bit application using single
  precision
  linked with NWTC Subroutine Library (v2.05.02a-bjj, 25-Feb-2015)

  Heading of the FAST input file:
    FAST Certification Test #18: NREL 5.0 MW Baseline Wind Turbine (Onshore)

  Running ElastoDyn (v1.02.00a-bjj, 31-Mar-2015).

  Running ServoDyn (v1.02.00a-bjj, 31-Mar-2015).

  Running ServoDyn Interface for Bladed Controllers (using GNU Fortran for Linux, 1-May-2013).

  Running TMD (v1.00.00-wgl, 11-March-2015).

  Running AeroDyn (v14.03.01a-bjj, 13-Mar-2015).

  Running InflowWind (v2.01.00a-bjj, 13-Mar-2015).

    Assuming ./NoShr_12.wnd is a formatted HH wind file.
    Processed 3 records of HH data
  Timestep: 0 of 60 seconds.

 FAST_Solution0:CalcOutputs_And_SolveForInputs:SolveOption2:SrvD_CalcOutput:Running with torque
 and pitch control of the NREL offshore 5MW baseline wind turbine from DISCON.dll as written by J.
 Jonkman of NREL/NWTC for use in the IEA Annex XXIII OC3 studies.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

```

and no backtrace…

Does anyone have an idea about the reason of this crash?

Thank you.

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [April 28, 2015, 11:43pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/116 "2015-04-28T23:43:39Z")

</div>

Hi, Jean Marc.

Thanks for reporting this issue. I took a look at it in the gnu debugger (gdb) and it seems similar to the issue preventing us from running models with HydroDyn when compiling with gfortran. It looks like some memory related to the TMD mesh is getting overwritten somehow, and it’s crashing on a call to MeshCopy. I don’t have a solution right now (other than to use Intel Fortran), but I’ll keep looking as I find time.

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [April 30, 2015, 7:29pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/117 "2015-04-30T19:29:00Z")

</div>

Jean Marc,

I was able to track down the issue with Test18 with TMD in gfortran, and have it running on my version of the code. I’ll get this fix in the next FAST release, but meanwhile, I’ve put new source files for ServoDyn and TMD that you can use [here](http://wind.nrel.gov/public/bjonkman/DesignCodes/AlphaVersions/FAST_v8/v8.10.gfortran.fix/).

---

<div class="post-metadata">

**Author:** ![JeanMarc.Cherfils](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JeanMarc.Cherfils](https://forums.nlr.gov/u/JeanMarc.Cherfils)\
**Post date:** [May 4, 2015, 8:38am UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/118 "2015-05-04T08:38:39Z")

</div>

Thank you so much Bonnie!

I will test these routines right now. Do you have the 2.07 registry so I could test my own modules as well?

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [May 4, 2015, 6:32pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/119 "2015-05-04T18:32:43Z")

</div>

Here are some links to archives of the latest version of the Registry:

- [Windows self-executing archive](http://wind.nrel.gov/public/BJonkman/designCodes/alphaVersions/FAST_v8/Registry_v2.07.01.exe)
- [tar.gz for non-Windows systems](http://wind.nrel.gov/public/BJonkman/designCodes/alphaVersions/FAST_v8/Registry_v2.07.01.tar.gz)

---

<div class="post-metadata">

**Author:** ![JeanMarc.Cherfils](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JeanMarc.Cherfils](https://forums.nlr.gov/u/JeanMarc.Cherfils)\
**Post date:** [May 5, 2015, 1:20pm UTC](https://forums.nlr.gov/t/instructions-for-compiling-fast/514/120 "2015-05-05T13:20:03Z")

</div>

Thank you very much, it works.

Here are some tricks to build a version of FAST for linux and/or osx using gfortran or ifort:

Firstly, we need to patch the SysGnuLinux.f90 file (NWTC Library) using:

```auto
@@ -92,7 +92,11 @@
 
 !=======================================================================
    FUNCTION FileSize( Unit )
-
+   
+#ifndef __GFORTRAN__
+ USE IFPORT
+#else
+#endif
 
       ! This function calls the portability routine, FSTAT, to obtain the file size
       ! in bytes corresponding to a file unit number or returns -1 on error.
@@ -149,7 +153,10 @@
 !bjj note: this subroutine is not tested for this compiler
    SUBROUTINE Get_CWD ( DirName, Status )
 
-
+#ifndef __GFORTRAN__
+ USE IFPORT
+#else
+#endif
       ! This routine retrieves the path of the current working directory.
 
 
@@ -433,6 +440,11 @@
 
 ! WRITE (CU,'(1X,A)',ADVANCE='NO') Str
    WRITE (CU,'(A)',ADVANCE='NO') Str
+   
+#ifndef __GFORTRAN__
+ FLUSH(CU)
+#else
+#endif
 
 
    RETURN
@@ -465,10 +477,21 @@
       WRITE (Fmt(5:7),'(I3)') NChars
 
       WRITE (CU,Fmt,ADVANCE='NO') CR, Str
+   
+#ifndef __GFORTRAN__
+ FLUSH(CU)
+#else
+#endif
 
    ELSE
       ! bjj: note that this will almost certainly write more than MaxWrScrLen characters on a line
       WRITE (CU,'(A)',ADVANCE='NO') CR, Str
+   
+#ifndef __GFORTRAN__
+ FLUSH(CU)
+#else
+#endif
+
    END IF
 
 
@@ -524,11 +547,11 @@
    INTEGER(C_INT), PARAMETER :: RTLD_LOCAL=0 ! "This is the converse of RTLD_GLOBAL, and the default if neither flag is specified. Symbols defined in this library are not made available to resolve references in subsequently loaded libraries."
 
 
- ErrStat = ErrID_Fatal
- ErrMsg = ' LoadDynamicLib: Not implemented for '//TRIM(OS_Desc)
-   
-   
-#if 0           
+! ErrStat = ErrID_Fatal
+! ErrMsg = ' LoadDynamicLib: Not implemented for '//TRIM(OS_Desc)
+   
+   
+!#if 0           
 !bjj: note that this is not tested:
    INTERFACE !linux API routines
       !bjj see http://linux.die.net/man/3/dlopen
@@ -582,7 +605,7 @@
       RETURN
    END IF
 
-#endif
+!#endif
    
    RETURN
 END SUBROUTINE LoadDynamicLib
@@ -602,11 +625,11 @@
    INTEGER(C_INT), PARAMETER :: TRUE = 0
 
 
- ErrStat = ErrID_Fatal
- ErrMsg = ' FreeDynamicLib: Not implemented for '//TRIM(OS_Desc)
-   
-   
-#if 0   
+! ErrStat = ErrID_Fatal
+! ErrMsg = ' FreeDynamicLib: Not implemented for '//TRIM(OS_Desc)
+   
+   
+!#if 0   
 !bjj: note that this is not tested.
    INTERFACE !linux API routine
       !bjj see http://linux.die.net/man/3/dlopen
@@ -635,7 +658,7 @@
       ErrStat = ErrID_None
       ErrMsg = ''
    END IF
-#endif
+!#endif
    
    RETURN
 END SUBROUTINE FreeDynamicLib
```

This allows the loading of dlls, and it resolves some portability issues between gfortran and ifort.

Next, here are the compilers options I used to build the code.

- Using gfortran

[code]  
FC = gfortran

F90\_FLAGS = -x f95-cpp-input -ffree-line-length-none -O2 -m64 -finit-local-zero -fno-automatic  
F77\_FLAGS = -x f77-cpp-input -O2 -m64 -finit-local-zero -fno-automatic  
LD\_FLAGS = -O2 -m64 -ldl -finit-local-zero -fno-automatic[/code]

- Using Intel Fortran for Linux

```auto
FC = ifort

F90_FLAGS = -fpp -threads -O2 -mkl:sequential -finline-functions -xhost
F77_FLAGS = -fpp -threads -O2 -mkl:sequential -finline-functions -xhost
LD_FLAGS = -fpp -threads -O2 -I$(MKLROOT)/include -mkl:sequential -finline-functions -xhost
```

Hope this helps someone.

[Previous page](https://forums.nlr.gov/t/instructions-for-compiling-fast/514.md?page=5)

[Next page](https://forums.nlr.gov/t/instructions-for-compiling-fast/514.md?page=7)
