libbitcoin / libbitcoin-system

Bitcoin Cross-Platform C++ Development Toolkit
https://libbitcoin.info/
Other
1.3k stars 381 forks source link

Mac OSX Build Error/Issue #194

Closed skaht closed 9 years ago

skaht commented 9 years ago

I noticed libbitcoin/libbitcoin was recently updated. My Jan. 17th libbitcoin.tar.gz, originating from "git clone https://github.com/libbitcoin/libbitcoin.git", compiles fine using homegrown scripting - at the bottom of this thread as a reference. However, from the new source, creating a new tarball from "git clone https://github.com/libbitcoin/libbitcoin.git" or "git clone --branch version2 --single-branch https://github.com/libbitcoin/libbitcoin" and using either of the newly synthesized tarballs as the source for building libbitcoin leads to the following compilation errors:

CXX src/math/src_libbitcoin_la-ec_keys.lo CC src/math/external/src_libbitcoin_la-hmac_sha256.lo CC src/math/external/src_libbitcoin_la-hmac_sha512.lo CC src/math/external/src_libbitcoin_la-ripemd160.lo CC src/math/external/src_libbitcoin_la-sha1.lo CC src/math/external/src_libbitcoin_la-sha256.lo CC src/math/external/src_libbitcoin_la-sha512.lo CC src/math/external/src_libbitcoin_la-zeroize.lo ../libbitcoin/src/math/ec_keys.cpp:115:24: error: use of undeclared identifier 'secp256k1_nonce_function_rfc6979' secret.data(), secp256k1_nonce_function_rfc6979, nullptr) != 1) ^ ../libbitcoin/src/math/ec_keys.cpp:131:24: error: use of undeclared identifier 'secp256k1_nonce_function_rfc6979' secret.data(), secp256k1_nonce_function_rfc6979, nullptr, ^ ../libbitcoin/src/math/ec_keys.cpp:146:19: error: no matching function for call to 'secp256k1_ecdsa_verify' auto result = secp256k1_ecdsa_verify(hash.data(), signature.data(), ^~~~~~ /Users/Scott/Projects/BX/Libsecp256k1/include/secp256k1.h:85:34: note: candidate function not viable: requires 6 arguments, but 5 were provided SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify( ^ ../libbitcoin/src/math/ec_keys.cpp:167:9: error: no matching function for call to 'secp256k1_ecdsa_recover_compact' if (secp256k1_ecdsa_recover_compact( hash.data(), ^~~~~~~ /Users/Scott/Projects/BX/Libsecp256k1/include/secp256k1.h:147:34: note: candidate function not viable: requires 7 arguments, but 6 were provided SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover_compact( ^

4 errors generated.

My previously working build script looks like:

tar xvzf $package.tar.gz pushd $package ./autogen.sh

popd && mkdir -p src && pushd src ../$package/configure \ --prefix=$libbitcoin_dir \ CPPFLAGS="-I$boost_dir/include -I$gmp_dir/include" \ LDFLAGS="-L$boost_dir/lib -L$gmp_dir/lib" \ BOOST_CPPFLAGS=-I$boost_dir/include \ BOOST_LDFLAGS=-L$boost_dir/lib \ BOOST_DATE_TIME_LIB=-lboost_date_time \ BOOST_FILESYSTEM_LIB=-lboost_filesystem \ BOOST_REGEX_LIB=-lboost_regex \ BOOST_SYSTEM_LIB=-lboost_system \ BOOST_UNIT_TEST_FRAMEWORK_LIB=-lboost_unit_test_framework \ PKG_CONFIG_PATH=$secp256k1_dir/lib/pkgconfig \ --enable-ndebug \ --disable-dependency-tracking

make -j$processors_available check make install

I hope this issue can be resolved. It would really be nice if v2.8.0 was officially a tag within the git repo.

FYSA - Also running into compilation build issues with libbitcoin-server, after getting libbitcoin-blockchain and libbitcoin-node to build.

evoskuil commented 9 years ago

You have the wrong version of secp256k1.

Please see the install script.

evoskuil commented 9 years ago

Version 2.8.0 is staged for release but has not been tagged yet because it has not been fully verified across the server stack. The server stack has no prior releases (except for obelisk).

evoskuil commented 9 years ago

There are no known build issues on OS X or Ubuntu (or Windows) in any of the Libbitcoin repos. They are regularly built in Travis using the install.sh in each repo.

skaht commented 9 years ago

Sorry that was so thick. I now fully understand your team moves at break neck pace of the HEAD, sorry meant version2...

Executing the install.sh scripts for bx and libbitcoin-server can be fragile, especially if you don't have the latest up to date ones... I now see that I was constantly playing configuration catch up.

OLD - build_from_github libbitccdoin secp256k1 master $PARALLEL "$@" $SECP256K1_OPTIONS NEW - build_from_github libbitcoin secp256k1 version2 $PARALLEL "$@" $SECP256K1_OPTIONS

Got bitcoin-server to compile:-) Albeit, the not so easy way. But, I learned a number of things in the process... ...

evoskuil commented 9 years ago

No worries. Thanks for sticking with it.

We spent quite a bit of time on build generation and the Travis check-in gate in order to increase reliability. Also the release branches have been introduced to ensure the stability following release. If you build master you are on the bleeding edge, as that is our staging area. And building manually means you may miss some things. The installer is really the best documentation, and it's entirely generated along with configure.ac and the Travis script using libbitcoin-build.

The current issue with the server stack is that it has never been released, so up until recently it's only been bleeding edge. Only recently has a release branch and versioning been set up, pending release.

If you install different branches of given dependencies into a common location you can have issues. The install scripts are really intended to build the entire stack independently for each repo. I generally build into a prefix location and even allow the script to build boost each time so as to entirely isolate the build. If you do that you can install each build for each repo independently and they don't touch each other. On the other hand, as long as you build bx and server from latest you should be fine even in the same prefix, since both are now building from version2.