{"action":"created","issue":{"url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/298","labels_url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/298/comments","events_url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/298/events","html_url":"https://github.com/libbitcoin/libbitcoin/issues/298","id":103350529,"number":298,"title":"OSX build errors","user":{"login":"antonimassomola","id":1773036,"avatar_url":"https://avatars.githubusercontent.com/u/1773036?v=3","gravatar_id":"","url":"https://api.github.com/users/antonimassomola","html_url":"https://github.com/antonimassomola","followers_url":"https://api.github.com/users/antonimassomola/followers","following_url":"https://api.github.com/users/antonimassomola/following{/other_user}","gists_url":"https://api.github.com/users/antonimassomola/gists{/gist_id}","starred_url":"https://api.github.com/users/antonimassomola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antonimassomola/subscriptions","organizations_url":"https://api.github.com/users/antonimassomola/orgs","repos_url":"https://api.github.com/users/antonimassomola/repos","events_url":"https://api.github.com/users/antonimassomola/events{/privacy}","received_events_url":"https://api.github.com/users/antonimassomola/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-26T19:50:04Z","updated_at":"2015-08-30T14:09:20Z","closed_at":null,"body":"Hello,\r\n\r\nWhen building an empty project that only includes bitcoin.hpp I'm getting a bunch of errors:\r\n```\r\nAntonis-MacBook-Pro-NQ:bitcoin antonimassomola$ gcc -o addr address.cpp $(pkg-config --cflags --libs libbitcoin)\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:28:\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:52:1: error: 'inline' can only appear on functions\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n^\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:52:35: error: no member named 'initializer_list' in namespace 'std'\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:52:52: error: unexpected type name 'data_slice': expected expression\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                                                   ^\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:52:64: error: use of undeclared identifier 'slices'\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                                                               ^\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:53:5: error: unexpected type name 'size_t': expected expression\r\n    size_t extra_space=0);\r\n    ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:28:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/utility/data.hpp:75:\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:30:25: error: expected '(' for function-style cast or type construction\r\n    return byte_array<1>{{byte}};\r\n\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:33:1: error: 'inline' can only appear on functions\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n^\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:33:19: error: redefinition of 'build_data'\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                  ^\r\n/usr/local/include/bitcoin/bitcoin/utility/data.hpp:52:19: note: previous definition is here\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                  ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:28:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/utility/data.hpp:75:\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:33:35: error: no member named 'initializer_list' in namespace 'std'\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:33:52: error: unexpected type name 'data_slice': expected expression\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                                                   ^\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:33:64: error: use of undeclared identifier 'slices'\r\ninline data_chunk build_data(std::initializer_list<data_slice> slices,\r\n                                                               ^\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:34:5: error: unexpected type name 'size_t': expected expression\r\n    size_t extra_space)\r\n    ^\r\n/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:34:24: error: expected ';' after top level declarator\r\n    size_t extra_space)\r\n                       ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:32:1: error: unknown type name 'constexpr'\r\nBC_CONSTEXPR size_t short_hash_size = 20;\r\n^\r\n/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'\r\n    #define BC_CONSTEXPR constexpr\r\n                         ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:32:20: error: expected ';' after top level declarator\r\nBC_CONSTEXPR size_t short_hash_size = 20;\r\n                   ^\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:33:1: error: unknown type name 'constexpr'\r\nBC_CONSTEXPR size_t hash_size = 32;\r\n^\r\n/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'\r\n    #define BC_CONSTEXPR constexpr\r\n                         ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:33:20: error: expected ';' after top level declarator\r\nBC_CONSTEXPR size_t hash_size = 32;\r\n                   ^\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:34:1: error: unknown type name 'constexpr'\r\nBC_CONSTEXPR size_t long_hash_size = 64;\r\n^\r\n/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'\r\n    #define BC_CONSTEXPR constexpr\r\n                         ^\r\nIn file included from address.cpp:1:\r\nIn file included from /usr/local/include/bitcoin/bitcoin.hpp:19:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:27:\r\nIn file included from /usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:25:\r\n/usr/local/include/bitcoin/bitcoin/math/hash.hpp:34:20: error: expected ';' after top level declarator\r\nBC_CONSTEXPR size_t long_hash_size = 64;\r\n                   ^\r\nfatal error: too many errors emitted, stopping now [-ferror-limit=]\r\n20 errors generated.\r\n```\r\n\r\nC++ Code:\r\n```\r\n#include < bitcoin/bitcoin.hpp >\r\nint main() {\r\nreturn 0; \r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/comments/136142748","html_url":"https://github.com/libbitcoin/libbitcoin/issues/298#issuecomment-136142748","issue_url":"https://api.github.com/repos/libbitcoin/libbitcoin/issues/298","id":136142748,"user":{"login":"skaht","id":6238506,"avatar_url":"https://avatars.githubusercontent.com/u/6238506?v=3","gravatar_id":"","url":"https://api.github.com/users/skaht","html_url":"https://github.com/skaht","followers_url":"https://api.github.com/users/skaht/followers","following_url":"https://api.github.com/users/skaht/following{/other_user}","gists_url":"https://api.github.com/users/skaht/gists{/gist_id}","starred_url":"https://api.github.com/users/skaht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skaht/subscriptions","organizations_url":"https://api.github.com/users/skaht/orgs","repos_url":"https://api.github.com/users/skaht/repos","events_url":"https://api.github.com/users/skaht/events{/privacy}","received_events_url":"https://api.github.com/users/skaht/received_events","type":"User","site_admin":false},"created_at":"2015-08-30T14:09:20Z","updated_at":"2015-08-30T14:09:20Z","body":"The code does build successfully on OSX platforms.  Follow the instructions Eric mentions that uses the native Mac clang++/clang compiler and not gcc.  Also follow https://github.com/libbitcoin/libbitcoin/blob/master/README.md#using-homebrew. You don't have to `% brew install boost` provided `--build-boost` flag is set in the scripts mentioned below.\r\n\r\nRecommend using the bundled **install.sh** to perform a build that will automatically utilize clang++, not gcc. This is by far the easiest technique to build the code. See https://github.com/libbitcoin/libbitcoin/blob/master/install.sh#L10 for install.sh options. Be sure to change the directory to where this install script natively resides before executing, and set the `--disable-shared` flag passed to the install.sh script.\r\n\r\nI normally don't build libbitcoin directly.  Instead, I tend to build it indirectly by using the install.sh scripts associated with **bitcoin-explorer (bx)** [https://github.com/libbitcoin/libbitcoin-explorer/blob/master/install.sh#L10] or **bitcoin-server (bs)** [https://github.com/libbitcoin/libbitcoin-server/blob/master/install.sh#L10]. Either of these two scripts will automatically download the appropriate source code and build the bx and bs executables using `clang++` on Mac platforms. This includes loading the source code and building libbitcoin.\r\n\r\nFor building bx try something like:\r\n\r\n`% ./install.sh --disable-shared --prefix=/Users/XXX/Projects/LB/bitcoin-explorer/test --build-dir=/Users/XXX/Projects/LB/bitcoin-explorer/build --build-icu --with-icu --build-boost` \r\n\r\nThe `--prefix` defines where the compiled code will be installed (e.g., /Users/XXX/Projects/LB/bitcoin-explorer/test/bin is where bx will be installed, and /Users/XXX/Projects/LB/bitcoin-explorer/test/etc/libbitcoin is where the template bx.cfg is found).  The `--build-dir` defines where interim compiled code will reside prior to the the installation. The `--with-icu` flag will enable https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-mnemonic-new to function properly. Additionally, though not explicitly documented, there is also a `--enable-testnet` flag used explicitly for building both bx and bs for native use on testnet.\r\n\r\nFYSA - With a few homegrown build scripts, not production ready, it is possible for me to get bx and bs to compile on both OSX 10.9 and 10.10 platforms using shared libraries.\r\n  \r\n"}}