Advertisement
joric

Building Bitcoin Armory on the Mac

Feb 1st, 2012
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.85 KB | None | 0 0
  1. BUILDING BITCOIN ARMORY ON THE MAC
  2.  
  3. Requirements (tested ones)
  4.  
  5. - Mac OS X 10.6.7 (MacOSXUpdCombo10.6.7.dmg)
  6. - Xcode 4.2 (xcode_4.2_and_ios_5_sdk_for_snow_leopard.dmg)
  7.  
  8. Screenshots:
  9.  
  10. http://imageshack.us/g/717/screenshot20120201at113.png/
  11.  
  12. Dependencies:
  13.  
  14. OS X versions 10.5 and greater ship with python, zope and twisted installed.
  15. (see http://twistedmatrix.com/trac/wiki/Downloads)
  16. Xcode 4 installs git by default (see /Developer/usr/bin).
  17.  
  18. How to build:
  19.  
  20. cd ~
  21. git clone git://github.com/etotheipi/BitcoinArmory.git
  22. cd ~/BitcoinArmory
  23. git checkout qtdev
  24.  
  25. cd ~/BitcoinArmory/cppForSwig/cryptopp
  26. make libcryptopp.a
  27. sudo make install
  28.  
  29. cd ~/BitcoinArmory/cppForSwig
  30. make swig
  31.  
  32. Download and install QT:
  33.  
  34. http://get.qt.nokia.com/qt/source/qt-mac-cocoa-opensource-4.7.4.dmg
  35.  
  36. Download, unpack and build SIP and PyQT4:
  37.  
  38. http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.13.1.tar.gz
  39. http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.9.tar.gz
  40.  
  41. cd <source dir>
  42. python configure.py
  43. make
  44. sudo make install
  45.  
  46. run armory:
  47. cd ~/BitcoinArmory
  48. python ArmoryQt.py
  49.  
  50. PATCHES (for 02 Feb 2012, supposedly platform-independent)
  51.  
  52. [!] UniversalTimer.cpp:1: error: bad value (native) for -march= switch
  53. You have to remove -march=native from COMPILER_OPTS
  54. e.g. using /Applications/TextEdit.app/Contents/MacOS/TextEdit Makefile
  55.  
  56. [!] 686-apple-darwin10-llvm-g++-4.2: -lcryptopp: linker input file unused because linking not done
  57. Happens due to using -c and -l together. You should remove $(LIBRARY_OPTS) from compiler lines.
  58. e.g:
  59. -$(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) UniversalTimer.cpp
  60. +$(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) UniversalTimer.cpp
  61.  
  62. [!] ld: library not found for -lcryptopp
  63. You should make cryptopp (it comes along with the armory from git).
  64. cd ~/BitcoinArmory/cppForSwig/cryptopp
  65. make libcryptopp.a (could take a while)
  66. sudo make install
  67. While installing cryptopp: cp: *.so: No such file or directory
  68. Skip it, it's okay - we don't need *.so, we need *.a.
  69.  
  70. [!] Undefined symbols for architecture i386: "_Py_InitModule4"
  71. Add -lpython2.6 to the linker opts of cppForSwig/Makefile.
  72.  
  73. [!] Armory incorrectly determines OSX data path and refuses to run.
  74. see armoryengine.py:36 and armoryengine.py:775
  75. OS_WINDOWS = 'win' in opsys.lower()
  76. OS_LINUX   = 'nix' in opsys.lower() or 'nux' in opsys.lower()
  77. OS_MACOSX  = 'mac' in opsys.lower() or 'osx' in opsys.lower()
  78. There's a mess between 'win' and lowercase 'Darwin'. Use patches below.
  79.  
  80. Actual patches:
  81.  
  82. 1) Makefile patch:
  83.  
  84. --- Makefile.orig   Sun Jan 22 05:11:09 2012
  85. +++ Makefile    Thu Feb  2 01:34:41 2012
  86. @@ -1,6 +1,6 @@
  87.  COMPILER = g++
  88.  #COMPILER_OPTS = -c -g -Wall -D_DEBUG
  89. -COMPILER_OPTS = -c -march=native -O2 -pipe
  90. +COMPILER_OPTS = -c -O2 -pipe
  91.  
  92.  
  93.  LINKER = g++
  94. @@ -19,8 +19,10 @@
  95.  
  96.  ifneq (exists, $(shell [ -d /usr/include/python2.7 ]  && echo exists ))
  97.     SWIG_INC = -I/usr/include/python2.6
  98. +   LIBRARY_OPTS = -lcryptopp -lpthread -lpython2.6
  99.     ifneq (exists, $(shell [ -d /usr/include/python2.6 ]  && echo exists ))
  100.        SWIG_INC = -I/usr/include/python2.5
  101. +      LIBRARY_OPTS = -lcryptopp -lpthread -lpython2.5
  102.     endif
  103.  endif
  104.  
  105. @@ -38,25 +40,25 @@
  106.  # Rules for performing the compilation of each individual object file.
  107.  
  108.  UniversalTimer.o: UniversalTimer.h UniversalTimer.cpp
  109. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) UniversalTimer.cpp
  110. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) UniversalTimer.cpp
  111.  
  112.  BinaryData.o: BinaryData.h BinaryData.cpp BtcUtils.h
  113. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) BinaryData.cpp
  114. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) BinaryData.cpp
  115.  
  116.  BtcUtils.o: BtcUtils.h BtcUtils.cpp
  117. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) BtcUtils.cpp
  118. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) BtcUtils.cpp
  119.  
  120.  BlockObj.o: BinaryData.h BtcUtils.h BlockObjRef.h BlockObj.h BlockObj.cpp
  121. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) BlockObj.cpp
  122. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) BlockObj.cpp
  123.  
  124.  BlockObjRef.o: BinaryData.h BtcUtils.h BlockObj.h BlockObjRef.h BlockObjRef.cpp
  125. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) BlockObjRef.cpp
  126. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) BlockObjRef.cpp
  127.  
  128.  BlockUtils.o: BlockUtils.h BinaryData.h UniversalTimer.h BlockUtils.cpp
  129. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) BlockUtils.cpp
  130. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) BlockUtils.cpp
  131.  
  132.  EncryptionUtils.o: BtcUtils.h BinaryData.h EncryptionUtils.h EncryptionUtils.cpp
  133. -   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) $(LIBRARY_OPTS) EncryptionUtils.cpp
  134. +   $(COMPILER) $(COMPILER_OPTS) $(INCLUDE_OPTS) EncryptionUtils.cpp
  135.  
  136.  CppBlockUtils_wrap.cxx: BlockUtils.h BinaryData.h BlockObj.h BlockObjRef.h UniversalTimer.h BlockUtils.h BlockUtils.cpp CppBlockUtils.i
  137.     swig $(SWIG_OPTS) -outdir ../ -v CppBlockUtils.i
  138.  
  139.  
  140. 2) armoryengine.py patch:
  141.  
  142. --- armoryengine.py.orig    Sun Jan 22 05:11:09 2012
  143. +++ armoryengine.py Thu Feb  2 00:24:34 2012
  144. @@ -106,9 +106,9 @@
  145.  # Get the host operating system
  146.  import platform
  147.  opsys = platform.system()
  148. -OS_WINDOWS = 'win' in opsys.lower()
  149. +OS_WINDOWS = 'win32' in opsys.lower() or 'windows' in opsys.lower()
  150.  OS_LINUX   = 'nix' in opsys.lower() or 'nux' in opsys.lower()
  151. -OS_MACOSX  = 'mac' in opsys.lower() or 'osx' in opsys.lower()
  152. +OS_MACOSX  = 'darwin' in opsys.lower() or 'osx' in opsys.lower()
  153.  
  154.  # Figure out the default directories for Satoshi client, and BicoinArmory
  155.  OS_NAME          = ''
  156. @@ -761,21 +761,12 @@
  157.     computed.  Access to any information in the blockchain can be found via
  158.     the bdm object.
  159.     """
  160. +   global BTC_HOME_DIR
  161.     if blkfile==None:
  162.        if not USE_TESTNET:
  163. -         if 'win' in opsys.lower():
  164. -            blkfile = os.path.join(os.getenv('APPDATA'), 'Bitcoin', 'blk0001.dat')
  165. -         if 'nix' in opsys.lower() or 'nux' in opsys.lower():
  166. -            blkfile = os.path.join(os.getenv('HOME'), '.bitcoin', 'blk0001.dat')
  167. -         if 'mac' in opsys.lower() or 'osx' in opsys.lower():
  168. -            blkfile = os.path.expanduser('~/Library/Application Support/Bitcoin/blk0001.dat')
  169. +         blkfile = os.path.join(BTC_HOME_DIR, 'blk0001.dat')
  170.        else:
  171. -         if 'win' in opsys.lower():
  172. -            blkfile = os.path.join(os.getenv('APPDATA'), 'Bitcoin/testnet', 'blk0001.dat')
  173. -         if 'nix' in opsys.lower() or 'nux' in opsys.lower():
  174. -            blkfile = os.path.join(os.getenv('HOME'), '.bitcoin/testnet', 'blk0001.dat')
  175. -         if 'mac' in opsys.lower() or 'osx' in opsys.lower():
  176. -            blkfile = os.path.expanduser('~/Library/Application Support/Bitcoin/testnet/blk0001.dat')
  177. +         blkfile = os.path.join(BTC_HOME_DIR, 'testnet', 'blk0001.dat')
  178.  
  179.     if not os.path.exists(blkfile):
  180.        raise FileExistsError, ('File does not exist: %s' % blkfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement