build: fix build with newer boost and c++11 #5415

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2014_11_bigger_better_boost changing 1 files +10 −10
  1. laanwj commented at 10:30 AM on December 3, 2014: member

    (pull requesting this for @theuni in his absence) Fixes #5166, build with boost >=1.55 and c++11

    We don't actively support building the source with c++11, but this is the only problem preventing it from working, so may just as well fix it.

  2. build: fix newer boost build with c++11 8b99af2f96
  3. laanwj added this to the milestone 0.10.0 on Dec 3, 2014
  4. laanwj added the label Build system on Dec 3, 2014
  5. laanwj renamed this:
    build: fix newer boost build with c++11
    build: fix build with newer boost and c++11
    on Dec 3, 2014
  6. fanquake commented at 1:50 PM on December 3, 2014: member

    Testing with boost 1.56.0 and ./configure CXXFLAGS="-DDEBUG_LOCKORDER -g -std=c++11"

    The changes fix the issue described in #5166, but introduce a new compile error.

    In file included from ./allocators.h:9:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:423:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:16:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:598:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:253:9: error: field has incomplete type 'const CScriptID'
        _T1 first;
            ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2023:27: note: in instantiation of template class 'std::__1::pair<const CScriptID, CScript>' requested here
                     decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
                              ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2072:14: note: in instantiation of template class 'std::__1::__is_constructible<false, std::__1::allocator<std::__1::pair<const CScriptID,
          CScript> >>' requested here
        : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
                 ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2098:14: note: in instantiation of template class 'std::__1::__is_constructible_void_check<false, std::__1::allocator<std::__1::pair<const
          CScriptID, CScript> >>' requested here
        : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
                 ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2578:34: note: in instantiation of template class 'std::__1::is_constructible<std::__1::allocator<std::__1::pair<const CScriptID, CScript>
          >>' requested here
        : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
                                     ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2700:14: note: in instantiation of template class 'std::__1::is_nothrow_constructible<std::__1::allocator<std::__1::pair<const CScriptID,
          CScript> >>' requested here
        : public is_nothrow_constructible<_Tp>
                 ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:840:13: note: in instantiation of template class 'std::__1::is_nothrow_default_constructible<std::__1::allocator<std::__1::pair<const CScriptID,
          CScript> > >' requested here
                is_nothrow_default_constructible<allocator_type>::value &&
                ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:332:34: note: expanded from macro '_NOEXCEPT_'
    #  define _NOEXCEPT_(x) noexcept(x)
                                     ^
    ./keystore.h:55:7: note: in instantiation of exception specification for 'map' requested here
    class CBasicKeyStore : public CKeyStore
          ^
    ./keystore.h:17:7: note: forward declaration of 'CScriptID'
    class CScriptID;
          ^
    In file included from keystore.cpp:6:
    In file included from ./keystore.h:9:
    In file included from ./key.h:9:
    In file included from ./allocators.h:9:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:423:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:16:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:598:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:254:9: error: field has incomplete type 'CScript'
        _T2 second;
            ^
    ./serialize.h:21:7: note: forward declaration of 'CScript'
    class CScript;
          ^
    ./crypter.h:139:5: note: implicit default constructor for 'CBasicKeyStore' first required here
        CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false)
        ^
    In file included from keystore.cpp:6:
    In file included from ./keystore.h:9:
    In file included from ./key.h:9:
    In file included from ./allocators.h:9:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1384:53: error: static_cast from 'pointer' (aka 'std::__1::__tree_node<std::__1::__value_type<CScriptID, CScript>, void *> *') to
          '__node_base_pointer' (aka 'std::__1::__tree_node_base<void *> *') is not allowed
            __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    keystore.cpp:42:15: note: in instantiation of member function 'std::__1::map<CScriptID, CScript, std::__1::less<CScriptID>, std::__1::allocator<std::__1::pair<const CScriptID, CScript> > >::operator[]' requested here
        mapScripts[CScriptID(redeemScript)] = redeemScript;
                  ^
    In file included from keystore.cpp:6:
    In file included from ./keystore.h:9:
    In file included from ./key.h:9:
    In file included from ./allocators.h:9:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1219:16: error: static_cast from '__node_pointer' (aka 'std::__1::__tree_node<std::__1::__value_type<CScriptID, CScript>, void *> *') to
          '__node_base_pointer' (aka 'std::__1::__tree_node_base<void *> *') is not allowed
        __parent = static_cast<__node_base_pointer>(__tree_.__end_node());
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1379:36: note: in instantiation of member function 'std::__1::map<CScriptID, CScript, std::__1::less<CScriptID>,
          std::__1::allocator<std::__1::pair<const CScriptID, CScript> > >::__find_equal_key' requested here
        __node_base_pointer& __child = __find_equal_key(__parent, __k);
                                       ^
    keystore.cpp:42:15: note: in instantiation of member function 'std::__1::map<CScriptID, CScript, std::__1::less<CScriptID>, std::__1::allocator<std::__1::pair<const CScriptID, CScript> > >::operator[]' requested here
        mapScripts[CScriptID(redeemScript)] = redeemScript;
                  ^
    In file included from keystore.cpp:6:
    In file included from ./keystore.h:9:
    In file included from ./key.h:9:
    In file included from ./allocators.h:9:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:967:50: error: no viable conversion from 'const_iterator' (aka '__tree_const_iterator<value_type, __node_pointer, difference_type>') to
          'const_iterator' (aka '__map_const_iterator<typename __base::const_iterator>')
        const_iterator end() const _NOEXCEPT {return __tree_.end();}
                                                     ^~~~~~~~~~~~~
    keystore.cpp:56:26: note: in instantiation of member function 'std::__1::map<CScriptID, CScript, std::__1::less<CScriptID>, std::__1::allocator<std::__1::pair<const CScriptID, CScript> > >::end' requested here
        if (mi != mapScripts.end())
                             ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:713:29: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const_iterator'
          (aka '__tree_const_iterator<value_type, __node_pointer, difference_type>') to 'const std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<CScriptID, CScript>, std::__1::__tree_node<std::__1::__value_type<CScriptID,
          CScript>, void *> *, long> > &' for 1st argument
    class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator
                                ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:713:29: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'const_iterator'
          (aka '__tree_const_iterator<value_type, __node_pointer, difference_type>') to 'std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<CScriptID, CScript>, std::__1::__tree_node<std::__1::__value_type<CScriptID, CScript>,
          void *> *, long> > &&' for 1st argument
    class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator
                                ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:739:5: note: candidate constructor not viable: no known conversion from 'const_iterator'
          (aka '__tree_const_iterator<value_type, __node_pointer, difference_type>') to '__map_iterator<typename __tree_const_iterator<__value_type<CScriptID, CScript>, __tree_node<__value_type<CScriptID, CScript>, void *> *, long>::__non_const_iterator>' for
          1st argument
        __map_const_iterator(
        ^
    5 errors generated.
    make[2]: *** [libbitcoin_common_a-keystore.o] Error 1
    make[1]: *** [check-recursive] Error 1
    make: *** [check-recursive] Error 1
    
  7. laanwj commented at 1:58 PM on December 3, 2014: member

    Ok, closing then, it's not a fix if it causes a new problem.

  8. laanwj closed this on Dec 3, 2014

  9. theuni commented at 8:06 PM on December 8, 2014: member

    Fwiw, that doesn't look like a "new" problem. It appears to just get past the first issue and further into the build before it runs into a different c++11 incompatibility.

  10. laanwj commented at 8:06 AM on December 9, 2014: member

    I submitted this under the pretense that this was the only c++11 incompatibility. Seemingly it's one of many so it's not worth doing this now.

  11. theuni commented at 4:28 AM on December 18, 2014: member

    Just posting for posterity: This was indeed the only incompatibility I ran into in Linux.

    The error above is libstdc++-specific, but it's a legitimate bug in c++11 mode. See: http://llvm.org/bugs/show_bug.cgi?id=13471

    I have it hack-fixed locally, but it involves a good bit of code movement.

  12. theuni commented at 5:16 AM on December 18, 2014: member

    err.. s/libstdc++/libc++/

  13. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me