[BTC-dev] Running the Reference Implementation on OS X

Jon Keefe jonkeefe at gmail.com
Fri Mar 27 20:45:09 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

You will need Homebrew and a reasonable amount of intelligence to follow these steps.
Follow these instructions at your own peril, and upon risk of divestment, dismemberment, or death.

$ cd ~/dev
$ brew install curl
$ brew install realpath
$ curl "http://thebitcoin.foundation/bitcoin-v0_5_3_1-RELEASE.tar.gz" -s -o bitcoin-v0_5_3_1-RELEASE.tar.gz
$ tar xvzf bitcoin-v0_5_3_1-RELEASE.tar.gz
$ cd bitcoin-v0_5_3_1
$ sed -i -e 's/MSG_NOSIGNAL/SO_NOSIGPIPE/' bitcoin/src/irc.cpp
$ sed -i -e 's/MSG_NOSIGNAL/SO_NOSIGPIPE/' bitcoin/src/net.cpp
$ sed -i -e 's/linux\-x86_64/darwin64\-x86_64\-cc/' auto.sh
$ sed -i -e 's/sha256sum/shasum \-a 256/' auto.sh
$ sed -i -e 's/makefile.unix/makefile.osx/' auto.sh
$ chmod 0755 auto.sh
$ ./auto.sh (create makefile.osx first, see below)

The following text should be saved as ./bitcoin/src/makefile.osx :

# -*- mode: Makefile; -*-
# Copyright (c) 2011 Bitcoin Developers, 2015 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

# Mac OS X makefile for bitcoin
# Originally by Laszlo Hanyecz (solar at heliacal.net)
# Modified March 22 2015 by Satoshi Nakamoto for La Serenissima

CXX=g++
OURLIBS=/Users/macuser/dev/bitcoin-v0_5_3_1/ourlibs

INCLUDEPATHS= \
 -I"$(OURLIBS)/include"

LIBPATHS= \
 -L"$(OURLIBS)/lib"

LIBS= -dead_strip
# Build STATIC if you are redistributing the bitcoind binary
TESTLIBS += \
 $(OURLIBS)/lib/libboost_unit_test_framework.a
LIBS += \
 $(OURLIBS)/lib/libdb_cxx-4.8.a \
 $(OURLIBS)/lib/libboost_system.a \
 $(OURLIBS)/lib/libboost_filesystem.a \
 $(OURLIBS)/lib/libboost_program_options.a \
 $(OURLIBS)/lib/libboost_thread.a \
 $(OURLIBS)/lib/libssl.a \
 $(OURLIBS)/lib/libcrypto.a \
 -lz

DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DUSE_SSL

DEBUGFLAGS=-g
# ppc doesn't work because we don't support big-endian
CFLAGS=-mmacosx-version-min=10.5 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS = \
    base58.h \
    bignum.h \
    checkpoints.h \
    crypter.h \
    db.h \
    headers.h \
    init.h \
    irc.h \
    key.h \
    keystore.h \
    main.h \
    net.h \
    noui.h \
    protocol.h \
    bitcoinrpc.h \
    script.h \
    serialize.h \
    strlcpy.h \
    uint256.h \
    util.h \
    wallet.h

OBJS= \
    obj/checkpoints.o \
    obj/crypter.o \
    obj/db.o \
    obj/init.o \
    obj/irc.o \
    obj/keystore.o \
    obj/main.o \
    obj/net.o \
    obj/protocol.o \
    obj/bitcoinrpc.o \
    obj/script.o \
    obj/util.o \
    obj/wallet.o


all: bitcoind

# auto-generated dependencies:
- -include obj/nogui/*.P
- -include obj-test/*.P

obj/nogui/%.o: %.cpp
        $(CXX) -c $(CFLAGS) -MMD -o $@ $<
        @cp $(@:%.o=%.d) $(@:%.o=%.P); \
          sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
              -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
          rm -f $(@:%.o=%.d)

bitcoind: $(OBJS:obj/%=obj/nogui/%)
        $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

obj/test/%.o: test/%.cpp
        $(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -o $@ $<
        @cp $(@:%.o=%.d) $(@:%.o=%.P); \
          sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
              -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
          rm -f $(@:%.o=%.d)

test_bitcoin: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:obj/%=obj/nogui/%))
        $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)

clean:
        -rm -f bitcoind test_bitcoin
        -rm -f obj/*.o
        -rm -f obj/nogui/*.o
        -rm -f obj-test/*.o
        -rm -f obj/*.P
        -rm -f obj/nogui/*.P
        -rm -f obj-test/*.P

# EOF
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJVEeRdAAoJEGVuThN8d5ckNQEP/i813SvcuI9jt43PcdIgDl+z
W9QSHaJRPHys5sG6u6FjNmz5cGVbNnNtn9NQEvk0MIp9P6kj1mQ9Pxx2yWWDxHf9
ob7sWHT9cIeo3CGjfK7q+clm7ybmumIHIw2LS2ueh8AFfaABpyBkrpc4GtGGbKzq
Gz9XqILjAkyTHjPT5Ev0CZdmaYdWauo+VuT8JP0ozx79mihlsH0/zbLiLeyhW6ja
niYvlHoMxhVsKvqGOh0rtcMAj/F3ndXEC9P5Msq75W4MFHhBot51y3rbzVowqrys
E3UGy+646oPBOc1xKv84rnOg53bTZqiFv1UrMgrmGZwwFInCeIWGJeDrTHkfk84z
FSXxiHrue3lWKIWxKCQBG7a/SMcYdHx9rsnTboymd/sGIuPmadDL2THL+hgYHayB
6Gwx8leBiXIYcALfs4pDs7A70/glXbomS3AJ5veWgNha685hBjwFWMEnlth2qFWZ
aj0wiyhHbDSc+5ffwrEcUyhkBIM3ukxArlaqFh1dZEd00m4YBDQZKGDKBnRxoHGU
rThtP6xoDy57S0+yrF3d+khrq1zGq3LQpiHGfBeNGpLm1ZquuIHn/siEdKpXPzQ+
FHKyxYeNw9u1dJIUgmvhEEmzMrIghsrNwpadKtArbCO4gmpa5q8rGUcAJt1Zww51
I0/GD9hMM7tNAQHVMEj/
=9Cp+
-----END PGP SIGNATURE-----


More information about the BTC-dev mailing list