在Ubuntu 17.04上构建CCminer

我最近又开始挖掘一些cryptconcurrencys,我想尝试Monero(XMR)。 CPU miner xmrig工作得很好但是我在安装GPU挖掘器时遇到了问题。

我已经做了什么

我已经为我的GTX 1070安装了图形驱动程序(我使用的是375.66)

itssme@muhbuntu:~$ nvidia-smi Wed Jul 26 20:48:30 2017 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 375.66 Driver Version: 375.66 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 1070 Off | 0000:01:00.0 On | N/A | | 27% 32C P8 7W / 151W | 653MiB / 8112MiB | 0% Default | +-------------------------------+----------------------+----------------------+ 

我已经安装了cuda(apt-get install nvidia-cuda-dev nvidia-cuda-toolkit)

 itssme@muhbuntu:~$ nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Sun_Sep__4_22:14:01_CDT_2016 Cuda compilation tools, release 8.0, V8.0.44 

从github克隆ccminer

 https://github.com/tpruvot/ccminer.git 

运行“./autogen.sh”和“./configure”

 itssme@muhbuntu:~$ ./autogen.sh configure.ac:4: installing './config.sub' configure.ac:6: installing './missing' Makefile.am: installing './depcomp' itssme@muhbuntu:~$ ./configure checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for gcc option to accept ISO C99... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking whether gcc needs -traditional... no checking dependency style of gcc... gcc3 checking for ranlib... ranlib checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking for gcc option to support OpenMP... -fopenmp checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking sys/endian.h usability... no checking sys/endian.h presence... no checking for sys/endian.h... no checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking syslog.h usability... yes checking syslog.h presence... yes checking for syslog.h... yes checking for sys/sysctl.h... yes checking whether be32dec is declared... no checking whether le32dec is declared... no checking whether be32enc is declared... no checking whether le32enc is declared... no checking for size_t... yes checking for working alloca.h... yes checking for alloca... yes checking for getopt_long... yes checking whether we can compile AVX code... yes checking whether we can compile XOP code... yes checking whether we can compile AVX2 code... yes checking for json_loads in -ljansson... yes checking for pthread_create in -lpthread... yes checking for SSL_library_init in -lssl... yes checking for EVP_DigestFinal_ex in -lcrypto... yes checking for gawk... (cached) gawk checking for curl-config... /usr/bin/curl-config checking for the version of libcurl... 7.52.1 checking for libcurl >= version 7.15.2... yes checking whether libcurl is usable... yes checking for curl_free... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating compat/Makefile config.status: creating compat/jansson/Makefile config.status: creating cpuminer-config.h config.status: executing depfiles commands 

我失败的地方

运行make命令

 itssme@muhbuntu:~/Documents/ccminer$ make make all-recursive make[1]: Entering directory '/home/itssme/Documents/ccminer' Making all in compat make[2]: Entering directory '/home/itssme/Documents/ccminer/compat' make[3]: Entering directory '/home/itssme/Documents/ccminer/compat' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/itssme/Documents/ccminer/compat' make[2]: Leaving directory '/home/itssme/Documents/ccminer/compat' make[2]: Entering directory '/home/itssme/Documents/ccminer' gcc -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-crc32.o -MD -MP -MF .deps/ccminer-crc32.Tpo -c -o ccminer-crc32.o `test -f 'crc32.c' || echo './'`crc32.c mv -f .deps/ccminer-crc32.Tpo .deps/ccminer-crc32.Po gcc -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-hefty1.o -MD -MP -MF .deps/ccminer-hefty1.Tpo -c -o ccminer-hefty1.o `test -f 'hefty1.c' || echo './'`hefty1.c mv -f .deps/ccminer-hefty1.Tpo .deps/ccminer-hefty1.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-ccminer.o -MD -MP -MF .deps/ccminer-ccminer.Tpo -c -o ccminer-ccminer.o `test -f 'ccminer.cpp' || echo './'`ccminer.cpp mv -f .deps/ccminer-ccminer.Tpo .deps/ccminer-ccminer.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-util.o -MD -MP -MF .deps/ccminer-util.Tpo -c -o ccminer-util.o `test -f 'util.cpp' || echo './'`util.cpp mv -f .deps/ccminer-util.Tpo .deps/ccminer-util.Po gcc -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-log.o -MD -MP -MF .deps/ccminer-log.Tpo -c -o ccminer-log.o `test -f 'log.c' || echo './'`log.c mv -f .deps/ccminer-log.Tpo .deps/ccminer-log.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-api.o -MD -MP -MF .deps/ccminer-api.Tpo -c -o ccminer-api.o `test -f 'api.cpp' || echo './'`api.cpp mv -f .deps/ccminer-api.Tpo .deps/ccminer-api.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-hashlog.o -MD -MP -MF .deps/ccminer-hashlog.Tpo -c -o ccminer-hashlog.o `test -f 'hashlog.cpp' || echo './'`hashlog.cpp mv -f .deps/ccminer-hashlog.Tpo .deps/ccminer-hashlog.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-nvml.o -MD -MP -MF .deps/ccminer-nvml.Tpo -c -o ccminer-nvml.o `test -f 'nvml.cpp' || echo './'`nvml.cpp mv -f .deps/ccminer-nvml.Tpo .deps/ccminer-nvml.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-stats.o -MD -MP -MF .deps/ccminer-stats.Tpo -c -o ccminer-stats.o `test -f 'stats.cpp' || echo './'`stats.cpp mv -f .deps/ccminer-stats.Tpo .deps/ccminer-stats.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-sysinfos.o -MD -MP -MF .deps/ccminer-sysinfos.Tpo -c -o ccminer-sysinfos.o `test -f 'sysinfos.cpp' || echo './'`sysinfos.cpp mv -f .deps/ccminer-sysinfos.Tpo .deps/ccminer-sysinfos.Po g++ -DHAVE_CONFIG_H -I. -fopenmp -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT ccminer-cuda.o -MD -MP -MF .deps/ccminer-cuda.Tpo -c -o ccminer-cuda.o `test -f 'cuda.cpp' || echo './'`cuda.cpp mv -f .deps/ccminer-cuda.Tpo .deps/ccminer-cuda.Po nvcc -gencode=arch=compute_52,code=\"sm_52,compute_52\" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -I/usr/local/cuda/include -I. --ptxas-options="-v" --maxrregcount=128 -o heavy/heavy.o -c heavy/heavy.cu ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is available. Use 'nvcc -ccbin clang-3.8' to use that instead. Makefile:2073: recipe for target 'heavy/heavy.o' failed make[2]: *** [heavy/heavy.o] Error 1 make[2]: Leaving directory '/home/itssme/Documents/ccminer' Makefile:1621: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/itssme/Documents/ccminer' Makefile:564: recipe for target 'all' failed make: *** [all] Error 2 

问题

错误:找不到支持的gcc / g ++主机编译器,但是clang-3.8可用。 使用’nvcc -ccbin clang-3.8’代替使用它。

问题似乎是CUDA 8.0不支持gcc 6.所以我怎么能用clang呢? (我已经通过apt安装了它)

快速修复:打开makefile,搜索nvcc(使用nano它的CTRL + W,输入“nvcc”)并将其替换为“nvcc -ccbin clang-3.8”,保存makefile并再次制作。

使用clang-3.8仍然给我留下链接错误。 但是,我通过执行以下操作设法让ccminer在Ubuntu 17上编译:

 sudo apt-get install gcc-4.9 ./configure.sh 

编辑Makefile中的以下行:

 CXX = g++-4.9 NVCC = /usr/local/cuda/bin/nvcc -ccbin gcc-4.9 ac_ct_CC = gcc-4.9 ac_ct_CXX = g++-4.9 

最后:

 make 

祝好运!

选择编译器的最佳方法是将适当的变量传递给./configure:

 sudo apt-get install g++-4.9 CC=gcc-4.9 CPP=cpp-4.9 CXX=g++-4.9 ./configure 

目前,nvcc似乎不喜欢比5更新的GCC版本。

编辑Makefile和注释行:

 #scrypt/salsa_kernel.o: scrypt/salsa_kernel.cu # $(NVCC) $(JANSSON_INCLUDES) -I. -I/usr/local/cuda/include -O3 -lineno -Xcompiler -Wall -D_FORCE_INLINES -gencode=arch=compute_20,code=\"sm_21,compute_20\" -o $@ -c $< # These kernels are for older devices (SM) #scrypt/test_kernel.o: scrypt/test_kernel.cu # $(NVCC) $(JANSSON_INCLUDES) -I. -I/usr/local/cuda/include -O3 -lineno -Xcompiler -Wall -D_FORCE_INLINES -gencode=arch=compute_20,code=\"sm_20,compute_20\" -o $@ -c $< #scrypt/fermi_kernel.o: scrypt/fermi_kernel.cu # $(NVCC) $(JANSSON_INCLUDES) -I. -I/usr/local/cuda/include -O3 -lineno -Xcompiler -Wall -D_FORCE_INLINES -gencode=arch=compute_20,code=\"sm_21,compute_20\" -o $@ -c $< 

然后运行:

 make 

它对我有用。