I wanted to build kawpowminer from source so I could mine some Ravencoin. I ran into some issues getting it to build, so I’m documenting them here in case anyone else runs into the same problems.
Let’s assume you’ve gotten past the part where you install all of the dev libraries you need (cuda, etc) and are trying to get the kawpowminer source to build (if you miss a library, it’s generally pretty obvious from googling the build error which one you need to add and then try again).
git clone https://github.com/RavenCommunity/kawpowminer cd kawpowminer git submodule update --init --recursive cmake .
It’s at this point that you’re likely to see an error.
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: CUDA_cuda_LIBRARY linked by target "ethash-cuda" in directory /home/xangis/code/kawpowminer/libethash-cuda CUDA_nvrtc_LIBRARY linked by target "ethash-cuda" in directory /home/xangis/code/kawpowminer/libethash-cuda -- Configuring incomplete, errors occurred!
To get past this, you’ll need to find where your libcuda.so and libnvrtc.so files are. I install mlocate on my machines so I can do “locate libcuda.so” to find the file location. Once you’ve found (or installed) them, add the file locations to the cmake command line like so:
cmake . -DETHASHCUDA=ON -DETHASHCL=ON -DCUDA_cuda_LIBRARY=/usr/lib/x86_64-linux-gnu/libcuda.so -DCUDA_nvrtc_LIBRARY=/usr/lib/x86_64-linux-gnu/libnvrtc.so
CMake should run for a while and do a bunch of things. Eventually you’ll be ready to run “make” to create the final build of the app. Except, it doesn’t like the default Ubuntu gcc v9 install. It’s too new:
[ 64%] Building NVCC (Device) object libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_CUDAMiner_cuda.cu.o In file included from /usr/include/cuda_runtime.h:83, from : /usr/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported! 138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported! | ^~~~~ CMake Error at ethash-cuda_generated_CUDAMiner_cuda.cu.o.Release.cmake:220 (message): Error generating /home/xangis/code/kawpowminer/libethash-cuda/CMakeFiles/ethash-cuda.dir//./ethash-cuda_generated_CUDAMiner_cuda.cu.o make: *** [libethash-cuda/CMakeFiles/ethash-cuda.dir/build.make:65: libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_CUDAMiner_cuda.cu.o] Error 1 make: *** [CMakeFiles/Makefile2:513: libethash-cuda/CMakeFiles/ethash-cuda.dir/all] Error 2 make: *** Waiting for unfinished jobs.... [ 66%] Linking CXX static library libpoolprotocols.a [ 66%] Built target poolprotocols make: *** [Makefile:152: all] Error 2 xangis@spica:~/code/kawpowminer$ gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To get around this, you’ll need to install an older version of gcc. I went back to version 7 because I didn’t want to worry about installing v8.1 for example, and then being told that it won’t work because it’s a version later than 8.
sudo apt-get install gcc-7 g++-7
Now you have two versions of GCC installed, and your system won’t use the older one. There are a few ways to switch them (including update-alternatives), but the quickest way is to remove the /usr/bin/gcc link to gcc-9 and replace it with one to gcc-7.
sudo rm /usr/bin/gcc sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
Now if you run “make”, you won’t get the error message about your gcc being too new. You’ll probably want to reverse this change after you’re done building, unless you want to keep using the older version of GCC, which you might want to do if you’ll be working on the kawpowminer code.
sudo rm /usr/bin/gcc sudo ln -s /usr/bin/gcc-9 /usr/bin/gcc
If you found this helpful, you can always RVN me at RRWHrajdjJV7kKdZoeRFbKHkEeuh9jBKR4