Skip to content

Build Mac

HLXEasy edited this page Jun 7, 2021 · 7 revisions

Building Alias Wallet on Mac

The goal is to build the whole project using CMake. To do so, just follow the steps below.

Install required tools and libs

Git

Homebrew

  • See https://brew.sh/ and install according to the description there.
  • Install further packages as described below.

Runtime dependencies

  • BerkeleyDB (We need BerkeleyDB v4, so the installation must be pinned to this version)
  • Boost
  • OpenSSL
brew install berkeley-db@4 boost openssl

Build tools

  • cmake
  • wget (To download required components during build)
brew install cmake wget

Qt

Qt SDK can be found at https://www.qt.io/download-qt-installer. Here are the components from Qt SDK that we really need to compile Alias wallet application. Please keep Qt Creator selected as well!

Select the components from the latest 5.12 release as this is an LTS line. With newer versions up to 5.15.1 (at the time of this writing), the build will work but we've spot issues with a duplicated task bar icon. So it's perfectly fine to stay on the latest 5.12 version.

Required Qt components

Build Alias Wallet

Get sources

At first clone the Alias wallet repository:

mkdir -p ~/Documents/Coding/Alias
cd ~/Documents/Coding/Alias
git clone https://github.com/aliascash/alias-wallet 

Build on cmdline

Setup environment

Start the Mac build script a first time, so the required configuration files will be created:

cd alias-wallet
./scripts/cmake-build-mac.sh

Now there will be two configuration files created:

  • ~/.alias-buildconfig
  • ~/Documents/Coding/Alias/alias-wallet/scripts/.buildconfig

The first one is located directly on your home directory. It is meant to stay even if you cleanup a/o recreate the clone of the Alias repository. The second one is located inside the Git clone. You need to modify at least the location of your Qt installation on one of these two files. See variable QT_INSTALLATION_PATH and modify it to your needs.

Build wallet

Now you're ready to build. At first check the available options:

./scripts/cmake-build-mac.sh -h

Now lets build the wallet:

./scripts/cmake-build-mac.sh -g

The build result could be found on the folder cmake-build-cmdline-mac/ inside of the Git clone.

Open CLion > Preferences > Build, Execution, Deployment > CMake, expand CMake options and put in the following content:

-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER
-DENABLE_GUI=ON
-DQT_CMAKE_MODULE_PATH=/<your-path-to>/Qt/5.12.10/clang_64/lib/cmake
-DBOOST_INCLUDEDIR=/usr/local/Cellar/boost/1.76.0/include
-DBOOST_LIBRARYDIR=/usr/local/Cellar/boost/1.76.0/lib
-DBerkeleyDB_ROOT_DIR=/usr/local/opt/berkeley-db@4
-DBERKELEYDB_INCLUDE_DIR=/usr/local/opt/berkeley-db@4/include
-Dleveldb_DIR=/<your-path-to>/alias-wallet/cmake-build-cmdline-mac/local/lib/cmake/leveldb
-DLEVELDB_INCLUDE_DIR=/<your-path-to>/alias-wallet/cmake-build-cmdline-mac/local/include
-DOPENSSL_ROOT_DIR=/usr/local/Cellar/[email protected]/1.1.1k/lib;/usr/local/Cellar/[email protected]/1.1.1k/include
-DCMAKE_BUILD_TYPE=Debug

Now duplicate the whole Debug configuration and change name and build type to Release (if not done automatically). Put in the same content as above but change the last line to this:

-DCMAKE_BUILD_TYPE=Release

CLion Toolchain settings

Close the dialog.

With a click on the "Build-Hammer", you can trigger the build:

Perform build

To be documented...

Library Notes

During the build the archive https://github.com/aliascash/resources/raw/master/resources/Tor.libraries.Mac.zip will be downloaded and extracted. It contains the Tor binary and it's libraries. The archive is installed beside the Alias binary and required on runtime.