xmrig / xmrig-cuda

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

Compile issue on CentOS 6 #6

Closed m8522s closed 4 years ago

m8522s commented 5 years ago

Hi. I noticed a compile issue on CentOS 6 with GCC 6.3.1 and would like to share the details including a solution/workaround.

First, gcc doesn't know about some options, so I need to replace them in the file cmake/flags.cmake: Replace std=c++11 by std=c++0x Replace Ofast by O2

The error message during make is:

In file included from /usr/src/xmrig-cuda-1.0.0-beta/src/cryptonight.h:30:0,
                 from /usr/src/xmrig-cuda-1.0.0-beta/src/xmrig-cuda.cpp:26:
/usr/src/xmrig-cuda-1.0.0-beta/src/crypto/common/Algorithm.h:93:5: error: ‘size_t’ does not name a type
     size_t l2() const
     ^~~~~~

To fix this, I added an include statement in line 29 of file src/crypto/common/Algorithm.h

#include <sys/types.h>

That way, make completes without errors and produces a working libxmrig-cuda.so

xmrig commented 4 years ago

Please show cmake output from fresh start, I fix -Ofast and size_t (by adding <cstddef> header), but this gcc version should understand std=c++11. Thank you.

m8522s commented 4 years ago
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for __builtin___clear_cache
-- Looking for __builtin___clear_cache - found
-- Found CUDA: /usr/local/cuda (found suitable version "9.1", minimum required is "8.0") 
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/xmrig-cuda/build
m8522s commented 4 years ago

I also cloned the git repository locally and re-done the compilation steps. Now it compiles with out issue. Thanks for fixing.