FFTW FAQ - Section 2
Installing FFTW


Question 2.1. Which systems does FFTW run on?

FFTW is written in ANSI C, and should work on any system with a decent C compiler. (See also Q2.2 `Does FFTW run on DOS/Windows?' and Q2.3 `My compiler has trouble with FFTW.'.)

Question 2.2. Does FFTW run on DOS/Windows?

It should. FFTW was not developed on DOS or Windows, but the source code is straight ANSI C. Some users have reported using FFTW on DOS/Windows using various compilers. See also the FFTW Windows installation notes and Q2.3 `My compiler has trouble with FFTW.'

Question 2.3. My compiler has trouble with FFTW.

Complain fiercely to the vendor of the compiler.

FFTW is a heavily-optimized piece of software that is likely to push compilers to their limits. We had no problems with, for example, gcc 2.7.2, egcs 1.1.x, Sun's SC4.0, and IBM's XLC. Users have also reported successful compilations of FFTW using Borland's C/C++ compilers on Windows.

The Portland Group PGCC compiler, version 4.0 for Linux/x86, reportedly produces incorrect code for FFTW 2.1.3.

Visual C++ 4.0 crashes when compiling FFTW 1.2 with all optimizations turned on. Visual C++ 5.0 reportedly produces incorrect code for the real transforms in FFTW 2.x when the option "Maximize speed" is set. We are told that Service Pack 3 fixes the bug.

Metrowerks CodeWarrior Pro 4 reportedly generates incorrect code for the PowerPC when compiling FFTW at optimization level 4. Supposedly, this bug is fixed in CW Pro 5 with all the latest updates applied. (No problems were reported for previous versions.)

Various problems have also been observed with SGI's MIPSpro compilers, versions 7.2.0 and 7.2.1 (you may have to lower the optimization level for some files to get them to compile); the bug seems to be fixed in version 7.3. The test program in earlier versions of FFTW had problems with the -xO5 option in Sun's SC4.0 C compiler. egcs 1.0.2 produced incorrect code for FFTW on the PowerPC (corrected in egcs 1.1).

The DEC C compiler, V5.8-009 on Digital UNIX V4.0 (Rev. 1091) is known to have bugs with its EV6 tuning. Specifically, compiling FFTW with -arch host (the default) or -arch ev6 on an Alpha EV6 can cause FFTW (e.g. fftw_test -s 256) to crash.

Question 2.4. FFTW does not compile on Solaris, complaining about const.

We know that at least on Solaris 2.5.x with Sun's compilers 4.2 you might get error messages from make such as

"./fftw.h", line 88: warning: const is a keyword in ANSI C

This is the case when the configure script reports that const does not work:

checking for working const... (cached) no

You should be aware that Solaris comes with two compilers, namely, /opt/SUNWspro/SC4.2/bin/cc and /usr/ucb/cc. The latter compiler is non-ANSI. Indeed, it is a perverse shell script that calls the real compiler in non-ANSI mode. In order to compile FFTW, change your path so that the right cc is used.

To know whether your compiler is the right one, type cc -V. If the compiler prints ``ucbcc'', as in

ucbcc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2

then the compiler is wrong. The right message is something like

cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2

Question 2.5. Which language is FFTW written in?

FFTW is written in ANSI C. Most of the code, however, was automatically generated by a program called genfft, written in the Objective Caml dialect of ML. You do not need to know ML or to have an Objective Caml compiler in order to use FFTW.

genfft is provided with the FFTW sources, which means that you can play with the code generator if you want. In this case, you need a working Objective Caml system. Objective Caml is available from ftp.inria.fr in the directory /lang/caml-light.

Question 2.6. Can I call FFTW from FORTRAN?

Yes, but not directly. The main problem is that Fortran cannot pass parameters by value. However, FFTW can be called indirectly from Fortran through the use of special C "wrapper" routines. Appropriate wrapper code, documented in the FFTW manual, is included with FFTW (versions 1.3 and higher).

By default, FFTW configures its wrapper routines to work with the first compiler it finds, e.g. g77. To configure for a different, incompatible Fortran compiler foobar, use ./configure F77=foobar when installing FFTW.

Question 2.7. Can I call FFTW from C++?

Most definitely. FFTW should compile and run under any C++ compiler.

Question 2.8. Why isn't FFTW written in FORTRAN/C++?

Because we don't like those languages, and neither approaches the portability of C.

Question 2.9. How do I compile FFTW to run in single precision?

On a Unix system: configure --enable-float. On a non-Unix system: edit fftw/fftw.h to #define the symbol FFTW_ENABLE_FLOAT. In both cases, you must then recompile FFTW.
Next: Using FFTW.
Back: Introduction and General Information.
Return to contents.

Matteo Frigo and Steven G. Johnson / fftw@fftw.org - 19 January 2022

Extracted from FFTW Frequently Asked Questions with Answers, Copyright © 2022 Massachusetts Institute of Technology.