[Guide] Build FeathercoinD & Feathercoin-QT v0.9.3.1 on MacOS Sierra
-
Hi All,
Me again, the below is what I did to get Feathercoin 0.9.3.1 to build under MacOS Sierra 10.12
The following guide assumes you have a clean install of MacOS Sierra for your build environment
If you dont have a Mac to hand, you can use the below tutorial to get MacOS Sierra running on Windows in VMware Player, its what I did :-)
https://techsviewer.com/install-macos-sierra-vmware-windows/
I also enabled Remote Login in System Preferences -> Sharing, to allow SSH login so I can use puttyBecause we are doing this on MacOS Sierra, we have to use QT 5.7.0 as previous versions of QT are not supported.
QT 5.7.0 requires C++11 support and in order to build QT 5.7.0 with Homebrew, you need to have the full version of Xcode installed, not just the command-line tools. Grab Xcode free from the Apple Developer site and install it before continuing with the below. I used Xcode 8.2Step 0: Homebrew
Install homebrew with this command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 1: Install FeathercoinD & Feathercoin-QT dependencies
Boost v1.55.0
brew install homebrew/versions/boost155 --universal brew link boost155 --force --overwrite
Protobuf v2.6.0
brew install homebrew/versions/protobuf260 --c++11 --universal
brew install libevent --c++11 --universal brew install autoconf automake libtool miniupnpc openssl pkg-config brew install berkeley-db4 brew install libqrencode
QT 5.7.0
brew install qt5 --with-dbus brew link qt5 --force --overwrite
Notes:
It takes a while for the Brew install for QT on this VM with 2 Processors and 8GB RAM, so just let it sit there, you can see in the activity monitor your CPU should be maxed out
/usr/local/Cellar/qt5/5.7.0: 8,303 files, 328M, built in 171 minutes 58 secondszxing-cpp
In a new Terminal
brew install cmake mkdir zxing && cd zxing git clone https://github.com/glassechidna/zxing-cpp.git cd zxing-cpp/ ls mkdir build cd build/ export CXXFLAGS="-fPIC" cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. make && sudo make install
Locate and edit the LuminanceSource.h file in /usr/local/include/zxing and change line 30 to “
public:
” instead of “private:
” if you dont do this FTC will throw a different zxing error on compile…Step 2: Build FeathercoinD & Feathercoin-QT
In a new Terminal window
git clone https://github.com/FeatherCoin/Feathercoin.git -b 0.9.3.1 FTC0931 cd FTC0931 ./autogen.sh ./configure --disable-upnp-default --disable-tests --without-miniupnpc LDFLAGS="-L/usr/local/opt/berkeley-db4/lib/ -L/usr/local/opt/qrencode/lib/" CPPFLAGS=" -I/usr/local/opt/berkeley-db4/include/ -I/usr/local/opt/qrencode/include/" --with-gui=qt5 --with-qrcode=yes make
At this point the compiler will start chugging away and you can go make yourself coffee.
Building and Troubleshooting issues
Some of the below issues and fixes are not a reflection on the Feathercoin code but are more to do with the way MacOS does things and the fact you’re forced to use certain things because it’s the latest/newest OS from Apple.
The reason why I’ve included them here is so that:
A: We can get a final build :-)
B: So the Feathercoin Developers get a heads up and will hopefully help them with future releasesOk lets start.
Around half way during the compile, once it’s passed FeathercoinD and moved on to the QT part you’ll get this error:
Build Error 1:
error: "Qt requires C++11 support
Fix
Navigate to the QT source directory FTC0931/src/qt
find theMakefile
and open it with a TextEditor or if you’re a cli person you can use vi
find theCPPFLAGS =
it should look like this:Before
CPPFLAGS = -I/usr/local/opt/berkeley-db4/include/ -I/usr/local/opt/qrencode/include/ -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -I/include -DMAC_OSX -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
Add this bit
-std=c++11
at the end so it looks like this:
After
CPPFLAGS = -I/usr/local/opt/berkeley-db4/include/ -I/usr/local/opt/qrencode/include/ -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -I/include -DMAC_OSX -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11
You’ll need to do the same for
OBJCXXFLAGS =
Before
OBJCXXFLAGS = -g -O2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -fstack-protector-all -fPIE -fPIC
After
OBJCXXFLAGS = -g -O2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -fstack-protector-all -fPIE -fPIC -std=c++11
Go back to your Feathercoin build terminal and continue with the build
make
Build Error 2:
Undefined symbols for architecture x86_64: "_iconv", referenced from: zxing::aztec::Decoder::getEncodedData(zxing::Ref<zxing::BitArray>) in libzxing.a(Decoder.cpp.o) zxing::qrcode::DecodedBitStreamParser::append(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char const*, unsigned long, char const*) in libzxing.a(DecodedBitStreamParser.cpp.o)
go back to your qt makefile in FTC0931/src/qt and add the below to
LIBS =
at the begining where you see-lzxing -lqrencode
Add this
-liconv
Go back to your Feathercoin build terminal and continue with the build
make
It should end with this
OBJCXX feathercoin_qt-macdockiconhandler.o OBJCXX feathercoin_qt-macnotificationhandler.o OBJCXXLD feathercoin-qt clang: warning: argument unused during compilation: '-pie' make[1]: Nothing to be done for `all-am'. acids-Mac:FTC0931 acid$
Navigate to FTC0931/src/qt/ and the Feathercoin-QT Executable Binary should be there. Double click to run :-)
Note: That you will only be able to run this app on the machine you built it on, there’s a little bit more work if you want to make it a portable DMG that you can install on multiple macs without having to install all the dependencies. I’ll probably cover this later on, in a kind of “Part 2”
I hope this helps someone,
-
Notes for developers:
If you would like to use boost 1.62.0 (at time of writing, that’s the latest version)
You need to build boost from source like this:Download boost from here:
https://sourceforge.net/projects/boost/files/boost/1.62.0/Extract Boost and Build Boost 1.62.0
tar xjf boost-1.62.0.tar.bz2 cd boost_1_62_0 ./bootstrap.sh --prefix=/usr/local/Cellar/boost162/1.62.0 --libdir=/usr/local/Cellar/boost162/1.62.0/lib ./b2 --prefix=/usr/local/Cellar/boost162/1.62.0 --libdir=/usr/local/Cellar/boost162/1.62.0/lib -d2 -j4 --layout=tagged install threading=multi,single link=shared,static address-model=64 architecture=x86 pch=off cxxflags="-arch x86_64 -std=c++11 -stdlib=libc++" linkflags=-stdlib=libc++
If you look above i specifically used the /usr/local/Cellar directory and just named the boost install directory “boost162” that way you can do a “brew link boost162” if you need it to sym link correctly on MacOS.
Once the above is done, build Feathercoin with this:
./configure --disable-upnp-default --disable-tests --without-miniupnpc LDFLAGS="-L/usr/local/opt/berkeley-db4/lib/ -L/usr/local/opt/qrencode/lib/" CPPFLAGS=" -I/usr/local/opt/berkeley-db4/include/ -I/usr/local/opt/qrencode/include/" CXXFLAGS="-arch x86_64 -std=c++11 -stdlib=libc++" --with-gui=qt5 --with-qrcode=yes --with-boost=/usr/local/Cellar/boost162/1.62.0 --with-boost-libdir=/usr/local/Cellar/boost162/1.62.0/lib
I hope this helps someone.
-
-
Make Deploy
Once you’ve built Feathercoin-QT with “make” you have the option of running the command “make deploy”, this will run stuff from the contrib/macdeploy folder. Make deploy makes a DMG for distribution.
If you did not symlink your boost libs correctly in MacOS you might get this error below
Terminal Output
acids-Mac:FTC-DMG acid$ make deploy ./contrib/macdeploy/macdeployqtplus Feathercoin-Qt.app -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -dmg -fancy ./contrib/macdeploy/fancy.plist -verbose 2 + Removing old dist folder + + Copying source bundle + + Deploying frameworks + Processing libboost_system.dylib ... Error: No file at libboost_system.dylib Traceback (most recent call last): File "./contrib/macdeploy/macdeployqtplus", line 583, in <module> sys.exit(ret) NameError: name 'ret' is not defined make: *** [Feathercoin-Qt.dmg] Error 1
How to Fix
First check what the Feathercoin-Qt App is using
We can use otool
you can read more about otool here: http://www.manpagez.com/man/1/otool/cd src/qt/ otool -L Feathercoin-Qt /* acids-Mac:qt acid$ otool -L Feathercoin-Qt Feathercoin-Qt: libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0) libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0) libboost_program_options-mt.dylib (compatibility version 0.0.0, current version 0.0.0) libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0) libboost_chrono-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1349.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1504.0.0) /usr/local/opt/qt5/lib/QtDBus.framework/Versions/5/QtDBus (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/protobuf260/lib/libprotobuf.9.dylib (compatibility version 10.0.0, current version 10.0.0) /usr/local/opt/berkeley-db4/lib/libdb_cxx-4.8.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/qrencode/lib/libqrencode.3.dylib (compatibility version 8.0.0, current version 8.4.0) /usr/local/opt/miniupnpc/lib/libminiupnpc.16.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.1.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 775.8.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) */
You can see above, my boost libs dont have the correct path.
We need to use another tool called “install_name_tool” to reset the boost libs locationThe Syntax is
install_name_tool -change before after executable
I have my boost libs installed in /usr/local/opt/boost162/lib/
install_name_tool -change libboost_system.dylib /usr/local/opt/boost162/lib/libboost_system-mt.dylib Feathercoin-Qt install_name_tool -change libboost_filesystem.dylib /usr/local/opt/boost162/lib/libboost_filesystem-mt.dylib Feathercoin-Qt install_name_tool -change libboost_program_options-mt.dylib /usr/local/opt/boost162/lib/libboost_program_options-mt.dylib Feathercoin-Qt install_name_tool -change libboost_thread-mt.dylib /usr/local/opt/boost162/lib/libboost_thread-mt.dylib Feathercoin-Qt install_name_tool -change libboost_chrono-mt.dylib /usr/local/opt/boost162/lib/libboost_chrono-mt.dylib Feathercoin-Qt
Now we can verify with otool again
otool -L Feathercoin-Qt /* acids-Mac:qt acid$ otool -L Feathercoin-Qt Feathercoin-Qt: /usr/local/opt/boost162/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/boost162/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/boost162/lib/libboost_program_options-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/boost162/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/boost162/lib/libboost_chrono-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1349.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1504.0.0) /usr/local/opt/qt5/lib/QtDBus.framework/Versions/5/QtDBus (compatibility version 5.7.0, current version 5.7.0) /usr/local/opt/protobuf260/lib/libprotobuf.9.dylib (compatibility version 10.0.0, current version 10.0.0) /usr/local/opt/berkeley-db4/lib/libdb_cxx-4.8.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/qrencode/lib/libqrencode.3.dylib (compatibility version 8.0.0, current version 8.4.0) /usr/local/opt/miniupnpc/lib/libminiupnpc.16.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.1.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 775.8.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) */
Continue with the make deploy
cd ../.. make deploy
when the make deploy is over you should have a Feathercoin-Qt.dmg created in the root of your project directory. When you run the DMG you should see the below.
I hope this helps someone.
-
This guide is still valid for the current 0.9.6.1 branch
0.9.6.1 also builds with boost 1.64.0 and QT 5.8