LoginSignup
34
27

More than 5 years have passed since last update.

BitZenyのMinerをMac OS Xでビルドして採掘する

Last updated at Posted at 2017-11-22

はじめに

先日はUbuntuでビルドする記事を書きましたが,Macでビルドするのに情報が少なく苦労したので共有します.

環境

  • MacBook Pro (Retina, 13-inch, Late 2013)
  • macOS Sierra 10.12.6
  • Xcode Command Line Tools, homebrewはインストール済

依存関係のインストール

$ brew install curl jansson openssl automake autoconf

brewでインストールするだけではopensslのパスが通らないので,opensslのパスを通します.

$ echo 'export PATH=/usr/local/opt/openssl/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile

opensslのパスが変わっていることを確認します.

$ which openssl
/usr/local/opt/openssl/bin/openssl

pthreadsをインストールします.

$ brew tap homebrew/php
$ brew install php56-pthreads

ビルド

リポジトリをクローンします.

$ git clone https://github.com/bitzeny/cpuminer.git
$ cd cpuminer

READMEの通りにコンパイルしようとすると,autoconfとlibcurl関連でエラーが出るので,少し手を加えます.

$ mkdir m4
$ cp /usr/local/opt/curl/share/aclocal/libcurl.m4 m4
$ echo ACLOCAL_AMFLAGS = -I m4 >> Makefile.am
$ sed -i -e "s/INCLUDES/AM_CPPFLAGS/g" Makefile.am
$ sed -i -e "s/aclocal/aclocal -I m4/g" autogen.sh

これでコンパイルできるようになると思います.

$ ./autogen.sh
$ ./nomacro.pl
$ ./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
$ make

私の環境ではこの手順でminerdを生成することができました.

[参考]
https://qiita.com/asymme/items/7c6aa8d9b59dd560b701
https://www.anintegratedworld.com/to-build-from-source-binary-or-tarball/

追伸(12/7)

@satoshigarage様,紹介ありがとうございます.
ブログを拝読して気になった点を修正しました.これでMakefile.amにダブルクォーテーションが残る問題及びINCLUDESで警告が出る問題は解決できると思います.

本記事に記載しているのはビルドの方法のみですので,マイニング初心者の方はSatoshi様のブログ(https://satoshisgarage.tech/?p=6484 )を参考にされることをお勧めします.

参考になればおひねりを頂けると嬉しいです.
ZNY: ZsZ7JiiWB2RTZQtnieXHJJsSgFVwQdHheS

34
27
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34
27