Build failure with `-D_GLIBCXX_USE_CXX11_ABI=0`: `error: no type named 'iterator_category' in 'struct std::iterator_traits<RPCResult>'` #35892

issue barracuda156 opened this issue on August 5, 2026
  1. barracuda156 commented at 5:08 AM on August 5, 2026: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Build fails on

    /opt/local/include/gcc16/c++/bits/cow_string.h:2298:76: error: no type named 'iterator_category' in 'struct std::iterator_traits<RPCResult>'
    2298 |           typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
         |                                                                            ^~~~
    

    Expected behaviour

    Build should succeed.

    Steps to reproduce

    Run the build.

    Relevant log output

    :info:build cd /opt/local/var/macports/build/bitcoin-7de26319/work/build/src && /opt/local/bin/g++-mp-16 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DENABLE_EMBEDDED_ASMAP=1 -DENABLE_ZMQ=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/opt/local/var/macports/build/bitcoin-7de26319/work/build/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/leveldb/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/minisketch/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/univalue/include -isystem /opt/local/libexec/boost/1.88/include -isystem /opt/local/include -pipe -Os -DNDEBUG -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.88/include -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++20 -arch ppc -mmacosx-version-min=10.6 -fPIC -fno-extended-identifiers -fmacro-prefix-map=/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wleading-whitespace=spaces -Wtrailing-whitespace=any -Wno-unused-parameter -D_THREAD_SAFE -MD -MT src/CMakeFiles/bitcoin_node.dir/consensus/tx_verify.cpp.o -MF CMakeFiles/bitcoin_node.dir/consensus/tx_verify.cpp.o.d -o CMakeFiles/bitcoin_node.dir/consensus/tx_verify.cpp.o -c /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/consensus/tx_verify.cpp -UNDEBUG
    :info:build [ 32%] Building CXX object src/wallet/CMakeFiles/bitcoin_wallet.dir/rpc/coins.cpp.o
    :info:build cd /opt/local/var/macports/build/bitcoin-7de26319/work/build/src/wallet && /opt/local/bin/g++-mp-16 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/opt/local/var/macports/build/bitcoin-7de26319/work/build/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/univalue/include -isystem /opt/local/include -isystem /opt/local/libexec/boost/1.88/include -pipe -Os -DNDEBUG -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.88/include -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++20 -arch ppc -mmacosx-version-min=10.6 -fPIC -fno-extended-identifiers -fmacro-prefix-map=/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wleading-whitespace=spaces -Wtrailing-whitespace=any -Wno-unused-parameter -MD -MT src/wallet/CMakeFiles/bitcoin_wallet.dir/rpc/coins.cpp.o -MF CMakeFiles/bitcoin_wallet.dir/rpc/coins.cpp.o.d -o CMakeFiles/bitcoin_wallet.dir/rpc/coins.cpp.o -c /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/wallet/rpc/coins.cpp -UNDEBUG
    :info:build [ 32%] Building CXX object src/CMakeFiles/bitcoin_node.dir/dbwrapper.cpp.o
    :info:build cd /opt/local/var/macports/build/bitcoin-7de26319/work/build/src && /opt/local/bin/g++-mp-16 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DENABLE_EMBEDDED_ASMAP=1 -DENABLE_ZMQ=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/opt/local/var/macports/build/bitcoin-7de26319/work/build/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/leveldb/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/minisketch/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/univalue/include -isystem /opt/local/libexec/boost/1.88/include -isystem /opt/local/include -pipe -Os -DNDEBUG -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.88/include -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++20 -arch ppc -mmacosx-version-min=10.6 -fPIC -fno-extended-identifiers -fmacro-prefix-map=/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wleading-whitespace=spaces -Wtrailing-whitespace=any -Wno-unused-parameter -D_THREAD_SAFE -MD -MT src/CMakeFiles/bitcoin_node.dir/dbwrapper.cpp.o -MF CMakeFiles/bitcoin_node.dir/dbwrapper.cpp.o.d -o CMakeFiles/bitcoin_node.dir/dbwrapper.cpp.o -c /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/dbwrapper.cpp -UNDEBUG
    :info:build /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/wallet/rpc/coins.cpp: In function 'RPCHelpMan wallet::getbalances()':
    :info:build /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/wallet/rpc/coins.cpp:408:39: warning: narrowing conversion of '(const char*)""' from 'const char*' to 'bool' [-Wnarrowing]
    :info:build   408 |             RPCResult::Type::OBJ, "", "",
    :info:build       |                                       ^~
    :info:build In file included from /opt/local/include/gcc16/c++/bits/basic_string.h:64,
    :info:build                  from /opt/local/include/gcc16/c++/string:58,
    :info:build                  from /opt/local/include/gcc16/c++/bits/locale_classes.h:43,
    :info:build                  from /opt/local/include/gcc16/c++/bits/ios_base.h:43,
    :info:build                  from /opt/local/include/gcc16/c++/ios:46,
    :info:build                  from /opt/local/include/gcc16/c++/bits/ostream.h:43,
    :info:build                  from /opt/local/include/gcc16/c++/ostream:42,
    :info:build                  from /opt/local/include/gcc16/c++/iostream:43,
    :info:build                  from /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/tinyformat.h:146,
    :info:build                  from /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/util/translation.h:8,
    :info:build                  from /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/util/result.h:9,
    :info:build                  from /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/core_io.h:9,
    :info:build                  from /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/wallet/rpc/coins.cpp:5:
    :info:build /opt/local/include/gcc16/c++/bits/cow_string.h: In instantiation of 'static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = RPCResult; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]':
    :info:build /opt/local/include/gcc16/c++/bits/cow_string.h:2320:27:   required from 'static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = RPCResult; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
    :info:build  2320 |           return _S_construct_aux(__beg, __end, __a, _Integral());
    :info:build       |                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :info:build /opt/local/include/gcc16/c++/bits/cow_string.h:727:28:   required from 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with _InputIterator = RPCResult; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
    :info:build   727 |         : _M_dataplus(_S_construct(__beg, __end, __a), __a)
    :info:build       |                       ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    :info:build /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/wallet/rpc/coins.cpp:419:13:   required from here
    :info:build   419 |             },
    :info:build       |             ^
    :info:build /opt/local/include/gcc16/c++/bits/cow_string.h:2298:76: error: no type named 'iterator_category' in 'struct std::iterator_traits<RPCResult>'
    :info:build  2298 |           typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
    :info:build       |                                                                            ^~~~
    :info:build [ 32%] Building CXX object src/CMakeFiles/bitcoin_node.dir/deploymentstatus.cpp.o
    :info:build cd /opt/local/var/macports/build/bitcoin-7de26319/work/build/src && /opt/local/bin/g++-mp-16 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DENABLE_EMBEDDED_ASMAP=1 -DENABLE_ZMQ=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/opt/local/var/macports/build/bitcoin-7de26319/work/build/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/leveldb/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/minisketch/include -I/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/univalue/include -isystem /opt/local/libexec/boost/1.88/include -isystem /opt/local/include -pipe -Os -DNDEBUG -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.88/include -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++20 -arch ppc -mmacosx-version-min=10.6 -fPIC -fno-extended-identifiers -fmacro-prefix-map=/opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wleading-whitespace=spaces -Wtrailing-whitespace=any -Wno-unused-parameter -D_THREAD_SAFE -MD -MT src/CMakeFiles/bitcoin_node.dir/deploymentstatus.cpp.o -MF CMakeFiles/bitcoin_node.dir/deploymentstatus.cpp.o.d -o CMakeFiles/bitcoin_node.dir/deploymentstatus.cpp.o -c /opt/local/var/macports/build/bitcoin-7de26319/work/bitcoin-31.1/src/deploymentstatus.cpp -UNDEBUG
    :info:build make[2]: *** [src/wallet/CMakeFiles/bitcoin_wallet.dir/rpc/coins.cpp.o] Error 1
    :info:build make[2]: Leaving directory `/opt/local/var/macports/build/bitcoin-7de26319/work/build'
    :info:build make[1]: *** [src/wallet/CMakeFiles/bitcoin_wallet.dir/all] Error 2
    :info:build make[1]: *** Waiting for unfinished jobs....
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    31.1

    Operating system and version

    macOS 10.6.8

    Machine specifications

    gcc 16.1.0

  2. maflcko added the label macOS on Aug 5, 2026
  3. maflcko added the label Build system on Aug 5, 2026
  4. maflcko added the label Questions and Help on Aug 5, 2026
  5. maflcko commented at 5:39 AM on August 5, 2026: member

    I can compile it the 31.x branch fine with gcc 16.1.1 on Linux.

    How did you install GCC?

    Is there a reason to use GCC, when macOS has Clang available?

  6. maflcko added the label RPC/REST/ZMQ on Aug 5, 2026
  7. barracuda156 commented at 5:54 AM on August 5, 2026: none

    @maflcko Thank you for responding. This should be reproducible on Linux, I believe, if you build with -D_GLIBCXX_USE_CXX11_ABI=0 (with the same gcc-16).

    Is there a reason to use GCC, when macOS has Clang available?

    Well, I build on an exotic macOS where clang never worked, but the issue is not really related to macOS, the code here assumes -D_GLIBCXX_USE_CXX11_ABI=1, while GCC official supports dual ABI.

  8. maflcko commented at 6:24 AM on August 5, 2026: member

    macOS 10.6.8

    This is an ancient macOS version, without any support or security fixes. I wouldn't recommend running it while connected to the internet. Recall that even macOS 13 is EOL without security fixes and support for it has been dropped in #33489 for bitcoin core 31.x

    -D_GLIBCXX_USE_CXX11_ABI=0

    Bitcoin Core uses C++20 code, and I don't think the pre-C++11 ABI supports this. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html:

    Some features are not supported when using the old ABI, including: ...

    Also, the Qt GUI likely won't be working due to ABI mismatches, unless you compile Qt with the same ABI, e.g. via depends. Even if the pre-C++11-ABI supported C++20, it is unclear which C++20 features/assumptions will break from this. I wouldn't recommend using -D_GLIBCXX_USE_CXX11_ABI=0, but if you manage to do it, you should at least run the unit and functional tests and then continue at your own risk.

    My recommendation would be to install a Linux over your macOS intel machine.

  9. barracuda156 commented at 6:44 AM on August 5, 2026: none

    The “old” ABI does not prevent using the latest C++ (for example, C++23 works fine on my system), but as you rightly noted, there are a few divergences between the two ABIs (cowstring- and chrono-related, I recall).

    Qt6 is broken at the moment, but I am not sure that is related to C++ ABI (or at least not primarily to it – and ABI issues are fixable, as they are documented and known).

    P. S. I get your reasoning re the OS version, and I would not ask the upstream to bother fixing something for the old macOS SDK, but this specific issue just incidentally shows up on old macOS, being as such unrelated to it.

  10. maflcko commented at 6:58 AM on August 5, 2026: member

    Why is it even required to set the pre-C++11 ABI?

    Unless there is a valid use-case, I doubt this will be fixed.

    Given that you are compiling from source, you can trivially fix this yourself: E.g.:

    diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp
    index 677ac8f..9899668 100644
    --- a/src/wallet/rpc/coins.cpp
    +++ b/src/wallet/rpc/coins.cpp
    @@ -409,3 +409,3 @@ RPCMethod getbalances()
                 RPCResult::Type::OBJ, "", "",
    -            {
    +            std::vector<RPCResult>{
                     {RPCResult::Type::OBJ, "mine", "balances from outputs that the wallet can sign",
    diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp
    index ed3c8bf..f921548 100644
    --- a/src/wallet/rpc/wallet.cpp
    +++ b/src/wallet/rpc/wallet.cpp
    @@ -43,3 +43,3 @@ static RPCMethod getwalletinfo()
                         RPCResult::Type::OBJ, "", "",
    -                    {
    +                    std::vector<RPCResult>{
                             {
    
  11. maflcko commented at 7:10 AM on August 5, 2026: member

    So my recommendation would be to set -D_GLIBCXX_USE_CXX11_ABI=1.

    Also, can you replace gcc 16 in the title with -D_GLIBCXX_USE_CXX11_ABI=0?

  12. barracuda156 renamed this:
    Build failure with gcc 16: `error: no type named 'iterator_category' in 'struct std::iterator_traits<RPCResult>'`
    Build failure with `-D_GLIBCXX_USE_CXX11_ABI=0`: `error: no type named 'iterator_category' in 'struct std::iterator_traits<RPCResult>'`
    on Aug 5, 2026
  13. barracuda156 commented at 7:16 AM on August 5, 2026: none

    Why is it even required to set the pre-C++11 ABI?

    It is not required in a sense of usage of new ABI being impossible, rather it is a trade-off between fixing a dozen ports for old ABI vs re-building literally every C++ port (i.e. thousands), and then fixing some of those (ABI may be “new”, but it is not guaranteed to have no issues of its own). (I understand this is not someone else’s problem, I am just replying to the question.)

  14. maflcko commented at 7:25 AM on August 5, 2026: member

    I see that re-building thousand of packages can be tedious, but IIUC you are the first one (and only one?) to run into the -D_GLIBCXX_USE_CXX11_ABI=0 problem. So it is still cheaper for you to just let the -D_GLIBCXX_USE_CXX11_ABI=1 re-build run over night for an electricity cost of less than 5$, than it is for us to add an -D_GLIBCXX_USE_CXX11_ABI=0 CI config with all the overhead with questionable benefit and run that config on all pull requests.

  15. barracuda156 commented at 8:15 AM on August 5, 2026: none

    In all honesty I did not expect anyone to set CI for this specific case. It is not worth doing. I also generally do not expect upstreams to test anything for systems which are not explicitly supported. (I do expect MacPorts to test stuff on platforms which are officially supported, though even that does not happen as it should, but not arbitrary upstreams.) Fixing issues on case-by-case basis is more than enough. What is not trouble to fix upstream is worth fixing though, since rebasing gazillion of patches every week is not fun lol. But even that is not an issue – suggesting a solution is already good. (And while normally I can come up with a patch on my own, it is preferable to have a fix from developers of a given software.)

    P. S. Re ABI switch: I am somewhat favorable to the idea in principle, and it was discussed with GCC upstream maintainer of our systems, but it is really not a matter of one night, rather a few months of dedicated work. Indeed, it may still be worth in a sense that it gonna solve this kind of issues once for all, but it is anything but trivial. (Just as an illustration: ObjC++ codegen in gcc has bitrotten, and if a port is compiled with C++11 and it has specific ObjC++ code, binaries may segfault at runtime. This happen to affect not just ports which I maintain, but a couple of ports I care about personally. Sure enough, there is some way to fix that, but debugging it is not straightforward at all.)

  16. maflcko commented at 9:11 AM on August 5, 2026: member

    Ok, I see.

    I find the workaround patch a bit ugly, and if it landed, without CI, it will likely break soon anyway.

    I think if you want to maintain a patch in that fashion, you are free to do so inside macports.

    I guess this issue can be closed for now as WONTFIX, or rather: A patch/fix suggestion is available?

  17. barracuda156 commented at 12:28 PM on August 5, 2026: none

    @maflcko Ok, this works: https://github.com/macos-powerpc/powerpc-ports/blob/8370280efddc2321e0db034e0f981fb30c2dbecd/finance/bitcoin/files/patch-old-cxx-abi.diff (maybe even without wallet.cpp part, but I followed your draft in that). Indeed, trivial to maintain, so I will close this. Anyone facing the same issue hopefully can find this topic with a fix.

  18. barracuda156 closed this on Aug 5, 2026


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-08-10 21:51 UTC

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