How to Compile Pandoc in Openbsd 6.7

2020/07/08

How to Compile Pandoc in Openbsd 6.7

If you want to read this article in Mediawiki for better formating you can do so here:
https://wiki.tinfoil-hat.net/index.php?title=Compiling-pandoc-on-openbsd

Install Cabal

via packagemanagement

doas pkg_add -i ghc cabal-install

Prepare system to compile programs via cabal

Enable wxallowed in /home and /tmp:

You can do so via editing your

/etc/fstab

like this (this is my personal fstab. don’t blindly copy paste, you have to insert the wxallowed in the right place in your own /etc/fstab.

.b none swap sw
.a / ffs rw,softdep,noatime 1 1
.k /home ffs rw,softdep,wxallowed,noatime,nodev,nosuid 1 2
.d /tmp ffs rw,softdep,wxallowed,noatime,nodev,nosuid 1 2
.f /usr ffs rw,softdep,wxallowed,noatime,nodev 1 2
.g /usr/X11R6 ffs rw,softdep,noatime,nodev 1 2
.h /usr/local ffs rw,softdep,wxallowed,noatime,nodev 1 2
.j /usr/obj ffs rw,softdep,noatime,wxallowed,nodev,nosuid 1 2
.i /usr/src ffs rw,softdep,noatime,nodev,nosuid 1 2
.e /var ffs rw,softdep,noatime,nodev,nosuid 1 2

then reboot.

(optional) enable multithreating

If you want to enable hyperthreating tempoary, do:

sysctl hw.smt=1

if you want to make it permanent edit your /etc/sysctl.conf and paste the following at the end:

hw.smt=1

notice: without rebooting you have once to enable it manually, after the fist reboot, it will be active

you can check that hyperthreating is active, with programs like top or htop

raise ulimit:

put the following into your ~/.profile

ulimit -d 4096*1024

If you haven’t relogged, you have to manually paste this everytime you open a terminal in which you want to compile, since it’s a command for your shell.

ulimit -d 4096*1024

correct PATH in .profile

edit this into you .profile

PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:$HOME/.cabal/bin/:.

install pandoc or pandoc-citeproc

if you want to convert LATEX you probably want pandoc-citeproc, it automatically pulls pandoc as dependency: as a user (not root) execute:

ulimit -d 4096*1024
cabal update
cabal install pandoc-citeproc

This will need a lot of time and resources to compile, be pacient. Pandoc should now be able to be compiled.

After compilation is finished, don’t be surpised if nothing happens when you execute pandoc and / or getting an error, read clearly, you may have the binary successfully compiled and it just couldn’t symlink. you probably can find pandoc in:

~/.cabal/bin/pandoc

if nothig happens when you execute this binary, it probably does work as inteded anyways, try to give it an argument like:

~/.cabal/bin/pandoc -v

Congratulations! You have successfully compiled and installed pandoc in OpenBSD This Article is Converted from markdown in HTML using Pandoc in Openbsd :-)