Compiling Xfoil

Compiling Xfoil https://web.mit.edu/drela/Public/web/xfoil/ failed with the following message:

lfortran -c -O -fbounds-check --fixed-form   ../src/xfoil.f
tokenizer error: Expecting terminating symbol for program
  --> ../src/xfoil.f:25:7
   |
25 |       INCLUDE 'XFOIL.INC'
   |       ^


Note: Please report unclear, confusing or incorrect messages as bugs at
https://github.com/lfortran/lfortran/issues.
make: *** [Makefile:164: xfoil.o] Error 1

Am I missing something?

lfortran --version
LFortran version: 0.61.0
Status: alpha (expected to fail on third-party codes)
Platform: Linux
LLVM: 19.1.1
Default target: x86_64-conda-linux-gnu
LSP Version: 3.17.0
JSON_RPC Version: 2.0
1 Like

Welcome to the Forum!

You should note that lfortran is still very much under development and it may be that the old construct “INCLUDE” is not supported. You may have better luck by either using a different compiler like gfortran or ifx, which do support the FORTRAN 77 style construct you have encountered or turning the include file into a module.

I think @Arjen already gave you the most probable reason why ‘INCLUDE’ doesn’t seem to work (LFortran’s support of some older features is not yet on the same level of maturity as that of the more recent Fortran features).

You may wish to try substituting INCLUDE 'XFOIL.INC' by #include "XFOIL.INC", though, since LFortran does support C-style preprocessing with the --cpp compiler flag.

@oroppas thanks for the bug report, I was able to reproduce it and I just fixed it in Fix INCLUDE statement handling in fixed-form Fortran by certik ¡ Pull Request #11035 ¡ lfortran/lfortran ¡ GitHub.

We support include, but didn’t support it in fixed-form, which I now fixed.

We now support all Fortran features (except coarrays and length PDT), but they can still have bugs like the one you encountered. Modern Fortran in free-form works pretty well, some old F77 features might not be implemented yet (if so, please report it), also the fixed-form parser sometimes has bugs, but if you report them (ideally as a standalone minimal reproducible example), then we’ll fix them quickly. Regarding compiling third-party codes, right now our status is expressed in the version information you printed above (Status: alpha (expected to fail on third-party codes)). So expected to fail, but it might not be difficult to fix all bugs to get it working, depending on the code. If you are interested, please report all bugs and we’ll fix them all.

1 Like

Some of these comments are a little confusing. INCLUDE was not an f77 feature. It was an extension of many f77 compilers, but it was not a standard feature. INCLUDE was part of f90, and remains standard even now with f2023 (in section 6.4).

1 Like

Yes. That’s why we only supported it in free-form, because F77 codes in fixed-form wouldn’t use it as much, but clearly they do. Anyway, it’s fixed in the latest LFortran main.

3 Likes