# 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 pageref:runOnWindows::' and pageref:compilerCrashes::'.) FFTW can also take advantage of certain hardware-specific features, such as cycle counters and SIMD instructions, but this is optional.

## Question 2.2. Does FFTW run on Windows?

It should. FFTW was not developed on Windows, but the source code is essentially straight ANSI C. Many users have reported using FFTW 2 in the past on Windows with various compilers; we are currently awaiting reports for FFTW 3. See also the FFTW Windows installation notes and pageref:compilerCrashes::'

## Question 2.3. My compiler has trouble with FFTW.

Complain fiercely to the vendor of the compiler.

FFTW is likely to push compilers to their limits. We have successfully used `gcc` 3.2.x on x86 and PPC, a recent Compaq C compiler for Alpha, version 6 of IBM's `xlc` compiler for AIX, Intel's `icc` versions 5-7, and Sun WorkShop `cc` version 6. Several compiler bugs have been exposed by FFTW, however. A partial list follows.

`gcc` 2.95.x for Solaris/SPARC produces incorrect code for the test program (workaround: recompile the `libbench2` directory with `-O2`).

NetBSD/macppc 1.6 comes with a `gcc` version that also miscompiles the test program. (Please report a workaround if you know one.)

`gcc` 3.2.3 for ARM reportedly crashes during compilation. (Please report a workaround if you know one.)

Intel's `icc-7.1` compiler build 20030402Z appears to produce incorrect dependencies, causing the compilation to fail. `icc-7.1` build 20030307Z appears to work fine. (Use `icc -V` to check which build you have.) As of 2003/04/18, build 20030402Z appears not to be available any longer on Intel's website, whereas the older build 20030307Z is available.

`ranlib` of GNU `binutils` 2.9.1 on Irix has been observed to corrupt the FFTW libraries, causing a link failure when FFTW is compiled. Since `ranlib` is completely superfluous on Irix, we suggest deleting it from your system and replacing it with a symbolic link to `/bin/echo`.

If support for SIMD instructions is enabled in FFTW, further compiler problems may appear:

`gcc-3.2` for x86 produces incorrect SIMD code if `-O3` is used. The same compiler produces incorrect SIMD code if no optimization is used, too. When using `gcc-3.2`, it is a good idea not to change the default `CFLAGS` selected by the `configure` script.

Some 3.0.x and 3.1.x versions of `gcc` on `x86` may crash. `gcc` so-called 2.96 shipping with RedHat 7.3 crashes when compiling SIMD code. In both cases, please upgrade to `gcc-3.2`.

Intel's `icc` 6.0 misaligns SSE constants, but FFTW has a workaround.

`gcc` 2.95 on MacOS X miscompiles AltiVec code (fixed in later versions). `gcc` 3.2.x miscompiles AltiVec permutations, but FFTW has a workaround.

## 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. What's the difference between `--enable-3dnow` and `--enable-k7`?

`--enable-k7` enables 3DNow! instructions on K7 processors (AMD Athlon and its variants). K7 support is provided by assembly routines generated by a special purpose compiler.

`--enable-3dnow` enables generic 3DNow! support using `gcc` builtin functions. This works on earlier AMD processors, but it is not as fast as our special assembly routines.

## Question 2.6. What's the difference between the fma and the non-fma versions?

The fma version tries to exploit the fused multiply-add instructions implemented in many processors such as PowerPC, ia-64, and MIPS. The two FFTW packages are otherwise identical.

Definitely use the fma version if you have a PowerPC-based system with `gcc`. This includes all GNU/Linux systems for PowerPC and all MacOS X systems.

Definitely do not use the fma version if you have an ia-32 processor (Intel, AMD, etcetera).

On other architectures, the situation is not so clear. For example, ia-64 has the fma instruction, but `gcc-3.2` appears not to exploit it correctly. Other compilers may do the right thing, but we have not tried them. Please send us your feedback so that we can update this FAQ entry.

## Question 2.7. 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 the Caml web page.

## Question 2.8. Can I call FFTW from Fortran?

Yes, FFTW (versions 1.3 and higher) contains a Fortran-callable interface, documented in the FFTW manual.

By default, FFTW configures its Fortran interface 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. (In the case of `g77`, however, FFTW 3.x also includes an extra set of Fortran-callable routines with one less underscore at the end of identifiers, which should cover most other Fortran compilers on Linux at least.)

## Question 2.9. Can I call FFTW from C++?

Most definitely. FFTW should compile and/or link under any C++ compiler. Moreover, it is likely that the C++ `<complex>` template class is bit-compatible with FFTW's complex-number format (see the FFTW manual for more details).

## Question 2.10. Why isn't FFTW written in Fortran/C++?

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

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

On a Unix system: `configure --enable-float`. On a non-Unix system: edit `config.h` to `#define` the symbol `FFTW_SINGLE` (for FFTW 3.x). In both cases, you must then recompile FFTW. In FFTW 3, all FFTW identifiers will then begin with `fftwf_` instead of `fftw_`.

Back: .
Return to contents.

Extracted from FFTW Frequently Asked Questions with Answers, Copyright © 2003 Matteo Frigo and Massachusetts Institute of Technology.