Last Update: 2022-04-24

biblatex-biber on OpenBSD 7.1

biber is a bibliography processing backend for the LaTeX biblatex package and sadly not part of OpenBSD's texlive packages. But don't worry, I've got you covered, here are some notes of howto build it yourself - or simply download the executable.

Download

Pre-compiled biber executable for OpenBSD 7.1 amd64:

Build it yourself

As you'll build quite a lot of packages outside the normal package management, I would strongly recommend to use a dedicated virtual machine for this process, utilizing OpenBSD's virtualization platform (a 10G image file is enough, auto layout).

OpenBSD VM

I'll not cover the OpenBSD installation process here, I'll assume that the virtual machine is up and running.

Create a new user pkg, which we'll use throughout the build process, and modify /etc/doas.conf, so that you won't be prompted for the password during the installation of the perl modules later (which would happen very often):

# useradd -s /bin/sh -m -G wheel -g pkg pkg
# echo 'permit nopass pkg as root' >> /etc/doas.conf

We'll need some additional packages (the perl packages failed to build via cpan later):

$ doas pkg_add p5-LWP-Protocol-https-6.10
$ doas pkg_add p5-XML-LibXSLT
$ doas pkg_add gdbm

cpan

To install all needed perl modules, we'll use cpan. I first tried the local::lib method, which installs all new perl modules in the user's home directory, but I couldn't get biber to work. Therefore I went with the sudo variant.

$ cpan

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 

 <install_help>

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib] sudo


Autoconfiguration complete.

commit: wrote '/home/pkg/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

To fix that, maybe try>  install Term::ReadLine::Perl


cpan shell -- CPAN exploration and modules installation (v2.27)
Enter 'h' for help.

cpan[1]> exit

On OpenBSD you should prefer doas over sudo, change the following lines in the file ~/.cpan/CPAN/MyConfig.pm:

'make_install_make_command' => q[doas /usr/bin/make],
'mbuild_install_build_command' => q[doas ./Build],
And build some modules, which are needed later:
$ cpan CPAN::DistnameInfo
$ cpan Readonly::XS

biblatex-biber

First of all you need to know which biblatex version OpenBSD's TeXLive distribution uses:

$ grep '\abx@version{' /usr/local/share/texmf-dist/tex/latex/biblatex/biblatex.sty

\def\abx@version{3.16}

Check the compatibility matrix in the manual. For biblatex 3.16 you'll need biber 2.16!

$ ftp -o biblatex-biber-2.16.tgz https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/2.16/biblatex-biber.tar.gz/download
$ tar xfz biblatex-biber-2.16.tgz

If you want to create a single biber executable, clone the biber repository:

$ git clone https://github.com/plk/biber.git

Your build directory should now look like this:

$ ls -l

drwxr-x---  12 pkg  pkg       512 Apr 24 09:26 biber
drwxr-x---   7 pkg  pkg       512 Dec 19  2020 biblatex-biber-2.16
-rw-r-----   1 pkg  pkg   1036248 Dec 19  2020 biblatex-biber-2.16.tgz

Now let's build biber:

$ cd ~/biblatex-biber-2.16
$ perl Build.PL
$ ./Build installdeps
$ ./Build install

The Build installdeps step takes a long time! Some modules might fail, in this case simply run perl Build.PL again (it shows the missing modules) and install these modules via pkg_add. After Build install there should be a /usr/local/bin/biber file.

biber executable

If you want to use biber outside your build environment, the best approach is to create a single executable rather than coping all those needed perl modules. This is done by PAR::Packer:

$ cpan PAR::Packer

For detailed information on the build process, see Chapter 4 of the biblatex-biber manual. In short: there are some build scripts in ~/biber/dist for various operating systems and architectures, which are quiet ugly from my point of view. I modified the freebsd_amd64 files for OpenBSD 7.1, which will need changes for future releases of OpenBSD:

$ ftp https://monol1th.de/pub/openbsd/biber/biber-openbsd_amd64.tgz
$ tar xfz biber-openbsd_amd64.tgz -C /home/pkg/biber/dist
$ cd /home/pkg/biber/dist/openbsd_amd64
$ ./build.sh

The biber-2.16.amd64-openbsd-7.1 executable will be in the same directory, which you can now copy to your production instance of OpenBSD.