These are the steps that I went through to build Xfoil using double point precision on Fedora 12. I used the gcc and gfortran compilers, and if you choose to use different ones, then some of the compiler flags may be different. Before trying to build Xfoil, run the command sudo yum groupinstall “Development Tools”. Not everything downloaded from the development group is needed to install Xfoil. Alternatively, you can try to individually install the certain packages that are needed just to build Xfoil.
To get started first download the source file from http://web.mit.edu/drela/Public/web/xfoil/. Extract the source tar file, cd into the directory Xfoil, and then follow the steps below.
Step 1 – Build the Orrs-Summerfield Database
Use cd to switch into the Xfoil/orrs/ directory and then run pwd. Copy the ouput from pwd, and then cd into the src/ directory. Edit the file osmap.f and look for the line DATA OSFILE / ‘/var/local/codes/orrs/osmap.dat’ /. Change this line to DATA OSFILE / ‘{Output from pwd}/osmap.dat’ /, where {Output from pwd} is what was just copied before.
Now run cd ../bin/ and edit the make file, MakeFile_DP. Make the following changes to that file.
- Change FC = f77 to FC = gfortran.
- Change FLG = -O -r8 to FLG = -O -fdefault-real-8 -fdefault-double-8.
- Look for the line # Uncomment for Intel Fortran Compiler, and then comment out everything related to the Intel compiler.
Then run the following commands:
[brad@localhost ~]$ make -f Makefile_DP osgen
[brad@localhost ~]$ make -f Makefile_DP osmap.o
[brad@localhost ~]$ cd ..
[brad@localhost ~]$ bin/osgen osmaps_ns.lst
Step 2 – Build the Plot Library
Use the cd command to switch to the Xfoil/plotlib/ directory. Open up the make file and then make the following changes.
- Find the line PLTLIB=libPlt.a. Comment out this line and uncomment the line below it, which should read PLTLIB = libPltDP.a.
- Find the section Default compilers and flags, install commands, and change the default compilers by setting FC = gfortran and CC = gcc.
- Find the line DP = -r8 and replace it with DP = -fdefault-real-8 -fdefault-double-8. Make sure it is uncommented.
- Comment out the line include ./config.make.
Save and close the make file, and then run the make from the terminal.
Step 3 – Make Programs in /bin
Now switch to the Xfoil/bin/ directory, and open up the make file. Then make the following changes.
- Set the BINDIR equal to /usr/local/bin (BINDIR = /usr/local/lib).
- Find the line PLTOBJ = ../plotlib/libPlt.a and comment it out.
- Find the line ### Default compilers and flags.
- Change FC = f77 to FC = gfortran.
- Change CC = cc to CC = gcc.
- Comment out the FFLAGS and FFLOPT variables.
- Look for the line ### Intel Fortran Compiler, and then comment out the next few lines for this compiler. They are not needed.
- Find the line ###Double precision option.
- Change FFLAGS = -O -r8 -CB to FFLAGS = -O -fbounds-check -fdefault-real-8 -fdefault-double-8.
- Change FFLOPT = -O -r8 -CB to FFLOPT = -O fbounds-check -fdefault-real-8 -fdefault-double-8.
- Comment out the second set of FFAGS and FFLOPT. These variables only need to be set once.
If you try to compile at this point you will get most likely get the following error.
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xoper.f
../src/xoper.f:117.22:
IINPUT(I) = 2**31
1
Error: Arithmetic overflow at (1)
make: *** [xoper.o] Error 1
There are two errors in the source code that need to be fixed. The first one is in the file pplot.f and the second one is in the file xoper.f. Running the following commands should fix these problems. Note that before running the sed commands you want to be in the Xfoil/src/ directory.
[brad@localhost Xfoil]$ cd src/
[brad@localhost src]$ sed -i ‘s/LOGICAL ERROR, LGETFN/LOGICAL ERROR, LGETFN, LERR/g’ pplot.f
[brad@localhost src]$ sed -i ‘s/IINPUT(I) = 2\*\*31/IINPUT(I) = HUGE(0)/g’ xoper.f
Then change back to the Xfoil/bin/ directory and run make.
[brad@localhost bin]$ make xfoil
[brad@localhost bin]$ make pplot
[brad@localhost bin]$ make pxplot
After I compiled everything, the xfoil command was not moved into /usr/local/bin. This can be done manually by running sudo cp xfoil /usr/local/bin/.
Thanks a lot for the installing infos. It took me days to figure out the errors in the past, new users are lucky now with the help of your blog
Hi, thanks a lot for the useful infos.
But I still have some problems, when i run the “sed” commands I get the following errors:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sed -i ‘s/LOGICAL ERROR, LGETFN/LOGICAL ERROR, LGETFN, LERR/g’ pplot.f –>
–> sed: espressione -e #1, carattere 1: comando sconosciuto: `�’
where in Italian “espressione” stands for “expression”, “carattere” for “character” and “comando sconosciuto” means “unknown command”
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sed -i ‘s/IINPUT(I) = 2\*\*31/IINPUT(I) = HUGE(0)/g’ xoper.f –>
–> bash: errore di sintassi vicino il simbolo non atteso “(”
which in Italian means ” syntax error near the non-expected symbol “)” ”
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
May these problems be related to the fact I’m trying to run it under Ubuntu instead of Fedora?
Can someone help me? Thanks a lot for your patience…
It’s not too hard to edit these files yourself. The sed commands were just supposed to make things easier. Open up the file pplot.f and find the line that reads “LOGICAL ERROR, LGETFN”. Replace this line with “LOGICAL ERROR, LGETFN, LERR”. Then open the file xoper.f and look for the line that reads “IINPUT(I) = 2**31″. Replace this line with “IINPUT(I) = HUGE(0)”.
Thank you very much! That’s exactly what I needed (unfortunately, I’m not very expert with “sed” commands), now everything is working fine.
Only a last comment: I had to repeat 3 times the “make” command for xfoil, because of some other compilation errors:
1st attempt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fio@fio-laptop:~/Scaricati/Xfoil/bin$ sudo make xfoil
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xoper.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xtcam.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xgdes.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xqdes.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xmdes.f
gfortran -c -O fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xsolve.f
gfortran: fbounds-check: Nessun file o directory
make: *** [xsolve.o] Errore 1
2nd attempt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fio@fio-laptop:~/Scaricati/Xfoil/bin$ sudo make xfoil
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xbl.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xblsys.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xpol.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xplots.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/pntops.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xgeom.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xutils.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/modify.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/blplot.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/aread.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/naca.f
gfortran -c -O -fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/spline.f
gfortran -c -O fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/dplot.f
gfortran: fbounds-check: Nessun file o directory
make: *** [dplot.o] Errore 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The 3rd attempt was finally successful. Maybe this could reveal useful to someone other…
Hello,
your tutorial on installing Xfoil on Fedora is very helpful. We have in our lab a few Linux and Windows computers.
Do you think you can write one about compiling Xfoil for Windows ? The Xfoil binary from the MIT webpage is for 6.96 and not for the last version of Xfoil.
A tutorial for compiling Xfoil 6.97 with Msys + gcc + gfortran or Intel Fortran + Visual Studio 2008 will be much appreciated since there is no 6.97 binary on Internet or a description of how to do the compilation.
Thanks
I think I can do that, but I probably won’t get to it for a while. I’ll probably reinstall Xfoil on windows in a month or so for next semester since it got wiped when I installed Fedora 13.
Hello again,
(this applies to Xfoil 6.97 build on Ubuntu 9.04 64 bits, but I’m sure the bug is present on Fedora too)
I think I’ve found a bug in osgen, if you build your Makefile with
-O -fbounds-check -fdefault-real-8 -fdefault-double-8
you will see a lot of errors when you try to execute osgen.
The problem can be found in spline.f:
try to add this line in spline.f then recompile osgen (with no -fbounds-check) and you will see what I mean:
IF(N.GT.NMAX) STOP ‘SPLINE: array overflow, increase NMAX’
print*,’N=’,N,X(2)-X(1)
When N=1 you will see a lot of NaN.
I wonder is this error has something to do with how Fortran reads in the ASCII files from which osgen builds osmap.dat.
All the best
Dear Brad,
after following all you instructions I still get this error when I compile with make xfoil:
gfortran -c -O fbounds-check -fdefault-real-8 -fdefault-double-8 ../src/xpanel.f
gfortran: error: fbounds-check: No such file or directory
make: *** [xpanel.o] Error 1
I hope you can help me!!!
Thanks in advance,
Elia