Compiling Altcoin on Mac OS 10.11

Posted By : Chandan Kumar Singh | 18-Dec-2017

In the last blog, we have compiled the windows and Linux build. In this blog, we will compile our Funcoin on Mac OS 10.11.

First, install the required library OSX command line tool.

xcode-select --install

When the popup appears, click on install.

Next Install Homebrew,

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

Now install othere dependent pacages.

brew install automake berkeley-db4 libtool boost --c++11 miniupnpc openssl pkg-config protobuf --c++11 libevent

brew install librsvg

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

brew install qrencode

Install QT 4.8.7 open source.

QT 4.8.7

Untar the file then

cd qt-everywhere-opensource-src-4.8.7

./configure

Make

Sudo make -j2 install

Next, we will compile the coin code,

cd /home/ubuntu/funcoin

/usr/local/Trolltech/Qt-4.8.7/bin/qmake RELEASE=1 USE_UPNP=- USE_QRCODE=1 -o Makefile Funcoin-qt.pro

It will generate Makefile, then run 

make

You might get the error, 

clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.5.sdk'

Solution: 

Edit makefile and change sysroot path to/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

Then change 10.4 & 10.5 to 10.11 in every place of Makefile

next, error might get,
 
src/bignum.h:10:10: fatal error: 'openssl/bn.h' file not found

Solution:

Add openssl include path and Lib path in Makefile

INCPATH= -I/usr/local/Cellar/openssl/1.0.2l/include

LIBS= -L/usr/local/Cellar/openssl/1.0.2l/lib

Next, error might get,

src/util.h:23:10: fatal error: 'boost/thread.hpp' file not found

Solution:

INCPATH= -I/usr/local/boost-1.64.0/include

Next, error might get,

src/qt/macdockiconhandler.mm:50:39: error: assigning to 'objc_object *' from incompatible type
      'DockIconClickEventHandler *'

Solution

follow above link and make changes.

Next, error might get,

serialize.h:829:10: error: class member cannot be redeclared

Solution:

Edit src/serialize.h

Remove insert code

from Line 817 to 827

/* void insert(iterator it, const_iterator first, const_iterator last)
    {
        if (it == vch.begin() + nReadPos && last - first <= nReadPos)
        {
            // special case for inserting at the front when there's room
            nReadPos -= (last - first);
            memcpy(&vch[nReadPos], &first[0], last - first);
        }
        else
            vch.insert(it, first, last);
    }*/

Next, error,

db.h:15:10: fatal error: 'db_cxx.h' file not found

Solution:

INCPATH= -I/opt/local/include -I/usr/local/BerkeleyDB.4.8/include

LIBS= -L/usr/local/BerkeleyDB.4.8/lib

Next error,

src/qt/transactiondesc.cpp:249:19: error: variable has incomplete type 'CTxDB'

Solution:

Edit src/qt/transactiondesc.cpp

Add #include "walletdb.h"

Next error,

qrcodedialog.cpp:9:10: fatal error: 'qrencode.h' file not found

Solution:

INCPATH= -I/usr/local/Cellar/qrencode/3.4.4/include

NOTE: make clean after each issue

After running above steps we will get funcoin-temp.dmg file, next we will make funcoin.dmg

export QTDIR=/usr/local/Trolltech/Qt-4.8.7
T=$(contrib/qt_translations.py $QTDIR/translations src/qt/locale)

echo $T 

it will print like

cs,da,de,es,fa,he,hu,lt,pl,ru,sk,sv,uk,zh_CN,zh_TW

edit contrib/macdeploy/fancy.plist file

Change PPcoin-Qt.app to Funcoin-Qt.app

edit contrib/macdeploy/macdeployqtplus file and Change "disk" : "PPcoin-Qt", to "disk" : "Funcoin-Qt"

Now final command to get Funcoin.dmg

python contrib/macdeploy/macdeployqtplus Funcoin-Qt.app -add-qt-tr $T -dmg -fancy contrib/macdeploy/fancy.plist -verbose 2

You will get FuncoinQt.dmg, this will run on  Mac 10.11 and above version. 

Thanks.

About Author

Author Image
Chandan Kumar Singh

Chandan is a bright Web Developer with expertise in Java and Spring framework and ORM tools Hibernate. He loves technologies like Blockchain and IoT.

Request for Proposal

Name is required

Comment is required

Sending message..