Building CCminer no Ubuntu 17.04

1

Recentemente comecei a extrair algumas cripconcurrencies novamente e queria testar o Monero (XMR). O xmrig de mineiro de CPU funciona perfeitamente no entanto estou tendo problemas para instalar um mineiro de GPU.

O que eu já fiz

Eu já instalei os drivers gráficos para minha GTX 1070 (estou usando 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 |
+-------------------------------+----------------------+----------------------+

Eu já instalei o 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

Clonando o ccminer do github

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

Executando "./autogen.sh" e "./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

Onde eu falho

Executando o comando 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

O problema

ERRO: Nenhum compilador de host gcc / g ++ foi encontrado, mas o clang-3.8 está disponível.            Use 'nvcc -ccbin clang-3.8' para usar isso.

O problema parece ser que o CUDA 8.0 não suporta o gcc 6. Então, como posso usar o clang? (Eu já instalei via apt)

    
por itssme 26.07.2017 / 21:56

4 respostas

1

Correção rápida: abra o makefile, procure por nvcc (com nano é CTRL + W, digite "nvcc") e substitua por "nvcc -ccbin clang-3.8", salve o makefile e faça novamente.

    
por kuzko 02.08.2017 / 13:40
2

O uso do clang-3.8 ainda me deixou com erros de vinculação. No entanto, eu consegui fazer o ccminer compilar no Ubuntu 17 fazendo o seguinte:

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

Edite as seguintes linhas no 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

Então finalmente:

make

Boa sorte!

    
por Rob M 16.10.2017 / 01:02
1

A melhor maneira de escolher seu compilador é passando as variáveis apropriadas para ./configure:

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

Atualmente, o nvcc não parece gostar de versões do GCC mais recentes que 5.

    
por esk 14.11.2017 / 01:20
0

Editando Makefile e comentando linhas:

#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 $<

Em seguida, execute:

make

Funcionou para mim.

    
por Fulvio 28.12.2017 / 06:42