Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Latest commit

 

History

History
97 lines (59 loc) · 3.47 KB

mac.md

File metadata and controls

97 lines (59 loc) · 3.47 KB

Mac Build Notes (macOS 10.12+)

Install XCode and XCode command line tools

  • Test if XCode command line tools are installed:

    xcode-select -p
    
  • If the command does not print the location of the XCode command-line tools successfully:

    xcode-select --install
    
  • Select XCode location:

    sudo xcode-select -s <path/to/Xcode.app>
    
  • Install brew (follow instructions on brew.sh)

Clone MultiChain

Install git from git-scm, then

git clone https://github.com/MultiChain/multichain.git

Prepare to download or build V8

cd multichain
set MULTICHAIN_HOME=$(pwd)
mkdir v8build
cd v8build

You can use the pre-built headers and binaries of Google's V8 JavaScript engine by downloading and expanding macos-v8.tar.gz in the current directory. If, on the other hand, you prefer to build the V8 component yourself, please follow the instructions in V8_mac.md.

Install dependencies

brew install autoconf automake berkeley-db4 libtool [email protected] pkg-config rename python@2 nasm
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
brew link [email protected] --force

If another Boost version was already installed, then do this:

brew uninstall boost
brew install [email protected]
brew link [email protected] --force

Prepare for static linking

Apple does not support statically linked binaries as documented here, however, it is convenient for end-users to launch a binary without having to first install brew, a third-party system designed for developers.

To create a statically linked MultiChain which only depends on the default MacOS dylibs, the following steps are taken:

  1. Hide the brew boost dylibs from the build system:

     rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/boost\@1.57/lib/*.dylib
    
  2. Hide the brew berkeley-db dylibs from the build system:

     rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/berkeley-db\@4/lib/*.dylib
    
  3. Hide the brew openssl dylibs from the build system:

     rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/openssl/lib/*.dylib
    

The default brew cookbook for berkeley-db and boost builds static libraries, but the default cookbook for openssl only builds dylibs.

  1. Tell brew to build openssl static libraries:

     brew uninstall --ignore-dependencies openssl
     brew tap-new $USER/old-openssl
     brew extract --version=1.0.2q openssl $USER/old-openssl
     brew install [email protected]
     export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
     export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
     export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
     brew edit openssl
    

Compile MultiChain for Mac (64-bit)

cd $MULTICHAIN_HOME
./autogen.sh
./configure --with-gui=no --with-libs=no --with-miniupnpc=no
make

Clean up

rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/berkeley-db\@4/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/boost/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/openssl/lib/*.dylib.hidden
brew edit openssl

In 'def install' => 'args =' change 'no-shared' to 'shared'

Notes

  • This will build multichaind, multichain-cli and multichain-util in the src directory.