Title: macOS Sierra Bitcoin build and install; ACLOCAL_PATH and DYLD_LIBRARY_PATH
Post by: jimhash on July 25, 2017, 05:34:03 PM
I recently performed native build from source of Bitcoin using the latest tag on macOS Sierra 10.12.5. I wanted to share a synopsis of my experience with other macOS & Unix developers. I am not sure the best way to share this information with the Bitcoin dev community, hence this post. Comments/feedback greatly appreciated, thank you. Firstly, I did find following documents quite useful: - doc/build-osx.md (https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md)
- doc/build-unix.md (https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md)
From these I installed the following Homebrew formulas: - autoconf
- berkeley-db@4
- libevent
- m4
- pkg-config
- qt
- automake
- boost
- libtool
- openssl
- protobuf
Importantly, macOS Sierra 10.12.5 comes with pre-installed versions of both m4 and libttool binaries (both installed in /usr/bin). So for compatibility with the rest of the standard Unix Auto-Tools (pkg-config, automake, & autoconf) we install and reference Homebrew versions of m4 and libtool, overriding the original binaries. Attention: Important Notes:- Unless ACLOCAL_PATH is set, configure will fail with the following error:
configure: error: PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh. - Unless DYLD_LIBRARY_PATH is set neither bitcoind or bitcoin-cli will be able to locate dependant dynamic shared platform libraries.
Setting ACLOCAL_PATH and DYLD_LIBRARY_PATH as below correct these issues. What follows are macOS bash .profile environment settings for the following environment variables:Env Var: | Purpose: | CPPFLAGS | GXX compile include path. | LDFLAGS | GXX linker lib path. | bitcoin_enable_qt | Build bitcoin-cli for "full node" capability. | ACLOCAL_PATH | m4 macro definition of PKG_PROG_PKG_CONFIG & others. | DYLD_LIBRARY_PATH | macOS runtime dyn lib path. | MANPATH | man pages. |
export MANPATH=/usr/local/share/man:$MANPATH
brew_pkgconf=/usr/local/opt/pkg-config PATH=${brew_pkgconf}/bin:$PATH CPPFLAGS="${CPPFLAGS} -I${brew_pkgconf}/share/aclocal" m4path="${brew_pkgconf}/share/aclocal" MANPATH=${brew_pkgconf}/share/man:$MANPATH
brew_libtool=/usr/local/opt/libtool PATH=${brew_libtool}/bin:$PATH dyld_library_path=${brew_libtool}/lib:${DYLD_LIBRARY_PATH}
LDFLAGS="${LDFLAGS} -L${brew_libtool}/lib" CPPFLAGS="${CPPFLAGS} -I${brew_libtool}/include" m4path="${brew_libtool}/share/aclocal:$m4path" MANPATH=${brew_libtool}/share/man:$MANPATH
brew_m4=/usr/local/opt/m4 PATH=${brew_m4}/bin:$PATH MANPATH=${brew_m4}/share/man:$MANPATH
brew_autoconf=/usr/local/opt/autoconf PATH=${brew_autoconf}/bin:$PATH # m4path="${brew_autoconf}/share/autoconf/autoconf:${brew_autoconf}/share/autoconf/m4sugar:$m4path" export MANPATH=${brew_autoconf}/share/man:$MANPATH
brew_automake=/usr/local/opt/automake PATH=${brew_automake}/bin:$PATH m4path="${brew_automake}/share/aclocal-1.15:$m4path" MANPATH=${brew_automake}/share/man:$MANPATH
brew_openssl=/usr/local/opt/openssl PATH=${brew_openssl}/bin:$PATH dyld_library_path=${brew_openssl}/lib:${dyld_library_path} LDFLAGS="${LDFLAGS} -L${brew_openssl}/lib" # -lcrypto -lssl" CPPFLAGS="${CPPFLAGS} -I${brew_openssl}/include" MANPATH=${brew_openssl}/share/man:$MANPATH
brew_boost=/usr/local/opt/boost PATH=${brew_boost}/bin:$PATH dyld_library_path=${brew_boost}/lib:${dyld_library_path} export LDFLAGS="${LDFLAGS} -L${brew_boost}/lib" export CPPFLAGS="${CPPFLAGS} -I${brew_boost}/include/boost"
brew_libevent=/usr/local/opt/libevent PATH=${brew_libevent}/bin:$PATH dyld_library_path=${brew_libevent}/lib:${dyld_library_path} LDFLAGS="${LDFLAGS} -L${brew_libevent}/lib" CPPFLAGS="${CPPFLAGS} -I${brew_libevent}/include" MANPATH=${brew_libevent}/share/man:$MANPATH
brew_bdb=/usr/local/opt/berkeley-db@4 PATH=${brew_bdb}/bin:$PATH dyld_library_path=${brew_bdb}/lib:${dyld_library_path} LDFLAGS="${LDFLAGS} -L${brew_bdb}/lib" CPPFLAGS="${CPPFLAGS} -I${brew_bdb}/include"
brew_qt=/usr/local/opt/qt PATH=${brew_qt}/bin:$PATH dyld_library_path=${brew_qt}/lib:${dyld_library_path} export LDFLAGS="${LDFLAGS} -L${brew_qt}/lib" export CPPFLAGS="${CPPFLAGS} -I${brew_qt}/include"
brew_protobuf=/usr/local/opt/protobuf PATH=${brew_protobuf}/bin:$PATH dyld_library_path=${brew_protobuf}/lib:${dyld_library_path} LDFLAGS="${LDFLAGS} -L${brew_protobuf}/lib" CPPFLAGS="${CPPFLAGS} -I${brew_protobuf}/include"
# Add brew "cmake" formula *last* to environment, brew_cmake=/usr/local/Cellar/cmake/3.9.0 PATH=$PATH:${brew_cmake}/bin MANPATH=${brew_cmake}/share/man:$MANPATH
#Note: ACLOCAL_PATH which points to all important m4 macro definition of PKG_PROG_PKG_CONFIG & others.. export ACLOCAL_PATH=$m4path
export EDITOR=/usr/bin/nano
export bitcoin_enable_qt=yes
my_prefix=/Users/coinadm/local export PATH=${my_prefix}/bin:$PATH export DYLD_LIBRARY_PATH=${my_prefix}/lib:${dyld_library_path} export LDFLAGS export CPPFLAGS export MANPATH
alias ez="env | egrep 'FLAG|LIB' | sort" alias godev="cd ~/CLionProjects/bitcoin-ghc1" alias findmakes="find . -name Makefile.in | xargs -I {} -t ls -l {}" alias myag="./autogen.sh --with-gui=yes" alias myconf="./configure --prefix=${my_prefix} --with-gui=yes"
# godev # make clean # find . -name Makefile.in | xargs -I {} -t rm -f {}" # rm configure # myag # myconf # make # make install
Title: Re: macOS Sierra Bitcoin build and install; ACLOCAL_PATH and DYLD_LIBRARY_PATH
Post by: pebwindkraft on July 27, 2017, 07:13:55 AM
thank you for sharing. The Mac community will like it :) I used the pre-compiled binaries (and verified the checksums). Seems like I'm a bit too lazy, next time ...
Title: Re: macOS Sierra Bitcoin build and install; ACLOCAL_PATH and DYLD_LIBRARY_PATH
Post by: Racooma on July 27, 2017, 01:08:26 PM
Did you execute `source .profile`?
Title: Re: macOS Sierra Bitcoin build and install; ACLOCAL_PATH and DYLD_LIBRARY_PATH
Post by: yg10 on August 05, 2017, 12:47:28 AM
I recently performed native build from source of Bitcoin using the latest tag on macOS Sierra 10.12.5. I wanted to share a synopsis of my experience with other macOS & Unix developers. I am not sure the best way to share this information with the Bitcoin dev community, hence this post. Comments/feedback greatly appreciated, thank you. Firstly, I did find following documents quite useful: - doc/build-osx.md (https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md)
- doc/build-unix.md (https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md)
From these I installed the following Homebrew formulas: - autoconf
- berkeley-db@4
- libevent
- m4
- pkg-config
- qt
- automake
- boost
- libtool
- openssl
- protobuf
Importantly, macOS Sierra 10.12.5 comes with pre-installed versions of both m4 and libttool binaries (both installed in /usr/bin). So for compatibility with the rest of the standard Unix Auto-Tools (pkg-config, automake, & autoconf) we install and reference Homebrew versions of m4 and libtool, overriding the original binaries. Attention: Important Notes:- Unless ACLOCAL_PATH is set, configure will fail with the following error:
configure: error: PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh. - Unless DYLD_LIBRARY_PATH is set neither bitcoind or bitcoin-cli will be able to locate dependant dynamic shared platform libraries.
Setting ACLOCAL_PATH and DYLD_LIBRARY_PATH as below correct these issues. ..... IMVHO the best way is: 1. Issue the command: brew install pkg-configand re-run installation process. (This worked for me). 2. Open an issue on Github asking devs to update the list of software required. (did not do that).
Title: Re: macOS Sierra Bitcoin build and install; ACLOCAL_PATH and DYLD_LIBRARY_PATH
Post by: striker7334 2.0 on August 05, 2017, 03:08:39 AM
Nice I was looking into learning how to compile wallets and I think this would be a good guide for a noob like me. Thanks for the share!
|