simfish:

FeniCSX-GNU/Guix Packaging Notes

This workflow,fenicsx.dev.org consists of build tools and notes for compiling FEniCSx project from source and packaging it for the GNU/Guix package manager. – https://fenicsproject.org

Introduction

This is not the official GNU/Guix distribution of the FenicsX project. As of writing this build guide, FeniCSX is not available in the official GNU/Guix channel. The version available, FeniCS 2019, currently fails to build and install. This project is a workaround to make the latest FeniCSX project available on GNU/Guix.

Getting Started

To make FeniCSX available locally subscribe to the distroconfig channel by adding the code snippet below to your channel configuration file ~/.config/guix/channels.scm

(cons* (channel
        (name 'distroconfig)
        (url "https://gitlab.com/aarongile/distroconfig.git")
	    (branch "main")
        (introduction
        (make-channel-introduction
	      "e398ff405d3d013b92e58bd63157932874a5e308"
          (openpgp-fingerprint "A3C4 F513 81D0 FBBB EA61  31CF CF81 957B 3875 3EBD"))))

   %default-channels)

Run guix pull, to refresh the Guix package database.

guix pull

At this point FeniCSX should be available like any other Guix package. For example, to install python-fenicsx-dolfinx into the default Guix profile run,

guix package install python-fenicsx-dolfinx

The available FeniCSX and supporting components are,

Project packages comments
FeniCSX ufl Both python and C++ interfaces pass build.
basix Some tests are still failing
python-basix
ffcx
dolfinx
python-dolfinx
metis metis32 and metis64 separate packages for 32 and 64
bit integer support.
ParMETIS parmetis and python-parmetis - C++ and python variants rsp.
- Note: evaluation only license :(
nanobind nanobind-v2.5 The official Guix package is at
version 2.4 and has build issues.

To spawn a pre-configured simulation shell run,

guix ld fenicsx

Building Configuration

The Guix source files are located <repo>/guix directory of the distroconfig(this project) repository. To start hacking, clone the repository,

git clone https://gitlab.com/aarongile/distroconfig.git

And start a build environment using,

guix ld fenicsx.dev

The command will load this document, which will setup a Guix container that is configured with the following options,

# container
--container
# enable networking
--network
# make guix command available inside build environment
--nesting

The guix source path, <repo>/guix is also mapped and made available as ~/src inside the container.

--share=${LITDOC_ORGDIR}/../../../guix=/home/user/src

Finally the long list of FeniCSX project build dependencies are made available using the manifest below,

(specifications->manifest
 (list  ;; system deps
  "nss-certs"
  "git"
  "pkg-config"

  ;; build tools
  "cmake"
  "cmake-minimal"
  "make"
  "ninja"
  "python-scikit-build-core"
  "python-scikit-build"
  "python-nanobind"
  "python-pip"
  "python-wheel"
  "python-setuptools"

  ;; c++ toolchain
  "gcc-toolchain"
  "gfortran-toolchain"

  ;; libraries(c++)
  "boost"
  "eigen"
  "hdf5-parallel-openmpi"
  "gklib"
  "openblas"
  "openmpi"
  "slepc-openmpi"
  "slepc-complex-openmpi"
  "petsc-openmpi"
  "petsc-complex-openmpi"

  "pugixml"
  "metis@5.2.1"
  "spdlog"

  ;;python
  "python"
  "python-cffi"
  "python-numpy"

  ;;testing(python)
  "python-pytest"
  "python-sympy"
  "python-scipy"
  "python-matplotlib"
  ))

Build Commands

Once inside the container use guix build command to the build,

 guix build -L ./src python-dolfinx

If all goes well, the package will be available within the build environment.

Debugging

To debug build failures use --keep-failed option of guix build command to keep build files, artifacts, and environment settings, which are useful for pin pointing error sources.

 guix build --keep-failed -L src python-dolfinx

Reporting Bugs

Please use https://gitlab.com/aarongile/distroconfig/-/issues to report issues.