xmrig / xmrig-cuda

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

Fails to build on Arch Linux (due to GCC 11?) #106

Open corecontingency opened 3 years ago

corecontingency commented 3 years ago

Using fully upgraded Arch Linux with NVIDIA driver 465.31, GCC 11.1, and CUDA 11.3.0.

The AUR package xmrig-cuda fails to compile. Build log is here.

I also tried compiling normally, with cmake .. && make, and it failed also. Build log is here.

Spudz76 commented 3 years ago

The CUDA Toolkit 11.3.0 Linux Support Table refers to gcc 9.x or 10.2 or Clang 11 ; so I guess it's untested territory. Also the compiler literally blew up badly amidst one of its own gcc-11 headers. The rest of things are fairly normal warnings that have been in the code since forever.

That's precisely why it's a plugin, so that the main miner can be compiled with newest compilers while this can be built with whatever CUDA Toolkit likes because it has almost never worked on the newest... If you needed CUDA Toolkit 8.0 you'd be installing gcc-5 so it could be worse. Maybe CUDA Toolkit 11.4 will officially support gcc 11.x

I know it compiles fine with gcc-9 and msvc2019 but have not tried gcc-10 maybe if gcc-11 showed up on toolchain test ppa I can try it out on Ubuntu.

Spudz76 commented 3 years ago

Validated with Debian Sid that gcc 10.2 does build with toolkit 11.3.0 successfully. Still trying to find some gcc-11 for Debian and fully avoid spinning up an Arch install.

The PKGBUILD for xmrig-cuda is 73% wrong lol. The minimum cuda is cuda-8.0 not sure why the need to pin 11.1

The PKGBUILD for cuda-*.* are also 22% wrong (you can/should have all of them installed at the same time if you don't create your own collisions by using /opt/cuda/ for all of them like a jerk... then you make a simple cuda-select script that symlinks /opt/cuda/ to /opt/cuda-11.3/ or /opt/cuda-8.0/ or whatever the system default should be, but other stuff can still build against specific versions...) CUDA is not like other libraries and if you want to run a Fermi on a current system you still need 8.0 (but may also want to build against 9.1 for some other app on a secondary GTX970).

Aaaaanyway, I think I'll try to fixup the bad PKGBUILDs too -- so probably I do need to make an Arch VM, bleh. I already learned how to MacOS this month and now I have to Arch for the first time lol.

Spudz76 commented 3 years ago

Worked perfectly by the time I got around to trying it (now) The cuda package from community pulled in gcc-10 which maybe it didn't do previously (someone fixed it?) Or, the xmrig-cuda package from AUR got told to use gcc-10 I'm not sure which one was broken.

-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0

Those being the operative lines of output signifying it was correct (not 11).

bachandi commented 3 years ago

Have encountered the same compiler seg fault with gcc 10.3.0 and cuda 11.3. Traced it down to a bug in gcc 10 (see: https://github.com/NVIDIA/nccl/issues/494). Compilation of this plugin with gcc 9.3.0 worked fine. No need to recompile everything.

Spudz76 commented 3 years ago

Correct, the entire point of this being a plugin is because of these weird compiler rules for CUDA, so you can compile the main miner with a normal/newest compiler. And if you had Fermi cards, you'd be compiling this plugin with CUDA Toolkit 8.0 and gcc5 lol.

And again, Nvidia says only up to 10.2.x works, so it is not very surprising that 10.3.0 didn't work.

edrozenberg commented 3 years ago

The GCC project has committed a patch:

https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=5357ab75dedef403b0eebf9277d61d1cbeb5898f (in response to the problem report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102)