Update Nu to build on macOS Sierra

I’ve failed to build Nu under macOS Sierra and will try using Mountain Lion or Mavericks. Other coins have updated to support building on later versions, but the Makefiles for Nu appear outdated. makefile.osx-mavericks still references ppcoin.

Do any of you know what needs to be done? Are there deeper changes required than an updated Makefile and a proper build environment? I’d like anyone to be able to build Nu for macOS as without deterministic builds there will always be necessary trust in the builder.

@backpacker and @woodstockmerkle have built Nu for macOS before. I’ve seen @Sabreiib attempt it at least. Does @sigmike have any input?

It’s a solved problem, but I don’t know the procedure.

A thread at Bitcointalk wrestled the problem: https://bitcointalk.org/index.php?topic=732590.0

Paycoin has instructions for building on Mavericks: https://github.com/PaycoinFoundation/paycoin/blob/master/doc/build-osx-ports-mavericks.md

DigiCube with similar instructions but using Homebrew instead of MacPorts: https://github.com/DigiCubeCrypto/DigiCube/blob/master/doc/build-osx-brew-mavericks.txt

Current build instructions for Bitcoin on “OS X 10.8 through 10.12 on 64-bit Intel processors”: https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md

Build Nu in OS X Mountain Lion with Homebrew: https://bitbucket.org/JordanLeePeershares/nubit/src/cd6e9ee263579fc3e2cddd3cad1e6eef685112a5/doc/build-osx-brew.txt?at=master&fileviewer=file-view-default

Build Nu in OS X Mavericks with Homebrew (says to use makefile.osx): https://bitbucket.org/JordanLeePeershares/nubit/src/cd6e9ee263579fc3e2cddd3cad1e6eef685112a5/doc/build-osx-brew-mavericks.txt?at=master&fileviewer=file-view-default

https://bitbucket.org/JordanLeePeershares/nubit/src/cd6e9ee263579fc3e2cddd3cad1e6eef685112a5/doc/release-process.txt?at=master&fileviewer=file-view-default:

* perform Mac build
  See this blog post for how Gavin set up his build environment to build the OSX
  release; note that a patched version of macdeployqt is not needed anymore, as
  the required functionality and fixes are implemented directly in macdeployqtplus:
    http://gavintech.blogspot.com/2011/11/deploying-bitcoin-qt-on-osx.html
  Gavin also had trouble with the macports py27-appscript package; he
  ended up installing a version that worked with: /usr/bin/easy_install-2.7 appscript

  qmake RELEASE=1 USE_UPNP=1 USE_QRCODE=1 bitcoin-qt.pro
  make
  export QTDIR=/opt/local/share/qt4  # needed to find translations/qt_*.qm files
  T=$(contrib/qt_translations.py $QTDIR/translations src/qt/locale)
  python2.7 contrib/macdeploy/macdeployqtplus Bitcoin-Qt.app -add-qt-tr $T -dmg -fancy contrib/macdeploy/fancy.plist

Build output expected:
  Bitcoin-Qt.dmg

I strongly suggest you add the boost library path when configuring, otherwise you may get nasty “Undefined symbols for architecture x86_64” compilation errors.

http://www.gubatron.com/blog/2014/02/03/how-to-actually-build-bitcoin-on-mac-osx-10-9-1/

Build Nu for macOS

Using Mountain Lion

  • Download Xcode 5.1.1.
  • Install Xcode.
  • Launch Xcode.
  • Install Command Line Tools in Xcode > Preferences > Downloads.
  • Install Homebrew.
  • Follow instructions at bottom of output.
brew doctor
brew install curl
brew install boost berkeley-db4 openssl miniupnpc
brew link berkeley-db4 --force

May be unnecessary:

sudo mkdir -p /opt/local/lib
sudo ln -s /usr/local/lib /opt/local/lib/db48
git clone https://bitbucket.org/JordanLeePeershares/nubit.git
cd nubit/src
git checkout 4.0-stable

Instead of brew link openssl --force which doesn’t work (and may be unsafe), add OpenSSL in makefile.osx as below:

INCLUDEPATHS= \
 -I"$(CURDIR)" \
 -I"$(CURDIR)"/obj \
 -I"$(DEPSDIR)/include" \
 -I"$(DEPSDIR)/include/db48" \
 -I"$(DEPSDIR)/opt/openssl/include"

LIBPATHS= \
 -L"$(DEPSDIR)/lib" \
 -L"$(DEPSDIR)/lib/db48" \
 -L"$(DEPSDIR)/opt/openssl/lib"

Also remove -L"$(DEPSDIR)/lib/db48" \.

Build dynamically linked

make -f makefile.osx RELEASE=true 64BIT=true CXX=g++

Build statically linked

Add libssl.a, libcrypto.a, and -lcurl to makefile.osx as below. Remove db48/ before libdb_cxx-4.8.a.

ifdef STATIC
# Build STATIC if you are redistributing the nud binary
TESTLIBS += \
 $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a
LIBS += \
 $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
 $(DEPSDIR)/lib/libboost_system-mt.a \
 $(DEPSDIR)/lib/libboost_filesystem-mt.a \
 $(DEPSDIR)/lib/libboost_program_options-mt.a \
 $(DEPSDIR)/lib/libboost_thread-mt.a \
 $(DEPSDIR)/lib/libboost_chrono-mt.a \
 $(DEPSDIR)/opt/openssl/lib/libssl.a \
 $(DEPSDIR)/opt/openssl/lib/libcrypto.a \
 -lcurl \
 -lz
make -f makefile.osx RELEASE=true 64BIT=true STATIC=true DEPSDIR=/usr/local CXX=g++

Versions

berkeley-db@4 4.8.30
boost 1.63.0
curl 7.53.1
makedepend 1.0.5
miniupnpc 2.0
openssl 1.0.2k
pkg-config 0.29.1_2

Now to build statically and the Qt GUI.

ln -s /usr/local/lib /usr/local/lib/db48
git clone https://bitbucket.org/JordanLeePeershares/nubit.git
cd nubit/src
make -f makefile.osx RELEASE=true 64BIT=true STATIC=true DEPSDIR=/usr/local CXX=g++

With the following added under static libs in makefile.osx:

 $(DEPSDIR)/opt/openssl/lib/libssl.a \
 $(DEPSDIR)/opt/openssl/lib/libcrypto.a \
g++ -mmacosx-version-min=10.6 -O3 -arch x86_64 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter  -DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=0 -DUSE_IPV6=1 -I/Users/Esko/Nu/nubit/src/leveldb/include -I/Users/Esko/Nu/nubit/src/leveldb/helpers -DHAVE_BUILD_INFO -I"/Users/Esko/Nu/nubit/src" -I"/Users/Esko/Nu/nubit/src"/obj -I"/usr/local/include" -I"/usr/local/include/db48" -I"/usr/local/opt/openssl/include" -o nud -L"/usr/local/lib" -L"/usr/local/lib/db48" -L"/usr/local/opt/openssl/lib" obj/scanbalance.o leveldb/libleveldb.a obj/alert.o obj/version.o obj/checkpoints.o obj/netbase.o obj/addrman.o obj/crypter.o obj/key.o obj/db.o obj/init.o obj/keystore.o obj/main.o obj/net.o obj/protocol.o obj/bitcoinrpc.o obj/rpcdump.o obj/rpcnet.o obj/rpcmining.o obj/rpcwallet.o obj/rpcblockchain.o obj/rpcrawtransaction.o obj/rpcdividend.o obj/rpcliquidity.o obj/rpcpark.o obj/rpcvote.o obj/rpctest.o obj/script.o obj/sync.o obj/util.o obj/wallet.o obj/walletdb.o obj/kernel.o obj/checkpointsync.o obj/hash.o obj/bloom.o obj/noui.o obj/leveldb.o obj/txdb.o obj/distribution.o obj/vote.o obj/liquidityinfo.o obj/datafeed.o obj/blockmap.o -dead_strip /usr/local/lib/db48/libdb_cxx-4.8.a /usr/local/lib/libboost_system-mt.a /usr/local/lib/libboost_filesystem-mt.a /usr/local/lib/libboost_program_options-mt.a /usr/local/lib/libboost_thread-mt.a /usr/local/lib/libboost_chrono-mt.a /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a -lz /usr/local/lib/libminiupnpc.a /Users/Esko/Nu/nubit/src/leveldb/libleveldb.a /Users/Esko/Nu/nubit/src/leveldb/libmemenv.a
Undefined symbols for architecture x86_64:
  "_curl_easy_init", referenced from:
      DataFeedRequest::DataFeedRequest(std::string const&) in datafeed.o
  "_curl_easy_setopt", referenced from:
      DataFeedRequest::DataFeedRequest(std::string const&) in datafeed.o
  "_curl_easy_cleanup", referenced from:
      DataFeedRequest::~DataFeedRequest() in datafeed.o
  "_curl_easy_perform", referenced from:
      DataFeedRequest::Perform() in datafeed.o
  "_curl_easy_strerror", referenced from:
      DataFeedRequest::Perform() in datafeed.o
  "_curl_easy_getinfo", referenced from:
      DataFeedRequest::Perform() in datafeed.o
  "_curl_global_init", referenced from:
      AppInit2(boost::thread_group&) in init.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nud] Error 1

Add -lcurl to the same list:

ifdef STATIC
# Build STATIC if you are redistributing the nud binary
TESTLIBS += \
 $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a
LIBS += \
 $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
 $(DEPSDIR)/lib/libboost_system-mt.a \
 $(DEPSDIR)/lib/libboost_filesystem-mt.a \
 $(DEPSDIR)/lib/libboost_program_options-mt.a \
 $(DEPSDIR)/lib/libboost_thread-mt.a \
 $(DEPSDIR)/lib/libboost_chrono-mt.a \
 $(DEPSDIR)/opt/openssl/lib/libssl.a \
 $(DEPSDIR)/opt/openssl/lib/libcrypto.a \
 -lz \
 -lcurl
make -f makefile.osx RELEASE=true 64BIT=true STATIC=true DEPSDIR=/usr/local CXX=g++

Success!

Build Qt GUI

  • Download and install Qt 4.8.5.
  • Download and install Qt Creator 3.6.1.
  • Open nubit/nu.pro in Qt Creator.
  • Click ‘Configure Project’.
  • Click on the monitor icon on the left toolbar above Debug and change it to Release.
  • Click Build > Build Project “nu” (or press Command–B).

When it’s done, nu.app should be in the nubit directory. You can’t run it directly yet.

sudo ln -s /opt/local/lib /opt/local/lib/lib
sudo ln -s /opt/local/lib/db48/libdb_cxx-4.8.dylib /opt/local/lib/libdb_cxx-4.8.dylib
cd nubit
mkdir deploy
cp -r nu.app deploy
sudo macdeployqt deploy/nu.app

You can now run nubit/deploy/nu.app directly.

It’s not clear to me whether the next step is necessary:

install_name_tool -change "/opt/local/lib/db48/libdb_cxx-4.8.dylib" "@executable_path/../Frameworks/libdb_cxx-4.8.dylib" deploy/nu.app/Contents/MacOS/Nu

Change

nubit/nu.pro:3

macx:TARGET = "nu"

Uppercase to build Nu.app.

nubit/nu.pro:4

VERSION = 2.1.0

Current version is 4.0.0.

nubit/src/qt/guiutil.cpp:440

setWindowTitle(tr("Bitcoin-Qt"));

Change “Bitcoin-Qt” to “Nu”.

nubit/share/qt/Info.plist:5-6

<key>CFBundleIconFile</key>
<string>bitcoin.icns</string>

Change to nu.icns.

nubit/share/qt/Info.plist:17-18

<key>CFBundleExecutable</key>
<string>Bitcoin-Qt</string>

Change to Nu.

nubit/share/qt/Info.plist:19

<key>CFBundleName</key>
<string>Nu</string>

Add.

Issue: Info.plist isn’t applied to the build.

Turns out branch “master” isn’t 4.0.0. Branch “4.0-stable” builds the same, thankfully. Just need a few cosmetic adjustments as the ones above. Not sure yet how to specify them in the project, as nubit/share/qt/Info.plist doesn’t exist in that branch. Can set them manually until that’s figured out.

Nu 4.0.0 for macOS

https://github.com/jooize/Nu-macOS/releases/download/4.0.0/Nu-4.0.0.dmg

shasum -a 256 Nu-4.0.0.dmg
cc297b0f99b6acd6f82689a28a35e50ea739e95bf1323c6487bfe84cdaaa66e8  Nu-4.0.0.dmg

3 Likes