I just managed to get cudaminer to build on Linux, and figured I should document what I had to change to make things work because the Linux instructions in the cudaminer thread don't work for me. This worked for cudaminer-2013-07-13.zip. You will (obviously) need the NVidia CUDA SDK installed and "nvcc" in your path.
First, after unzipping the archive and un7zing the src archive. I had to remove all of the ^Ms from the line endings or autotools gets confused and generates a configure that doesn't work:
dos2unix *
Then the main file is called "cpu-miner.c" but autotools seems to be set up for a file called "cuda-miner.c" We'll just copy it over to make autotools happy:
cp cpu-miner.c cuda-miner.c
Now you should be able to generate the configure script using autogen.sh:
chmod 755 ./autogen.sh
./autogen.sh
The configure script picks the wrong C compiler by default. It tries to use gcc, but we really need g++ for this because there are a couple of C++-isms in the source that gcc doesn't like. I also had a problem where it couldn't find the CUDA libraries, but that might just be my cuda-sdk install or something wonky with my distro, but it can't hurt to specify. So, we'll set CC and LDFLAGS to compensate when we run ./configure
CC=g++ LDFLAGS=/opt/cuda/lib64 ./configure
Hopefully, things will go well and you will have a Makefile.
Now, there are still a couple of things that I needed to tweak in the code. First off, I was continually getting "'sleep' was not declared in this scope" errors, and similar errors for other functions in unistd.h. I still have no idea why. The #include
#include
to
#include "/usr/include/unistd.h"
Then, there's a call to _strdup() on line 1251 in that same file. I don't really know why there's an underscore there, but I don't have a library with a function by that name and the non-underscore version seems to work. So change:
device_config[cnt++] = _strdup(pch);
to
device_config[cnt++] = strdup(pch);
We should be done with cuda-miner.c now.
The last probelm I had was a call to alloca() in util.c that doesn't cast the void* to a char* to match the type of the pointer. We just need to add a cast to make the compiler happy, so on line 84 in util.c change:
buf = alloca(len);
to
buf = (char *) alloca(len);
And everything should be good to go. Type "make" and if you are very lucky (and I didn't change anything else I've forgotten about) it should compile for a while then you should have an executable file called "cudaminer" in the current directory. I've been running it from there, and did not run a "make install." It's probably not needed.
I've been running it for a bit, and it seems to be working. At least the mining pool I use has been accepting the work; that's as far as I know how to test it. It's probably a 2x speed improvement over cgminer on my GTX 670, which is awesome!
Oh, and thanks for your work on this cbuchner1. I will probably donate some LTC to you, once I've mined enough to cash out some LTCs of my own.