Skip to content

x_dev Compiling

Martin Bammer edited this page Jun 19, 2018 · 5 revisions

The supported way to compile creepMiner is to use conan in combination with CMake.

note: please do this only if you have experience in what you are doing.

Installing dependencies and conan

  1. Install python
  2. Install pip curl https://bootstrap.pypa.io/get-pip.py | sudo python
  3. Install conan sudo pip install conan

Fetch creepMinder code

  • git clone https://github.com/Creepsky/creepMiner (Stable brach)
  • git clone -b development https://github.com/Creepsky/creepMiner (Dev brach)

Compiling

  • cd creepMiner
  • conan install . --build=missing -s compiler.libcxx=libstdc++11
  • cmake CMakeLists.txt -DCMAKE_BUILD_TYPE=RELEASE -DNO_GPU=ON
  • make -j$(nproc)
cmake CMakeLists.txt
    -DCMAKE_BUILD_TYPE={DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO}
    [-b <your/binary/path>]
    [-DCMAKE_INSTALL_PREFIX:PATH=<your/install/path>]
    [-DNO_GPU={ON|OFF}]
    [-DMINIMAL_BUILD={ON|OFF}]
    [-DUSE_SSE4={ON|OFF}]
    [-DUSE_AVX={ON|OFF}]
    [-DUSE_AVX2={ON|OFF}]
    [-DUSE_CUDA={ON|OFF}]
    [-DUSE_OPENCL={ON|OFF}]

Have a look at what the different CMake flags mean.

OS specific instructions

Please see bellow for OS specific instructions, they might differ from the above

Ubuntu

If you want to use your GPU, install the latest CUDA SDK

wget https://developer.nvidia.com/compute/cuda/9.1/Prod/local_installers/cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64
sudo dpkg -i cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64.deb
sudo apt-key add /var/cuda-repo-9-1-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda libssl-dev ocl-icd-opencl-dev

If you already ran conan before remember to delete the cache:

find . -iwholename '*cmake*' -not -name CMakeLists.txt -delete 

If you are using 18.04 and want to compile creepMiner with CUDA support then you have to force using gcc version 6:

export CC=/usr/bin/gcc-6
export CXX=/usr/bin/g++-6
conan install . --build=missing -s compiler.libcxx=libstdc++11 -s compiler.version=6

Now you can call cmake with your desired options.

macOS

  • brew install cmake
  • conan install . --build=missing
  • cmake CMakeLists.txt -DCMAKE_BUILD_TYPE=RELEASE -DNO_GPU=ON
  • make -j$(nproc)
  • cp -r resources\public bin\ && cd bin && ./creepMiner

If you want to use CUDA download the CUDA Toolkit 9.1 local installer, and lunch the downloaded installer package.

Set up the development environment by modifying the PATH and DYLD_LIBRARY_PATH variables:

export PATH=/Developer/NVIDIA/CUDA-9.1/bin${PATH:+:${PATH}}
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.1/lib\
                           ${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}

Windows

What you need before you start

OpenSSL

The compilation of OpenSSL on Windows is not an easy task.

But there is a workaround for this problem: you can simply use a precompiled version of it. There are plenty of sites that offers such precompiled versions, for example https://www.npcglib.org or http://p-nand-q.com. Only download it from sites that you trust!

Compile POCO

  1. download the POCO source code (Complete Edition)
  2. edit the file components, empty it and enter:
Foundation
XML
JSON
Util
Net
Crypto
NetSSL_OpenSSL
  1. open your console and execute buildwin 140 build static_md release x64 nosamples notests msbuild env minimal

Compile the miner

  1. clone the git repository (git clone https://github.com/Creepsky/creepMiner)
  2. go to the cloned directory (cd creepMiner)
  3. create a project with CMake (cmake -DCMAKE_BUILD_TYPE=RELEASE ... -G "Visual Studio 15 2017 Win64")
  4. open the project
  5. compile it

CentOS

Tested on a clean minimal installation: http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso

update the system & reboot

  • sudo yum -y update && sudo reboot

install Extra Packages for Enterprise Linux

  • sudo yum -y install epel-release

install Software Collections (www.softwarecollections.org). It gives you the power to build, install, and use multiple versions of software on the same system, without affecting system-wide installed packages.

  • sudo yum -y install centos-release-scl

add the devtoolset-4 collection, which includes gcc 5.3.1

  • sudo yum -y install devtoolset-4

install cmake3, git and pip

  • sudo yum -y install cmake3 git python-pip

upgrade pip

  • sudo pip install --upgrade pip

install conan

  • sudo pip install conan

enable devtoolset-4 software collection you get a "virtual" environment which includes gcc 5.3.1:

$ gcc --version
scl enable devtoolset-4 bash

download creepminer

git clone https://github.com/Creepsky/creepMiner
cd creepMiner

configure cmake3 to be used during installation NOTE: this is not the correct way to use cmake3, see: https://stackoverflow.com/questions/48831131/cmake-on-linux-centos-7-how-to-force-the-system-to-use-cmake3/48842999#48842999

mkdir cmake && ln -s $(which cmake3) cmake/cmake
export PATH=$(pwd)/cmake:$PATH

check version (should be 3.x)

  • cmake --version

compile NOTE: conan install . --build=missing downloads prebuilt packeges linked to incompatible libs

conan install . --build
cmake CMakeLists.txt -DCMAKE_BUILD_TYPE=RELEASE -DNO_GPU=ON
make

exit from devtoolset-4 software collection environment

  • exit

CUDA

Like for Poco, CUDA needs an environment variable too.

The name for the variable must be CUDA_ROOT and have to target the root directory of CUDA.

Note: CUDA only works with certain versions of clang or gcc If your system has a different version you can use that flag to set it.

For example if your version of cuda accepts gcc up to version 6 & your version is 7 use: -DCUDA_HOST_COMPILER=/usr/bin/gcc-6