I compiled XFoil earlier today for my Mac. XFoil is an open-source airfoil analysis tool. There are various compiled binaries available for Windows systems, but for Unix computers, including Mac OS X, it must be built from the source code. This requires the use of a Fortran compiler. To build it on my Intel-based Mac (10.4.8), I made use of the GCC’s gfortran compiler, available here along with several other Mac Fortran compilers and other interesting stuff.
The gfortran utility can be installed in its default location of /usr/local/bin. This location is not included in the executable search path by default, so you will need to modify your PATH environment variable. I use the default BASH shell, which looks for the file .profile in your home directory. You can add the following line to that file (creating it if it does not already exist) to add to the PATH variable:
export PATH=$PATH:/usr/local/bin
You will now be able to compile XFoil. There are various items you will need to compile. You can just follow the Readme file. It will tell you to modify your Makefile to set the compiler and flags appropriately. In this case, you will set the compiler (FF) to gfortran. Unfortunately, the makefiles are not all commented properly, so you will need to make sure you edit the last definition of FF. If you try to compile and you get an error saying ifort is not a recognized command, this is because you have not set the last entry. Also, some of the makefiles include a file config.make, which also defines FF. If this is the case, that file is the place to modify it.
The steps taken so far should allow you to compile all the files. However, when the linker then attempts to join the files into an executable or library, for some of them you will get an error saying ___dso_handle is an undefined symbol. Apparently this is a problem with the gfortran compiler. You can get rid of it by adding as a compiler flag:
-mmacosx-version-min=10.5
I don’t know why this works or what it actually does, but it should get rid of the linking error, allowing you fully compile the software. I have compiled XFoil previously on a PPC mac, using the g77 compiler, and encountered some slightly different problems. I will make another post to show how that works.
To compile AVL, a vortex lattice code by the same author, you will need to folow the same steps. Additionally, you will need to make a small change in the aplotmd.f file. Open it and do a search for “CLOCKX”. This is a function supported by Intel Fortran compilers. However, you will see just below this call that an alternative for other compilers is present but commented out. Comment out the CLOCKX stuff, and uncomment the SECNDS call. This will now compile and link correctly with gfortran.
There is no equivalent term to -r8 to force double precision with gfortran/g77?
There actually is. gfortran supports the -fdefault-double-8 and -fdefault-real-8 (as well as -fdefault-integer-8) to set the default sizes of DOUBLE PRECISION and REAL (and INTEGER), respectively. I’m not sure about g77.
Should I have your compiled version of xfoil? where I should find it?