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

156.5. eigen-5.0.1

Header-only C++ linear algebra library (nextpnr's timing analysis uses it)

Version 5.0.1, release 1
Shelf sci-libs — Numerical and scientific-data libraries, and the unprefixed core Python science stack
Phase 41_system (System), 245 of 1047 in build order
Licence MPL-2.0 AND BSD-3-Clause AND Apache-2.0 AND Minpack
Homepage https://eigen.tuxfamily.org/
Build time 0.2 SBU
Installed size 9.5 MiB in 610 files
Recipe ports/core/sci-libs/eigen/kpkgbuild

About

Eigen is a C++ template library for linear algebra: dense and sparse matrices, vectors, decompositions and solvers, all in headers. Nothing is compiled for it to be used; a consumer includes it from /usr/include/eigen3 and the code is generated in that consumer. In KDOS it is built into blender, freecad, krita, opencv, vtk, cgal, ceres-solver and nextpnr, among others. The build only configures and installs the headers, the CMake package files and the pkg-config file.

Sources

Dependencies

Depends on: cmake, ninja.

Required by (25): analitza, avogadrolibs, blender, calligra, celestia, ceres-solver, cgal, coolprop, digikam, freecad, gmsh, ifcopenshell, kalzium, krita, labplot, movit, nextpnr, openbabel, opencv, openscad, pdal, prusaslicer, solvespace, step, vtk.

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 eigen'

What kpkg does

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

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/eigen
echo 'e4de6b08f33fd8b8985d2f204381408c660bffa6170ac65b68ae1bd3cd575c0a  eigen-5.0.1.tar.bz2' | 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/eigen
SRC=$SRC_ROOT/eigen-5.0.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf eigen-5.0.1.tar.bz2 -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:

mkdir -p build && cd build
cmake .. -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DBUILD_TESTING=OFF \
	-DEIGEN_BUILD_DOC=OFF \
	-DEIGEN_BUILD_BLAS=OFF \
	-DEIGEN_BUILD_LAPACK=OFF \
	-DEIGEN_BUILD_DEMOS=OFF \
	-DEIGEN_BUILD_PKGCONFIG=ON
ninja
DESTDIR=$PKG ninja 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/eigen, 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 eigen-5.0.1-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/eigen, and runs the triggers its paths call for.

Contents

Installed directories: /usr/include/eigen3, /usr/share/eigen3, /usr/share/licenses/eigen.

Short descriptions

eigen3.pc A C++ template library for linear algebra: vectors, matrices, and related algorithms