Fedora 30, Nvidia and xmr-stak

This post describes how to compile xmr-stak Monero miner on Fedora 30 for older Nvidia graphic card. In my case Nvidia card is Quadro K2200 and compiling with gcc9 was not possible because gcc versions later than 8 are not supported. The solution was to build gcc7 with gcc9 and install to /usr/local directory where will not interfere with other packages.

After fresh Fedora 30 installation, the very next step is to make system update:

> dnf update

Now OS is ready to install Nvidia graphic driver from negativo17.org repository:

> dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo
> dnf install nvidia-driver nvidia-settings kernel-devel

Just reboot Fedora and on boot system should rebuild nvidia_drm driver. You can search if new driver is loaded with lsmod command:

> lsmod | grep nvidia
nvidia_drm             57344  7
nvidia_modeset       1114112  14  nvidia_drm
nvidia_uvm            966656  0
nvidia              18812928  617 nvidia_uvm,nvidia_modeset
drm_kms_helper        212992  1   nvidia_drm
drm                   491520  10  drm_kms_helper,nvidia_drm
ipmi_msghandler        73728  2   ipmi_devintf,nvidia

For compiling xmr-stak with Nvidia support, CUDA development libs and tools are needed as well. With included negativo17 repository, it’s easy to install CUDA dev libs using dnf command:

> dnf install cuda cuda-devel cuda-cudnn-devel

From this point, system is ready to compile xmr-stak. Download xmr-stak source from the following link:

https://github.com/fireice-uk/xmr-stak/releases

Scroll down on GitHub page and download source code in “tar.gz” or “zip” file and unzip it in temporary directory. In short, here are steps:

> tar zxf /tmp/xmr-stak-2.10.4.tar.gz
> cd xmr-stak-2.10.4/
> mkdir build
> cd build/
> cmake .. -DCUDA_TOOLKIT_ROOT_DIR=/usr/include/cuda -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
> make
> make install
> ll bin/

This was enough for Fedora 27, 28 and 29 but in Fedora 30 compiling stopped with the following error message:

error: #error — unsupported GNU version! gcc versions later than 8 are not supported!

Fedora 30 comes with gcc9 compiler and it’s needed to somehow install lower gcc version. I didn’t want to install RPM packages for gcc7 and search solution in this direction because it could break existing gcc9. Finally, I found nice explanation on StackOverflow where is described how to build gcc7 from source and install it in “/usr/local” directory:

https://stackoverflow.com/questions/53344283/gcc-versions-later-than-7-are-not-supported-by-cuda-10-qt-error-in-arch-linux

Here are the steps:

1) Download gcc-7.4 source ftp://ftp.mpi-sb.mpg.de/pub/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-7.4.0/
2) Unzip package, configure with /usr/local/gcc7 path prefix

> ../configure --prefix=/usr/local/gcc7 --disable-multilib

3) make and make install

Compilation will last a bit and be sure to have at least 6GB of disk space. Installation in “/usrl/local/gcc7” will take about 1GB after “make install” command.

Now is possible to compile xmr-stak but with new parameter -DCMAKE_C_COMPILER to define gcc7 compiler:

> cmake .. -DCUDA_TOOLKIT_ROOT_DIR=/usr/include/cuda -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF -DCMAKE_C_COMPILER=/usr/local/gcc7/bin/gcc
> make
> make install

Hope this post will help you to build xmr-stak on Fedora 30.

Happy Monero mining!

Leave a Comment