Skip to content

WINDOWS to LINUX compile issues #51

@millerta

Description

@millerta

When compiling code written on Windows, these are some common problems.
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

Long line length is the most common issue and can cause hidden problems.
In some cases there is a long blank string after end of line, remove these.
FIX: split the line and use continuation character.

Suggest using this to find long lines on any file coming from Windows environment:

cat fehmn.f | awk '(length($0) > 72) { print NR ":" $0 }'

Logicals comparison error. FIX with eqv replacing eq

co2ctr.f has many errors, many from lines too long, FIX with continuation.
 1344 |      &     phase_nr(2).eq..false. .and.phase_nr(3).eq..false.) then
      |                                       1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.

Windows close argument not supported. FIX by removing dispose argument ie. close(lu)

avs_io.f:498:28:
  498 |                    close(lu,dispose = 'delete')

new module not recognized. FIX by adding to Makefile.depends

varchk_simple_awh.f:17:9:
   17 |       use commass_AWH
      |         1
Fatal Error: Cannot open module file ‘commass_awh.mod’ for reading at (1): No such file or directory
compilation terminated.

Makefile.depends example for modules:
Add modulename.o to files that contain the mod name
Add modulename.mod: filename.o

varchk_simple_awk.o: commass_AWH.o
commass_AWH.mod: commass_AWH.o

New files with modules will need to be added to Makefile.depends.

grep use innondarcy.f
innondarcy.f:      use comdi
innondarcy.f:      use comdti
innondarcy.f:      use comai
innondarcy.f:      use comki
innondarcy.f:      use com_nondarcy

Edit Makefile.depends

innondarcy.o: comdi.o cmodti.o comai.o cmoki.o com_nondarcy.o
com_nondarcy.mod: com_nondarcy.o

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions