Reanimator

David Himmelstrup’s reanimate package provides a library for generating animations programatically. I wanted to use it on Windows 10, but hit a dead end. However, I had better luck with Windows Subsystem for Linux (WSL) 2 and Ubuntu 20.04 LTS.

GSL and linear algebra

reanimate depends on the hmatrix package, which, in turn, requires the GNU Scientific Library (GSL) and LAPACK (Linear Algebra PACKage).

Following instructions for hmatrix, I installed Ubuntu packages libgsl0-dev, liblapack-dev and libatlas-base-dev. libgsl0-dev is a virtual package, provided by libgsl-dev, the GNU Scientific Library (GSL) — development package. liblapack-dev is the library of linear algebra routines 3 (static version). libatlas-base-dev is Automatically Tuned Linear Algebra Software, generic static.

FFmpeg

reanimate uses FFmpeg to render to a file. I installed the Ubuntu package ffmpeg, providing tools for transcoding, streaming and playing of multimedia files.

Hello, world

My first, test, program was based on William Yeo’s tutorial. Using the Haskell Tool Stack’s lts-16.3 resolver (GHC 8.8.3) and a dependency on reanimate, I could build executable ra-test with stack.

In WSL 2, I could execute ra-test to render to a Graphics Interchange Format (GIF) file.

The output was as expected: an animation of a box (drawBox) and an animation of a circle (drawCircle), played concurrently (parA) and with a default environment (docEnv).

Output from ra-test executable.

Windows 10, version 2004

So, what about reanimator on Windows 10, version 2004? My experience could be summed up as: thwarted at every turn.

hmatrix

I managed, I think, to build hmatrix on Windows 10. It required the OpenBLAS library, setting the flag openblas, setting  --extra-include-dirs to the OpenBLAS include folder and --extra-lib-dirs to the OpenBLAS bin folder, and setting –extra-lib-dirs to the gcc folder under MSYS2 (C:\msys64\usr\lib\gcc\x86_64-pc-msys\9.1.0).

Getting the OpenBLAS library itself involved downloading and extracting OpenBLAS 0.3.10 version.zip, and (in that folder) using the MSYS2 commands: make clean, make, make install. This generated the OpenBLAS folder under MSYS2 (C:\msys64\opt\OpenBLAS). Prequisites were the MSYS2 packages make, perl and gcc-fortran.