Skip to content

reformat OS X build instrcs, add 10.8 + Homebrew #2026

Merged
merged 1 commit into from Feb 22, 2013

4 participants

@colindean

I reformatted the entire document to look pretty in both standard text and Markdown. This should make it a lot easier to read.

Also, I incorporated my OS X 10.8 build instructions with Homebrew as the package manager. I originally posted them on the Bitcoin Stackexchange in the question Trouble compiling bitcoind on OSX with homebrew. I've used these instructions twice now, so I'm fairly certain they'll work.

I do recognize that I need to find a way to get the Makefile to look at Homebrew's Cellar without needing to be patched. WIP on my branch entitled feature/osx10.8-bitcoind-compilation.

@gavinandresen gavinandresen commented on an outdated diff Nov 18, 2012
doc/build-osx.md
+3. Build bitcoind:
+
+ cd bitcoin/src
+ make -f makefile.osx USE_IPV6=1 DEPSDIR=/usr/local
+
+ Don't forget to add USE_QRCODE=1 if you installed `qrencode`.
+
+Running
+-------
+
+It's now available at `./bitcoind`. We have to first create the RPC
+configuration file, though. Run `./bitcoind` to get the filename where it
+should be put, or just try the below command.
+
+ echo "rpcuser=bitcoinrpc
+ rpcpassword=HdAseQSRkirfoNuUSzqzixyL9sM1T6ABfzV1nyNmbuwg" > "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
@gavinandresen
Bitcoin member

rpcpassword=$(xxd -l 16 -p /dev/urandom) > ...etc would be better to create a random 16-hex-character password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gavinandresen gavinandresen commented on an outdated diff Nov 18, 2012
doc/build-osx.md
+4. Install berkeley-db 4.8 now that you've got the right formula in place.
+
+ brew install berkeley-db
+
+### Building `bitcoind`
+
+1. Clone the github tree to get the source code:
+
+ git clone git@github.com:bitcoin/bitcoin.git bitcoin
+
+2. If you used Homebrew, you must modify source in order to pick up the
+ `openssl` library.
+
+ Edit the makefile.osx to change it a bit. Here's a diff that shows what
+ you need to change, or you can just use this as a patch by doing
+ `echo '$patch-text' | patch`, where $patch-text is the patch text below.
@gavinandresen
Bitcoin member

I think it'd be better to ship the patch in contrib/homebrew/makefile.osx.patch file rather than put it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@colindean

Updated as suggested!

@BitcoinPullTester

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/933304fe886c8e7f3dd6d90acec3f8ee7cd60980 for binaries and test log.

@gavinandresen
Bitcoin member

Question: why is openssl special with homebrew? It'd be really nice not to have to ship a Makefile.osx patch that is likely to break when we change Makefile.osx in the future, and it looks like openssl is the only change that couldn't just be made to Makefile.osx directly.

Also: I think breaking the instructions into three sections:

  • Installing for development using MacPorts
  • Installing for development using HomeBrew
  • Special notes on creating release builds (that I'd write)

... would be less confusing.

Finally: can you squash all this into one commit?

@colindean

Homebrew doesn't link openssl like it does other packages because "The OpenSSL provided by OS X is too old for some software." It installs in "keg-only" mode, and has to be manually linked only if required:

What does keg-only mean? It means the formula is installed only into the Cellar, it is not linked into /usr/local. This means most tools will not find it. We don’t do this for stupid reasons. You can link the formula in still if you need to with brew link. - Homebrew FAQ

I interpret this to mean that if we rely on openssl to be linked already or include an instruction to link it, things may break. I'd rather not see Bitcoin as the cause of a broken dev system because a newer version of openssl is causing problems for Apple's stuff.

One can get the path to Homebrew's installation of openssl with brew --prefix openssl. However, it appears that the current makefile.osx doesn't account for the possibility of multiple hierarchies to get the include and lib for all necessary libraries. It relies on DEPSDIR to set INCLUDEPATHS and LIBPATHS.

This also exacerbates static building, because it, too, relies on DEPSDIR and everything being in the same hierarchy. Maybe static compilation as coded is not so much a problem if the releaser is always using MacPorts.

That said, I'd rather not see a separate makefile.osx just for Homebrew folk. The patch does just enough to make it work for now. I could further improve the patch and the instructions to allow passing of brew --prefix openssl at compilation time in order to eliminate the possibility of an openssl version bump messing up the paths added in the patch.

If we* could alter makefile.osx to better account for the differences between Homebrew and MacPorts, and do so dynamically, we could remove the need for the patch and remove the need for a separate path of instructions for each packaging system.

Unfortunately, I don't have access to a system with MacPorts installed and I'm hesitant to introduce it onto mine for fear of messing up my own environment for other things ;-)

If what's here now in this pull request is good enough for 0.8, I'll split the HOWTO into sections as suggested and squash these commits somehow (is there a way to do that without having to delete and recreate the branch? I've only had to squash once and just ended up doing that and resubmitting a PR) and get them ready. Otherwise, perhaps a makefile.osx modification is in order for 0.9.

*we = someone involved in the project with perhaps stronger Makefile kung-foo than I

@colindean

I note also that I'll need to remove the USE_IPV6=1 from the make command, per #2064.

@gavinandresen
Bitcoin member

I just set up a machine to do a release build a couple of days ago for the 0.7.2 release, so I went through my bash history and updated the instructions:

https://gist.github.com/4224563

@colindean
@colindean

I've incorporated the suggested changes and squashed everything together.

@BitcoinPullTester

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/82cc0ea4fb3e6847ba7475d4fa28942132009de4 for binaries and test log.

@BitcoinPullTester

Automatic sanity-testing: FAILED MERGE, see http://jenkins.bluematt.me/pull-tester/82cc0ea4fb3e6847ba7475d4fa28942132009de4 for test log.

This pull does not merge cleanly onto current master

@luke-jr
Bitcoin member
luke-jr commented Jan 30, 2013

@colindean, rebase needed

@colindean

@luke-jr I think I did it right...?

@colindean

I updated my branch to ensure that it merges cleanly with master.

@colindean

I just updated again, resyncing with master and with two optimizations:

  • OpenSSL 1.0.1c is no longer hardcoded
  • Static compilation now works (tested on another 10.8 machine without any of the dev dependencies)

The makefile patch is still necessary. A future optimization would ideally remove this necessity, but I don't have another machine available running MacPorts on which I can test.

@colindean

Another update, after discovering a new formula in Homebrew for building berkeley-db4 without having to revert to an older version of the formula. Revised the makefile patch and the instructions to reflect this. Now, the only existing difference between the Homebrew and MacPorts instructions is the need to patch the makefile because of path differences between the two systems.

@colindean colindean reformat OS X build instrcs, add 10.8 + Homebrew
* reformatted the entire document to look pretty in both standard text and
  Markdown
* incorporated [my OS X 10.8 build instructions with Homebrew as the package
  manager](http://bitcoin.stackexchange.com/questions/3672/trouble-compiling-bitcoind-on-osx-with-homebrew/5253#5253)
* incorporated @gavinandresen's MacPorts and release build instructions based on
  an earlier revision of this commit
* added makefile patch necessary for Homebrew compilation to `contrib`
68cb1cd
@colindean

Rebased to current master as of 0.8.0 release.

@gavinandresen @luke-jr, anything else?

@gavinandresen gavinandresen merged commit 69c5609 into bitcoin:master Feb 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.