Compiling DISCON.F90 on Linux

This forum if for discussing controls. Questions about how to implement controls in FAST are more appropriate to the CAE Tools forum.

Moderator: Bonnie.Jonkman

Vishal.Sairam
Posts: 37
Joined: Mon Aug 10, 2020 7:50 am
Organization: Power Curve ApS
Location: Denmark

Compiling DISCON.F90 on Linux

Postby Vishal.Sairam » Tue Dec 08, 2020 8:58 am

Greetings,

I am in the process of setting up openFAST on a Linux based cluster, and I am facing some problems in trying to compile the DISCON.F90 file using gfortran for Linux. I am using gcc version 4.9.3.

In the terminal, I navigate to the location of the DISCON.F90 source file, and then I type -

gfortran DISCON.F90 -o DISCON.dll , but I get the following error :

DISCON.F90:18:0: warning: \u2018dllexport\u2019 attribute directive ignored [-Wattributes]
SUBROUTINE DISCON ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND (C, NAME='DISCON')
^
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

Apologies if this has already been asked before, I was not able to find it.

I would be very grateful for help in this matter. Thanks in advance.

Best regards,
Vishal

Bonnie.Jonkman
Posts: 575
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: Compiling DISCON.F90 on Linux

Postby Bonnie.Jonkman » Tue Dec 08, 2020 9:57 am

You need to tell it to build a shared library, otherwise it thinks it is a standalone executable that needs a main() routine. Try

Code: Select all

gfortran DISCON.F90 -shared -DIMPLICIT_DLLEXPORT -o DISCON.dll

(Or maybe you want a different file extension for linux?)

Alternatively, the DLLs can be built using cmake. See https://github.com/openfast/r-test#note ... line-cases
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Vishal.Sairam
Posts: 37
Joined: Mon Aug 10, 2020 7:50 am
Organization: Power Curve ApS
Location: Denmark

Re: Compiling DISCON.F90 on Linux

Postby Vishal.Sairam » Tue Dec 08, 2020 11:18 am

Dear Bonnie,

Thank you, that fixed the problem!

Best regards,
Vishal


Return to “Controls”

Who is online

Users browsing this forum: No registered users and 1 guest