xmr-stak-cpu 是XMR(门罗币) CPU 的开源挖矿程序.程序开发者的github地址为:https://github.com/fireice-uk/xmr-stak

本文将记录它的Linux编译与Windows编译过程:

1、Linux编译:(以CENTOS为例)

sudo yum install centos-release-scl epel-release
sudo yum install cmake3 devtoolset-4-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make git
scl enable devtoolset-4 bash
git clone https://github.com/fireice-uk/xmr-stak.git
mkdir xmr-stak/build
cd xmr-stak/build
cmake3 .. -DCUDA_ENABLE=OFF \
          -DOpenCL_ENABLE=OFF \
          -DMICROHTTPD_ENABLE=OFF
make install

编译之前,请确认自己是否变更对作者的捐赠比例,修改xmr-stak/xmrstak/donate-level.hpp文件,完成后,运行./xmr-stak-cpu,记得修改config.txt中的参数,具体请百度,教程很多

后台运行,怕样关闭xshell窗口也没关系:

nohup ./xmr-stak-cpu 

 

2、Windows编译:

https://www.visualstudio.com/downloads/下载安装VS2017社区版

安装过程中,添加

Desktop development with C++

VC++ 2015.3 v140 toolset for desktop

Win64 位CMake

CUDA

https://developer.nvidia.com/cuda-downloads

下载适合自己操作系统的CUDA最新版本,

  • CUDA/Develpment
  • CUDA/Visual Studio Integration (ignore the warning during the install that VS2017 is not supported)
  • CUDA/Runtime
  • Driver components

AMD APP SDK 3.0 (only needed to use AMD GPUs)

依赖OpenSSL / Hwloc和Microhttpd(相关版本兼容问题请考阅官方文档)

下载xmr-stak-dep

https://github.com/fireice-uk/xmr-stak-dep/releases/

https://github.com/fireice-uk/xmr-stak/releases  –Source code (zip)

解压下载后的压缩包到:C:\xmr-stak-dep

打开cmd:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
cd c:\xmr-stak-dep\xmr-stak-2.2.0
set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
cmake --build . --config Release --target install

复制C:\xmr-stak-dep\openssl\bin\* . 到编译好的build–xmr-stak.exe一起
完成(注意路径)

如果只编译CPU可以修改命令行加参数:

cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF

编译前根据自己需要是否修改捐赠:xmr-stak-dep\xmr-stak-2.2.0\xmrstak\donate-level.hpp比例