0

I'm trying to install libbitcoin on Mac os 10.9, with Eclipse for C++.

I follow the instructions given on github (https://github.com/libbitcoin/libbitcoin), then I include:

#include <bitcoin/bitcoin.hpp>
using namespace bc;

The installation seems fine but when I build the project (cap4.cpp) I get the following errors in Eclipse:

    Building file: ../cap4.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"cap4.d" -MT"cap4.o" -o "cap4.o" "../cap4.cpp"
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
In file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:29:
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:51:14: error: no type named 'initializer_list' in namespace 'std'
typedef std::initializer_list<data_slice> loaf;
        ~~~~~^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:51:30: error: expected unqualified-id
typedef std::initializer_list<data_slice> loaf;
                             ^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:68:31: error: unknown type name 'loaf'
inline data_chunk build_chunk(loaf slices, size_t extra_reserve=0);
                              ^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:75:41: error: unknown type name 'loaf'
bool build_array(byte_array<Size>& out, loaf slices);
                                        ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
In file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:29:
In file included from /usr/local/include/bitcoin/bitcoin/utility/data.hpp:156:
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:32:25: error: expected '(' for function-style cast or type construction
    return byte_array<1>{ { byte } };
           ~~~~~~~~~~~~~^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:37:22: error: expected '(' for function-style cast or type construction
    return data_chunk{ byte };
           ~~~~~~~~~~^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:40:31: error: unknown type name 'loaf'
inline data_chunk build_chunk(loaf slices, size_t extra_reserve)
                              ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:55:41: error: unknown type name 'loaf'
bool build_array(byte_array<Size>& out, loaf slices)
                                        ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:95:57: error: expected expression
    /* safe to ignore */ build_array<Left + Right>(out, { left, right });
                                                        ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:105:43: error: expected expression
    /* safe to ignore */ build_array(out, { left, middle, right });
                                          ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:126:54: error: expected expression
    DEBUG_ONLY(const auto result =) build_array(out, { bytes });
                                                     ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:35:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t hash_size = 32;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:35:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t hash_size = 32;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:36:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t half_hash_size = hash_size / 2;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:36:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t half_hash_size = hash_size / 2;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:37:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t quarter_hash_size = half_hash_size / 2;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:37:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t quarter_hash_size = half_hash_size / 2;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:38:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t long_hash_size = 2 * hash_size;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:38:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t long_hash_size = 2 * hash_size;
                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [cap4.o] Error 1

What's wrong?

1 Answer 1

1

It looks like there are issues with gcc on Mac. On an issue in the libbitcoin github repository 'evoskuil' states:

gcc on osx is problematic because the ABI implementation is incomplete.

It is further suggested to use "the native Mac clang++/clang compiler" instead of gcc.

The libbitcoin Macintosh readme prescribes:

Libbitcoin requires a C++11 compiler, currently minimum GCC 4.8.0 or Clang based on LLVM 3.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.