bits-extras on DragonflyBSD

UPDATE: Spoke too soon, now suffering from linker errors. Will update this if I can resolve it. I swear this used to work…

UPDATE 2: The solution to this is to use one of the forks of bits-extras on github that removes the gcc intrinsic and uses the slower version. Almost all the forks on github were made for this reason. Perhaps a bits-extra-portable package would be worthwhile.

TLDR:

      pkg install gcc5-devel
      ln -s /usr/local/lib/gcc5/libgcc_s.so /lib/libgcc_s.so

The bits-extras package provides some bit-manipulation functions by binding to a gcc library in a semi-linux-specific way. If you read the cabal file, you can adapt it’s suggested symlinks to DragonflyBSD.

The package depends on the existence of /lib/libgcc_s.so existing. If you install gcc5-devel:

pkg install gcc5-devel

and search your system of libgcc_s:

find / -name "libgcc_s*"

you should find it at /usr/local/lib/gcc5/libgcc_s.so. Symlinking this into /lib should allow you to build bits-extras successfully.

ln -s /usr/local/lib/gcc5/libgcc_s.so /lib/libgcc_s.so

I wish I knew a way to generalize this so it could be upstreamed.
There’s a long standing ticket for ghc to provide these functions natively, hopefully it gets done one day.