Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

156.4. fftw-3.3.11

Fast Fourier transform library

Version 3.3.11, release 1
Shelf sci-libs — Numerical and scientific-data libraries, and the unprefixed core Python science stack
Phase 41_system (System), 136 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://www.fftw.org/
Build time 8.0 SBU
Installed size 9.2 MiB in 54 files
Recipe ports/core/sci-libs/fftw/kpkgbuild

About

FFTW computes discrete Fourier transforms of any size and dimension. Its consumers in KDOS include pipewire, alsa-utils, ardour, gnuradio, hackrf, imagemagick, krita and octave. FFTW builds one floating-point precision per configure run, so build.sh configures, builds and installs three times into the same package: double precision (libfftw3), single (libfftw3f) and long double (libfftw3l), each with its threads and OpenMP companion libraries.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/sci-libs.txt:

Three precisions, three configure runs: double for octave and scipy, single for every SDR and audio path, long double for a few C2 solvers.

Sources

Dependencies

Depends on: gcc.

Required by (35): alsa-utils, ardour, aubio, blender, chromaprint, furnace, gnuradio, gr-iqbal, hackrf, imagemagick, inspectrum, js8call, krita, kwave, labplot, libdab, libosmo-dsp, libvips, liquid-dsp, lmms, mlt, movit, ngspice, octave, pipewire, powder-toy, qsstv, rawtherapee, rubberband, satdump, sdrangel, sdrpp, shotcut, strawberry, wsjtx.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install fftw'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sci-libs/fftw.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/sci-libs/fftw
echo '5630c24cdeb33b131612f7eb4b1a9934234754f9f388ff8617458d0be6f239a1  fftw-3.3.11.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/fftw
SRC=$SRC_ROOT/fftw-3.3.11
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf fftw-3.3.11.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

FORTRAN="--enable-fortran F77=gfortran"
COMMON="--prefix=/usr --libdir=/usr/lib --disable-static --enable-shared
        --enable-threads --enable-openmp --enable-sse2 --enable-avx --enable-avx2
        --enable-avx512 $FORTRAN"

./configure $COMMON
make
make DESTDIR=$PKG install
make clean

./configure $COMMON --enable-float
make
make DESTDIR=$PKG install
make clean

./configure --prefix=/usr --libdir=/usr/lib --disable-static --enable-shared \
	--enable-threads --enable-openmp --enable-long-double $FORTRAN
make
make DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/fftw, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf fftw-3.3.11-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/fftw, and runs the triggers its paths call for.

Contents

Installed programs: fftw-wisdom, fftw-wisdom-to-conf, fftwf-wisdom, fftwl-wisdom.

Installed libraries: libfftw3.so, libfftw3_omp.so, libfftw3_threads.so, libfftw3f.so, libfftw3f_omp.so, libfftw3f_threads.so, libfftw3l.so, libfftw3l_omp.so, libfftw3l_threads.so.

Installed directories: /usr/lib/cmake/fftw3, /usr/share/licenses/fftw.

Short descriptions

fftw-wisdom create wisdom (pre-optimized FFTs)
fftw-wisdom-to-conf generate FFTW wisdom (pre-planned transforms)
fftwf-wisdom create wisdom (pre-optimized FFTs)
fftwl-wisdom create wisdom (pre-optimized FFTs)
fftw3.pc fast Fourier transform library
fftw3f.pc fast Fourier transform library
fftw3l.pc fast Fourier transform library

Notes

The third configure line is written out rather than built from $COMMON because it must leave out the four SIMD switches. FFTW’s SIMD code exists for single and double precision only, and configure stops with “SSE2 requires single or double precision” (and the same for each AVX switch) when one is given with --enable-long-double.

make clean between the runs is what keeps the second and third builds from linking objects compiled for the precision before. All three runs install into the same $PKG, and their files differ in name by the f and l suffixes, so none overwrites another’s library. The headers, fftw3.h and the Fortran include files, do not depend on the precision and are installed three times over.