Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: melek on February 28, 2011, 10:13:13 AM



Title: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 10:13:13 AM
I just created a homebrew formula for installation on Mac OS X

https://github.com/melek-bitcoin/homebrew/commit/eca924cddd868613937d692bab2c184187610020

Homebrew is a system similar to the gentoo port system, where all dependencies are resolved automatically and the installation is done by compilation from source, rather than downloading of binaries. You can read more about it here:

http://mxcl.github.com/homebrew/

Once you have Homebrew installed on your Mac, you can easily get bitcoind by typing

Code:
brew install bitcoind

and the dependencies on boost, boost, berkeley-db should be resolved automatically. OpenSSL is installed by default, and the bitcoind formula links against the default version.

All the linking is done dynamically rather than statically (unlike in the original source code).

I tested on 10.6 Snow Leopard:

Code:
$ brew install bitcoind
==> Downloading http://download.oracle.com/berkeley-db/db-5.1.19.tar.gz
==> ../dist/configure --disable-debug --prefix=/usr/local/Cellar/berkeley-db/5.1.19 --mandir=/usr/local/Cel
==> make install
/usr/local/Cellar/berkeley-db/5.1.19: 2634 files, 68M, built in 2.8 minutes
==> Downloading http://downloads.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.3.20/bitcoin-0.3.20.01-macosx.zip
==> Downloading patches
==> Patching
patching file bitcoin-0.3.20.01/src/makefile.osx
==> make -f makefile.osx bitcoind -j3
/usr/local/Cellar/bitcoind/0.3.20.01: 1.8M, built in 73 seconds


Title: Re: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 10:14:21 AM
I requested a merge to the default Homebrew branch, so the formula should be available shortly.


Title: Re: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 10:55:58 AM
Thus compile bitcoind and running it, leads to some kind of corruption in the data, and opening the official client gives an error. I am wondering what is causing that?

The only difference is that I am now dynamically linking, instead of statically linking the libraries. Am I using an outdated version of any of the libraries? Here is what I link against:

Code:
$ otool -L /usr/local/bin/bitcoind 
/usr/local/bin/bitcoind:
/usr/local/Cellar/berkeley-db/5.1.19/lib/libdb_cxx-5.1.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libboost_program_options-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)


Title: Re: Bitcoin Formula for Mac OS X
Post by: Gavin Andresen on February 28, 2011, 12:48:51 PM
The official client uses an older version of Berkeley DB (4.8, according to build-osx.txt).

You're linking to Berkeley DB 5.1.19, so when you run your client it upgrades the bitcoin database files, which makes them incompatible with the official client.


Title: Re: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 04:19:49 PM
The official client uses an older version of Berkeley DB (4.8, according to build-osx.txt).

You're linking to Berkeley DB 5.1.19, so when you run your client it upgrades the bitcoin database files, which makes them incompatible with the official client.


Thanks for clarifying.

Are you planning to move the official client to the latest v5 at some point? Is v5 fully backward compatible with v4, i.e. can it read v4 wallets without modifications?


Title: Re: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 05:52:09 PM
I am not really sure how to make Homebrew install a specific version of berkeley-db. I will pay 10 BTC to whomever can fix the above formula so that it installs the correct version of the library. You may have to use the "keg_only" option to prevent conflicts with the main berkeley-db formula.


Title: Re: Bitcoin Formula for Mac OS X
Post by: yomi on February 28, 2011, 06:47:02 PM
I am not really sure how to make Homebrew install a specific version of berkeley-db. I will pay 10 BTC to whomever can fix the above formula so that it installs the correct version of the library. You may have to use the "keg_only" option to prevent conflicts with the main berkeley-db formula.

Melek,

According to the wiki, there is no way to depend on a specific version of a formula.

I will try to see if it is possible to have a formula as berkeley-db4.

Thanks.


Title: Re: Bitcoin Formula for Mac OS X
Post by: melek on February 28, 2011, 07:00:52 PM
Here is the suggested workaround:

https://github.com/mxcl/homebrew/issues/4472

and here is the updated formula:

https://github.com/mxcl/homebrew/issuesearch?state=open&q=bitcoin#issue/4461


Title: Re: Bitcoin Formula for Mac OS X
Post by: yomi on February 28, 2011, 07:28:35 PM
Here is the suggested workaround:

https://github.com/mxcl/homebrew/issues/4472

and here is the updated formula:

https://github.com/mxcl/homebrew/issuesearch?state=open&q=bitcoin#issue/4461

Great!

Please let us know when they approve the pull request.

Thanks.