X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=doc%2Fbuild-osx.txt;h=0531156f188cbc885505d044150807e369e79a0e;hb=373cf9437924e0df8d1899943e6476f33f62e559;hp=ddf025003b35522a64b5050036a24f76b304fa2a;hpb=d8dda9de84eec34fa27dfb6be7c6bb0ab09de0d2;p=novacoin.git diff --git a/doc/build-osx.txt b/doc/build-osx.txt index ddf0250..0531156 100644 --- a/doc/build-osx.txt +++ b/doc/build-osx.txt @@ -1,278 +1,136 @@ -Copyright (c) 2010 Laszlo Hanyecz -Portions Copyright (c) 2011 Douglas Huff -Distributed under the MIT/X11 software license, see the accompanying file -license.txt or http://www.opensource.org/licenses/mit-license.php. This -product includes software developed by the OpenSSL Project for use in the -OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic -software written by Eric Young (eay@cryptsoft.com) and UPnP software written by -Thomas Bernard. +Mac OS X Build Instructions and Notes +==================================== +This guide will show you how to build novacoind(headless client) for OSX. - -Mac OS X build instructions -Laszlo Hanyecz -Douglas Huff - - -Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian. - -All of the commands should be executed in Terminal.app.. it's in -/Applications/Utilities - -You need to install XCode with all the options checked so that the compiler and -everything is available in /usr not just /Developer I think it comes on the DVD -but you can get the current version from http://developer.apple.com - - -1. Pick a directory to work inside.. something like ~/bitcoin works. The -structure I use looks like this: - -(~ is your home directory) - -~/bitcoin -~/bitcoin/bitcoin # Upstream source tree -~/bitcoin/src # source code (symlink to ~/bitcoin/bitcoin/src) -~/bitcoin/deps # dependencies.. like libraries and headers needed to compile -~/bitcoin/Bitcoin.app # the application bundle where you can run the app - -Just execute: mkdir ~/bitcoin -This will create the top dir for you.. - -WARNING: do not use the ~ notation with the configure scripts.. use the full -name of the directory, for example /Users/james/bitcoin/deps for a user named -'james'. In my examples I am using 'macosuser' so make sure you change that. - -2. Check out the bitcoin code from github: - -cd ~/bitcoin -git clone https://github.com/bitcoin/bitcoin.git -ln -s bitcoin/src src - -This will make ~/bitcoin/bitcoin for you with all the files from git. This puts -the actual sources in ~/bitcoin/bitcoin/src and create a symlink src in -~/bitcoin to this location. - -3. Get and build the dependencies - - -Boost +Notes ----- -Download from http://www.boost.org/users/download/ -I'm assuming it ended up in ~/Downloads.. - -mkdir ~/bitcoin/deps -cd ~/bitcoin/deps -tar xvjf ~/Downloads/boost_1_42_0.tar.bz2 -cd boost_1_42_0 -./bootstrap.sh -./bjam architecture=combined address-model=32_64 macosx-version=10.5 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install - -If you're using Snow Leopard, you will need to specify 10.6 as your Mac OS X -version instead of 10.5. - -This part takes a while.. use your judgement and fix it if something doesn't -build for some reason. - -Change the prefix to whatever your directory is (my username in this example -is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change -to 10.5 if you're using leopard. - -This is what my output looked like at the end: -...failed updating 2 targets... -...skipped 144 targets... -...updated 8074 targets... - - -OpenSSL -------- +* Tested on OS X 10.7 through 10.10 on 64-bit Intel processors only. -(System or MacPorts openssl will work fine. Optional.) +* All of the commands should be executed in a Terminal application. The +built-in one is located in `/Applications/Utilities`. -Download from http://www.openssl.org/source/ - -We would like to build this as a 32 bit/64 bit library so we actually build it -2 times and join it together here.. If you downloaded with safari it already -uncompressed it so it will just be a tar not a tar.gz - -cd ~/bitcoin/deps -tar xvf ~/Downloads/openssl-1.0.0.tar -mv openssl-1.0.0 openssl-1.0.0-i386 -tar xvf ~/Downloads/openssl-1.0.0.tar -mv openssl-1.0.0 openssl-1.0.0-x86_64 -# build i386 (32 bit intel) binary -cd openssl-1.0.0-i386 -./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin-i386-cc && make -make install # only do this on one of the architectures, to install the headers -cd .. -# build x86_64 (64 bit intel) binary -cd openssl-1.0.0-x86_64 -./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin64-x86_64-cc && make -cd .. - -# combine the libs -cd ~/bitcoin/deps -lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create -lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create - -Verify your binaries - -file lib/libcrypto.a - -output should look like this: - -lib/libcrypto.a: Mach-O universal binary with 2 architectures -lib/libcrypto.a (for architecture i386): current ar archive random library -lib/libcrypto.a (for architecture x86_64): current ar archive random library - - -miniupnpc ---------- - -(MacPorts miniupnpc package works fine. You will need to modify makefile.) - -The process for miniupnpc (optional) is similar to that of OpenSSL. - -Download from http://miniupnp.tuxfamily.org/files/. - -cd ~/bitcoin/deps -tar xvf ~/Downloads/miniupnpc-1.5.tar -mv miniupnpc-1.5 miniupnpc-1.5-x86_64 -tar xvf ~/Downloads/miniupnpc-1.5.tar -mv miniupnpc-1.5 miniupnpc-1.5-i386 -# build x86_64 (64 bit intel) binary -cd miniupnpc-1.5-x86_64 -export CFLAGS="-arch x86_64" -export LDFLAGS="-arch x86_64" -export PREFIX="/Users/macuser/bitcoin/deps" -make && make install -# build i386 (32 bit intel) binary -cd miniupnpc-1.5-i386 -export CFLAGS="-arch i386" -export LDFLAGS="-arch i386" -export PREFIX="/Users/macuser/bitcoin/deps" -make - -# combine the libs -cd ~/bitcoin/deps -lipo -arch i386 miniupnpc-1.5-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.5-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create - -Verify your binaries - -file lib/libminiupnpc.a - -output should look like this: - -lib/libminiupnpc.a: Mach-O universal binary with 2 architectures -lib/libminiupnpc.a (for architecture i386): current ar archive random library -lib/libminiupnpc.a (for architecture x86_64): current ar archive random library - - -Berkeley DB +Preparation ----------- -(System or MacPorts version work fine.) - -Download from http://freshmeat.net/projects/berkeleydb/ +You need to install XCode with all the options checked so that the compiler +and everything is available in /usr not just /Developer. XCode should be +available on your OS X installation media, but if not, you can get the +current version from https://developer.apple.com/xcode/. If you install +Xcode 4.3 or later, you'll need to install its command line tools. This can +be done in `Xcode > Preferences > Downloads > Components` and generally must +be re-done or updated every time Xcode is updated. -cd ~/bitcoin/deps -tar xvf ~/Downloads/db-4.8.26.tar -cd db-4.8.26/build_unix -../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install +There's also an assumption that you already have `git` installed. If +not, it's the path of least resistance to install [Github for Mac](https://mac.github.com/) +(OS X 10.7+) or +[Git for OS X](https://code.google.com/p/git-osx-installer/). It is also +available via Homebrew. +You will also need to install [Homebrew](http://brew.sh) in order to install library +dependencies. -wxWidgets ---------- +The installation of the actual dependencies is covered in the Instructions +sections below. -(The wxWidgets-devel MacPorts package will work but will throw annoying assertion dialogs.) +Instructions: Homebrew +---------------------- -This is the big one.. +#### Install dependencies using Homebrew -Check it out from svn + brew install autoconf automake libtool boost openssl pkg-config protobuf qt qrencode -cd ~/bitcoin/deps -svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk +#### Installing berkeley-db4 using Homebrew -This will make a wxWidgets-trunk directory in deps. +The homebrew package for berkeley-db4 has been broken for some time. It will install without Java though. -Use this script snippet, change your prefix to whatever your dir is: +Running this command takes you into brew's interactive mode, which allows you to configure, make, and install by hand: +``` +$ brew install https://raw.github.com/mxcl/homebrew/master/Library/Formula/berkeley-db4.rb -–without-java +``` -PREFIX=~/bitcoin/deps -SRCDIR="$PREFIX/wxWidgets-trunk" -BUILDDIR="$SRCDIR/macbuild" +The rest of these commands are run inside brew interactive mode: +``` +/private/tmp/berkeley-db4-UGpd0O/db-4.8.30 $ cd .. +/private/tmp/berkeley-db4-UGpd0O $ db-4.8.30/dist/configure --prefix=/usr/local/Cellar/berkeley-db4/4.8.30 --mandir=/usr/local/Cellar/berkeley-db4/4.8.30/share/man --enable-cxx +/private/tmp/berkeley-db4-UGpd0O $ make +/private/tmp/berkeley-db4-UGpd0O $ make install +/private/tmp/berkeley-db4-UGpd0O $ exit +``` -cd "$PREFIX" && -#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk && -cd "$SRCDIR" && +After exiting, you'll get a warning that the install is keg-only, which means it wasn't symlinked to `/usr/local`. You don't need it to link it to build novacoin, but if you want to, here's how: -[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig && -sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h && + $ brew link --force berkeley-db4 -[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig && -sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h && +### Building `novacoind` +1. Clone the github tree to get the source code and go into the directory. -rm -vrf "$BUILDDIR" && -mkdir "$BUILDDIR" && -cd "$BUILDDIR" && + git clone https://github.com/novacoin-project/novacoin.git + cd novacoin -../configure --prefix="$PREFIX" \ ---with-osx_cocoa \ ---disable-shared \ ---disable-debug_flag \ ---with-macosx-version-min=10.5 \ ---enable-stl \ ---enable-utf8 \ ---enable-universal_binary \ ---with-libjpeg=builtin \ ---with-libpng=builtin \ ---with-regex=builtin \ ---with-libtiff=builtin \ ---with-zlib=builtin \ ---with-expat=builtin \ ---with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk && +2. Build NovaCoin-Qt application: + qmake + make +3. Build bitcoind: + cd src + make -f makefile.osx novacoind -find . -name Makefile | -while read i; do - echo $i; - sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new && - mv "$i" "$i".old && - mv "$i".new "$i"; -done +Use Qt Creator as IDE +------------------------ +You can use Qt Creator as IDE, for debugging and for manipulating forms, etc. +Download Qt Creator from http://www.qt.io/download/. Download the "community edition" and only install Qt Creator (uncheck the rest during the installation process). +1. Make sure you installed everything through homebrew mentioned above +2. In Qt Creator do "File" -> "Open Project" +3. Select novacoin-qt.pro as project file. +4. In the "Projects" tab select "Manage Kits..." +5. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler +6. Select LLDB as debugger (you might need to set the path to your installtion) +7. Start debugging with Qt Creator +Creating a release build +------------------------ +You can ignore this section if you are building `novacoind` for your own use. -make && -make install +novacoind binary isn't included in the NovaCoin-Qt.app bundle. +If you are building `novacoind` or `NovaCoin-Qt` for others, your build machine should be set up +as follows for maximum compatibility: +All dependencies should be compiled with these flags: -Now you should be able to build bitcoin + -mmacosx-version-min=10.7 + -arch x86_64 + -isysroot $(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -cd ~/bitcoin/src -make -f makefile.osx bitcoin +Once dependencies are compiled, you can create the .dmg disk image: -Before you can run it, you need to create an application bundle for Mac OS. +./contrib/macdeploy/macdeployqtplus NovaCoin-Qt.app -dmg -fancy ./contrib/macdeploy/fancy.plist -A bundle is provided in contrib/Bitcoin.app. - -Copy the bitcoin binary in to it like this: - cp -pR ~/bitcoin/bitcoin/contrib/Bitcoin.app ~/bitcoin/ - cp ~/bitcoin/src/bitcoin ~/bitcoin/Bitcoin.app/Contents/MacOS/ +Running +------- -To run it you can just click the Bitcoin.app in Finder, or just do: -open ~/bitcoin/Bitcoin.app +It's now available at `./novacoind`, provided that you are still in the `src` +directory. We have to first create the RPC configuration file, though. -If you want to run it with arguments you can just run it without backgrounding -by specifying the full name in terminal: +Run `./novacoind` to get the filename where it should be put, or just try these +commands: -~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66 + echo -e "rpcuser=novacoinrpc\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > "/Users/${USER}/Library/Application Support/NovaCoin/novacoin.conf" + chmod 600 "/Users/${USER}/Library/Application Support/NovaCoin/novacoin.conf" -You can also run it with arguments in the background with output going to the -normal places for apps (Console) like this: +The next time you run it, it will start downloading the blockchain, but it won't +output anything while it's doing this. This process may take several hours; +you can monitor its process by looking at the debug.log file, like this: -open ~/bitcoin/Bitcoin.app --args -connect=192.75.207.66 + tail -f $HOME/Library/Application\ Support/NovaCoin/debug.log -It is advisable to relocate Bitcoin.app to /Applications or $HOME/Applications. +Other commands: +------- + ./novacoind -daemon # to start the bitcoin daemon. + ./novacoind --help # for a list of command-line options. + ./novacoind help # When the daemon is running, to get a list of RPC commands