Open jason-tilley opened 6 years ago
I think you are the first person trying to compile it under OSX. I fixed the errors and warnings I see above (I think), but there's probably more stuff that doesn't work.
I appreciate you trying, but because this is not intended for OS X, I understand if you don't want to spend your time on this. In case you're interested, here are the new errors...
:info:build /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I/opt/local/include -I/opt/local/include -pthread -fno-strict-aliasing -I/usr/local/cuda/include -DUSE_WRAPNVML -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -I/opt/local/include -pipe -Os -stdlib=libc++ -arch x86_64 -MT ccminer-hashlog.o -MD -MP -MF .deps/ccminer-hashlog.Tpo -c -o ccminer-hashlog.o `test -f 'hashlog.cpp' || echo './'`hashlog.cpp
:info:build In file included from util.cpp:32:
:info:build ./miner.h:156:21: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build ./miner.h:156:78: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build In file included from api.cpp:33:
:info:build ./miner.h:156:21: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build ./miner.h:156:78: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build 2 errors generated.
:info:build make[2]: *** [ccminer-util.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....
:info:build api.cpp:216:57: warning: 'strncpy' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess]
:info:build strncpy(jobid, stratum.job.job_id, sizeof(stratum.job.job_id));
:info:build ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~^~~~~~
:info:build api.cpp:216:57: note: did you mean to provide an explicit length?
:info:build strncpy(jobid, stratum.job.job_id, sizeof(stratum.job.job_id));
:info:build ~~~~~~~~~~~~^~~~~~
:info:build api.cpp:889:35: warning: '&&' within '||' [-Wlogical-op-parentheses]
:info:build if (opt_debug || opt_protocol && n > 0)
:info:build ~~ ~~~~~~~~~~~~~^~~~~~~~
:info:build api.cpp:889:35: note: place parentheses around the '&&' expression to silence this warning
:info:build if (opt_debug || opt_protocol && n > 0)
:info:build ^
:info:build ( )
:info:build 2 warnings and 2 errors generated.
:info:build make[2]: *** [ccminer-api.o] Error 1
:info:build In file included from ccminer.cpp:49:
:info:build ./miner.h:156:21: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build ./miner.h:156:78: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build In file included from hashlog.cpp:13:
:info:build ./miner.h:156:21: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build ./miner.h:156:78: error: use of undeclared identifier 'swap_32'; did you mean 'swab32'?
:info:build return (((uint64_t)swap_32((uint32_t)((x)& 0xffffffffu)) << 32) | (uint64_t)swap_32((uint32_t)((x) >> 32)));
:info:build ^~~~~~~
:info:build swab32
:info:build ./miner.h:135:24: note: 'swab32' declared here
:info:build static inline uint32_t swab32(uint32_t x)
:info:build ^
:info:build 2 errors generated.
:info:build make[2]: *** [ccminer-ccminer.o] Error 1
:info:build 2 errors generated.
:info:build make[2]: *** [ccminer-hashlog.o] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/ccminer-windows'
:info:build make[1]: *** [all-recursive] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/ccminer-windows'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/ccminer-windows'
:info:build Command failed: cd "/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/ccminer-windows" && /usr/bin/make -j4 -w all
:info:build Exit code: 2
:error:build Failed to build ccminer: command execution failed
Oops, I fixed the typo with another typo. Lol. By the way, I think clang is showing more warning messages than GCC.
I this fails, I'll try with gcc7.
So both clang and gcc fail similarly. Now they are complaining that they can't find nvcc. This is odd to me, because it is in my path. It seems to be looking for it in bin/sh for some reason. Is there a configure option to change this? I tried '--nvcc-prefix=/usr/local/cuda/bin/', but that was a no-go.
:info:build /bin/sh: nvcc: command not found
:info:build make[2]: *** [cuda_groestlcoin.o] Error 127
:info:build make[2]: *** Waiting for unfinished jobs....
Maybe --with-cuda=/usr/local/cuda
is the right option?
I have no clue about the whole configure stuff.
The build.sh script doesn't work for you, I guess?
That gets me past that issue. Now I'm dealing with an issue that still involves clang somehow. This may be a problem on my end that I will need to solve to get past. I am executing the configure/build with gcc, but it still gives me this message.
:info:build nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported
My build argument is
/usr/bin/make -j4 -w all CC=/opt/local/bin/gcc CXX=/opt/local/bin/g++ CPP=/opt/local/bin/g++
I wonder if nvcc is compiled by clang and I'm just out of luck.
I think the CUDA 8 Toolkit doesn't work with this version. Maybe CUDA 9.1 would work there. http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html
Thanks. This is very helpful. I guess it's time I upgrade to High Sierra so I can get CUDA 9.1. Once I do that I'll report back.
Well a new OS, and a new set of problems. It won't go pas the configure phase now. Now I'm getting
configure.ac:103: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
A bit of Googling suggests this is often caused by not having pkgconfig installed, but I do. This is probably specific to my system, so I'm going to do some more digging.
OK, it was a curl dependency issue. Now it reaches the build phase. I'm now getting some errors related to swab32.
:info:build ptxas info : Used 63 registers, 344 bytes cmem[0], 8 bytes cmem[2]
:info:build ./cuda_helper.h(978): error: identifier "cuda_swab32" is undefined
:info:build ./cuda_helper.h(983): error: identifier "cuda_swab32" is undefined
:info:build ./cuda_helper.h(990): error: identifier "cuda_swab32" is undefined
:info:build cuda_groestlcoin.cu(36): error: identifier "cuda_swab32" is undefined
:info:build 4 errors detected in the compilation of "/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_0000735f_00000000-4_cuda_groestlcoin.cpp4.ii".
:info:build make[2]: *** [cuda_groestlcoin.o] Error 2
Oh, I see. If GCC is older than 4.3 then it's undefined. Maybe clang pretends to be 4.2 or something, I don't know. Thw error should be fixed now.
That is strange, because it did that even when compiling with gcc7. It seems to be getting much further, but I have a new error now:
:info:build /usr/local/cuda/bin/nvcc -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_37,code=sm_37 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_30,code=sm_30 -I/usr/local/cuda/include -I. --ptxas-options="-v" --maxrregcount=128 -o Algo256/keccak256.o -c Algo256/keccak256.cu
:info:build ptxas info : 0 bytes gmem
:info:build ptxas info : Compiling entry function '_Z20skein256_gpu_hash_32jjPy' for 'sm_30'
:info:build ptxas info : Function properties for _Z20skein256_gpu_hash_32jjPy
:info:build 16 bytes stack frame, 12 bytes spill stores, 12 bytes spill loads
:info:build ptxas info : Used 63 registers, 336 bytes cmem[0], 8 bytes cmem[2]
:info:build Algo256/keccak256.cu(39): error: thread-local variable cannot be dynamically initialized
:info:build 1 error detected in the compilation of "/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_00000c0b_00000000-11_keccak256.compute_30.cpp1.ii".
:info:build make[2]: *** [Algo256/keccak256.o] Error 1
I’ve successfully compiled tpruvot’s version of ccminer on macos with cuda 9.1. Perhaps you can compare cu files and find a diff causing the error.
Looks like there are modified configure.ac and Makefile.am
I think C++11 is probably not enabled if you get the error "thread-local variable cannot be dynamically initialized" because then GCC thinks nullptr is a variable. The Linux people don't have a problem with this.
Please try it again with clang
Still fails... here is the code. I will also make sure I am using the correct C++ library.
:info:build /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I/opt/local/include -I/opt/local/include -fno-strict-aliasing -I/usr/local/cuda/include -DUSE_WRAPNVML -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -I/usr/local/llvm/lib/clang/4.0.0/include -I/opt/local/include -pipe -Os -stdlib=libc++ -arch x86_64 -MT ccminer-myriadgroestl.o -MD -MP -MF .deps/ccminer-myriadgroestl.Tpo -c -o ccminer-myriadgroestl.o `test -f 'myriadgroestl.cpp' || echo './'`myriadgroestl.cpp
:info:build groestlcoin.cppmyriadgroestl.cpp::55:40:36: error: initializer for thread-local variable must be a constant expression
:info:build static THREAD uint32_t *h_found = nullptr;
:info:build ^~~~~~~
:info:build 40: error: initializer for thread-local variable must be a constant expression
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__nullptr:49:17: note: expanded from macro 'nullptr'
:info:build #define nullptr _VSTD::__get_nullptr_t()
:info:build ^~~~~~~~~~~~~~~~~~~~~~~~
:info:build static THREAD uint32_t *foundNounce = nullptr;
:info:build ^~~~~~~
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:392:15: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__nullptrnote: expanded from macro '_VSTD'
:info:build #define _VSTD std::_LIBCPP_NAMESPACE
:info:build ^
:info:build :49:17: note: expanded from macro 'nullptr'
:info:build #define nullptr _VSTD::__get_nullptr_t()
:info:build ^~~~~~~~~~~~~~~~~~~~~~~~
:info:build /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:392:15: note: expanded from macro '_VSTD'
:info:build #define _VSTD std::_LIBCPP_NAMESPACE
:info:build ^
:info:build 1 error generated.
:info:build 1 error generated.
:info:build make[2]: *** [ccminer-myriadgroestl.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....
:info:build make[2]: *** [ccminer-groestlcoin.o] Error 1
Look like I am using libc++, which supports C++11 if I am not mistaken.
I think you need the -std=c++11
option
When I set with -std=c++11 I get a similar error. To be clear, should I still have -stdlib=libc++ set as a cxx flag?
:info:build /usr/local/cuda/bin/nvcc -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_37,code=sm_37 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_30,code=sm_30 -I/usr/local/cuda/include -I. --ptxas-options="-v" --maxrregcount=128 -o Algo256/keccak256.o -c Algo256/keccak256.cu
:info:build Algo256/keccak256.cu(39): error: thread-local variable cannot be dynamically initialized
:info:build 1 error detected in the compilation of "/opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_0000100b_00000000-11_keccak256.compute_30.cpp1.ii".
:info:build make[2]: *** [Algo256/keccak256.o] Error 1
Try -std=c++11 as a nvcc option. I don't know if the -stdlib=libc++ is needed
Thanks. Sorry, I know little about this stuff. How do I add that as an nvcc option?
Did you try the build.sh script?
I did not. I will look that over tomorrow. Thanks.
I did not see any cuda options in build.sh, but I saw some cuda configuration options in configure.sh. I added -std=c++11 after Xcompiler, but it still isn't putting it in nvcc's build commands. Do you know the proper way to set this? Or do I need to manually edit build.sh or the Makefile somehow.
CUDA_CFLAGS="-O3 -std=c++11 -Xcompiler -std=c++11,-fno-strict-aliasing,-Wall -D_FORCE_INLINES" ./configure CXXFLAGS="-O3 $extracflags" --with-cuda=/usr/local/cuda --with-nvml=libnvidia-ml.so
But build command is:
:info:build /usr/local/cuda/bin/nvcc -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_37,code=sm_37 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_30,code=sm_30 -I/usr/local/cuda/include -I. --maxrregcount=128 -o Algo256/keccak256.o -c Algo256/keccak256.cu
Although I'm looking at this, and I'm noticing it is looking for libnvidia-ml.so, which as far as I know doesn't come with the Mac CUDA drivers. I believe the proper library is libcuda.dylib on a Mac, but I'll need to do more research.
Under Linux the build.sh script is working as it is, no need to add -std=c++11 there
OK, so I managed to get -std=c++11 into nvcc by editing Makefile.am like here:
nvcc_FLAGS = $(nvcc_ARCH) @CUDA_INCLUDES@ -I. @CUDA_CFLAGS@ -std=c++11
Now it is complaining it can't find libomp, which is strange because I have it installed, so I will figure out what's going on there and let you know. And I also thought I'd let you know that you are the most dedicated maintainer that I have ever come across. We are at 28 comments at this point, and you have been very patient with someone that knows very little about C++, CUDA, and Automake. You may be at Saint-like status at this point. Thanks.
I had to hack in my noncompliant openmp directory into Makefile.am as:
ccminer_LDFLAGS += -L/usr/local/llvm/lib -I/opt/local/include/libomp -L/opt/local/lib/libomp
but it built! There are a few rpath issues I'm gonna have to fix, but I think we can call this solved. I'm gonna fork this, and hopefully never have to worry about it again. And again, I can't thank you enough. Thanks for all your help.
At the risk of embarrassing myself, would the following message mean that the GTX 650 😬 isn't supported? Or is something not right with my install?
GPU #0: this GPU is not supported
I think neoscrypt is broken for these kind of old cards, but when you want to test it you could make two small changes:
In this line: https://github.com/KlausT/ccminer/blob/b33520863d12856c0411826a7d0af2f10c0185f1/neoscrypt/neoscrypt.cu#L46
remove the =
and in this line: https://github.com/KlausT/ccminer/blob/b33520863d12856c0411826a7d0af2f10c0185f1/Makefile.am#L141
add -gencode=arch=compute_30,code=sm_30
Great! I'll give it a shot. If not, no big deal. I was planning on upgrading soon anyway.
Unfortunately, it won't build with these changes. Thanks anyway.
:info:build ptxas /opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_000050de_00000000-5_cuda_neoscrypt_tpruvot.compute_30.ptx, line 17823; error : Instruction 'shf.r' requires .target sm_32 or higher
:info:build ptxas /opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_000050de_00000000-5_cuda_neoscrypt_tpruvot.compute_30.ptx, line 17834; error : Instruction 'shf.r' requires .target sm_32 or higher
:info:build ptxas /opt/local/var/macports/build/_Users_hackintosh_ports_devel_ccminer/ccminer/work/.tmp/tmpxft_000050de_00000000-5_cuda_neoscrypt_tpruvot.compute_30.ptx, line 20136; error : Instruction 'shf.r' requires .target sm_32 or higher
:info:build ptxas fatal : Ptx assembly aborted due to errors
:info:build make[2]: *** [neoscrypt/cuda_neoscrypt_tpruvot.o] Error 255
Just as an update, your changes let me run ccminer when I used a newer video card (GTX1070).
I am trying to build this on OS X but it is throwing a couple errors. I tried setting the --no-cpu-verify option but that wasn't even an option in ./configure --help. Does anyone know what the problem is? I'm using the windows-master distribution as that is what is recommended for *nix systems on Cuda 8.