xmrig / xmrig-cuda

NVIDIA CUDA plugin for XMRig miner
GNU General Public License v3.0
372 stars 156 forks source link

Build Issue (Linux) #16

Closed Bug-Reaper closed 4 years ago

Bug-Reaper commented 4 years ago

Hey all, if you need additional help testing, let me know.

While building on linux you get this error when trying to run the make command. /usr/include/c++/9.2.0/bits/stl_function.h(437): error: identifier "__builtin_is_constant_evaluated" is undefined

A bit of google foo shows that this issue is related some friction between certain compiler versions and CUDA libs. Read more on that here.

I was able to build but it was a super big pain-in-the-ass. Basically for all of the CMAKE files listed below, I had to manually edit them to replace the line: set(CUDA_HOST_COMPILER "/usr/bin/cc") # path replaced with: set(CUDA_HOST_COMPILER "/usr/bin/cc-8") # path

This is the full list of files I had to manually make that change in:

xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/RandomX/wownero/xmrig-cu_generated_randomx_wownero.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/xmrig-cu_generated_cuda_core.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/xmrig-cu_generated_cuda_extra.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/RandomX/arqma/xmrig-cu_generated_randomx_arqma.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/RandomX/loki/xmrig-cu_generated_randomx_loki.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/RandomX/monero/xmrig-cu_generated_randomx_monero.cu.o.Release.cmake
xmrig-cuda/CMakeFiles/xmrig-cu.dir/src/RandomX/xmrig-cu_generated_randomx.cu.o.Release.cmake

This was on Arch Linux but I presume this would extend to other flavors as well. Basically was unable to compile with the 9.2 version of the compiler and had to rollback to cc-8.

I think this might be a nvidia issue because I do believe they claim support for clang9 but I figured I'd make you guys aware as well as the steps I took to fix it. Anyways, I hope this helps! Would love to hear your thoughts and assist with a better solution if possible.

I'm not a C/C++ guy so it's some small miracle I got this to build. Wish I could provide more useful insight. The finished .so library does work and allows me CUDA mine with my 1080TI.

xmrig commented 4 years ago

CUDA version? CUDA has very strict compiler requirements, easiest way to specify compiler is do something like cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=gcc++8 (not sure about compilers names on Arch Linux) don't need edit cmake files.

gcc 9 or clang 9 not listed as supported even for recent CUDA https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements

Bug-Reaper commented 4 years ago

Thanks @xmrig. I'm using CUDA 10 I believe. (Edit: I checked, specifically using cuda 10.1.243-2)

Let me try and compile it using the cmake args you suggested and see if that works too.

git clone https://github.com/xmrig/xmrig-cuda.git
cd xmrig-cuda
cmake ./ -DCMAKE_C_COMPILER=/usr/bin/gcc-8 -DCMAKE_CXX_COMPILER=/usr/bin/g++-8
make

This works and is obviously easier than changing all the make files manually.

Can I make a PR to the readme that adds the above statements as an example linux build with a note that they may have to use alternate paths for gcc-8 and g++-8 depending on their linux distro?

I think it'd be nice to have example build instructions since building is required for linux.

hv15 commented 4 years ago

@Bug-Reaper, there is a AUR package for this: https://aur.archlinux.org/packages/xmrig-cuda