Compiling xmr-stak v2.2.0 for Monero on MacOS High Sierra

in #mining7 years ago (edited)


After I updated my system from El Capitan to High Sierra, I wanted to use xmr-stak but my version that I compiled under El Capitan doesn't worked anymore. So I decided to compile it new. 

My System was updated and Xcode 9.2 with newest Nvidia Driver was installed.

After downloading xmr-stak v2.2 and starting compiling it, I got errors regarding the CUDA Drivers.

Here is my Howto to get it working.


1. Install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


2. Downgrade Xcode to 8.2

- Download Xcode.app from here (https://download.developer.apple.com/Developer_Tools/Xcode_8.2/Xcode_8.2.xip)

- Rename the new 9.2 version to something like Xcode_9.2.app

- Install (unpack) to the Library

3. Downgrade Commandline Tools

- Download CLT for Xcode 8.2 from here (https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_macOS_10.12_for_Xcode_8.2/Command_Line_Tools_macOS_10.12_for_Xcode_8.2.dmg)

- Install CLT Package

4. Downgrade CUDA Toolkit to version 8.0.61

- Download cuda_8.0.61_mac.dmg from https://developer.nvidia.com/cuda-80-ga2-download-archive

- Install CUDA Toolkit

5. Reboot

6. Verify that clang version is 8.0.0:

$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)


7. Download xmr-stak

- Download from https://github.com/fireice-uk/xmr-stak/archive/v2.2.0.zip

- make a Directory eg. /Users/username>/Desktop/dev/xmr-stak

- extract the zip file to that directory

- cd to that directory


8. Compile and Install

$ brew install hwloc libmicrohttpd gcc openssl cmake
$ cmake . -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOpenCL_ENABLE=OFF -DXMR-STAK_CURRENCY=monero
$ make install


Note: With "-DCUDA_COMPILER=clang" I get an error (clang: error: Unsupported CUDA gpu architecture: sm_60...) so I don't use it!


9. After successfully compiling change the CUDA Driver in the Preferences to the lastest version

10. Run xmr-stak

$ ./xmr-stak 

[2018-02-06 18:19:38] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:38] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:39] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:39] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:39] : MEMORY ALLOC FAILED: mmap failed

-------------------------------------------------------------------

xmr-stak 2.2.0 c4400d19


Brought to you by fireice_uk and psychocrypt under GPLv3.

Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).

Based on NVIDIA mining code by KlausT and psychocrypt.


Configurable dev donation level is set to 2.0%


You can use following keys to display reports:

'h' - hashrate

'r' - results

'c' - connection

-------------------------------------------------------------------

[2018-02-06 18:19:39] : Start mining: MONERO

[2018-02-06 18:19:39] : Starting NVIDIA GPU thread 0, no affinity.

[2018-02-06 18:19:39] : WARNING on MacOS thread affinity is only advisory.

[2018-02-06 18:19:39] : Starting 1x thread, affinity: 1.

[2018-02-06 18:19:39] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:39] : hwloc: set_thisthread_membind not supported

[2018-02-06 18:19:39] : WARNING on MacOS thread affinity is only advisory.

[2018-02-06 18:19:39] : Starting 1x thread, affinity: 3.

[2018-02-06 18:19:39] : hwloc: set_thisthread_membind not supported

[2018-02-06 18:19:40] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:40] : MEMORY ALLOC FAILED: mmap failed

[2018-02-06 18:19:40] : Fast-connecting to xmr-eu.dwarfpool.com:8005 pool ...

[2018-02-06 18:19:40] : Pool xmr-eu.dwarfpool.com:8005 connected. Logging in...

[2018-02-06 18:19:40] : Difficulty changed. Now: 20000.

[2018-02-06 18:19:40] : Pool logged in.

[2018-02-06 18:20:10] : Result accepted by the pool.

HASHRATE REPORT - CPU

| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |

|  0 |   53.1 |   (na) |   (na) |  1 |   50.1 |   (na) |   (na) |

-----------------------------------------------------

HASHRATE REPORT - NVIDIA

| ID |    10s |    60s |    15m |

|  0 |  256.2 |   (na) |   (na) |

---------------------------

Totals:    359.4   (na)   (na) H/s

Highest:   361.7 H/s

[2018-02-06 18:20:27] : Result accepted by the pool.


12. Now you can configure config.txt, cpu.txt and Nvidia.txt to get more H/s.

eg. nvidia.txt

"gpu_threads_conf" :

[

  // gpu: GeForce GTX 960 architecture: 52

  //      memory: 1672/2048 MiB

  //      smx: 8

  { "index" : 0,

    "threads" : 13, "blocks" : 24,

    "bfactor" : 8, "bsleep" :  25,

    "affine_to_cpu" : false, "sync_mode" : 3,

  },

],



I hope I have nothing forgotten.

Have Fun :)