Compile XMRig on OpenBSD

XMRig is a popular miner for Monero however there is no official OpenBSD support. This guide will take you though getting XMRig compiled and running on an OpenBSD system.

Instructions

Build XMRig

  1. Clone XMRig using git

    # git clone https://github.com/xmrig/xmrig
    # cd xmrig
    
  2. Download and apply patch to support OpenBSD

    # curl -O https://w4tchguard.neocities.org/files/openbsd-xmrig-support-patch.txt
    # patch -b -p0 < openbsd-xmrig-support-patch.txt
    
  3. Configure build using CMake

    # cmake . -DWITH_ASM=OFF -DWITH_HWLOC=OFF -DWITH_HTTP=OFF 
    
  4. Compile XMRig

    # make
    

Run XMRig

  1. Depending on the amount RAM your system has you will have to set your data seg size higher then XMRig requests or you can set it to umlimited

    # ulimit -d $(((${MEMORY_IN_GB}*1024*1024)))
    OR
    # ulimit -d unlimited
    
  2. Use the config wizard to create cli options and add --no-color to fix the missing text in stdout

  3. Run XMRig

    # ./xmrig --no-color ${XMRIG_OPTIONS}
    

References

Most of this patch came from this PR and I figured out what was causing the Segmentation fault.