Bitcoin Core compiled with Ubuntu Focal gcc-8 immediately segfaults #27487

issue maflcko opened this issue on April 18, 2023
  1. maflcko commented at 3:16 PM on April 18, 2023: member

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    segfault

    Expected behaviour

    no segfault

    Steps to reproduce

    • Fresh install of Ubuntu Focal
    • export DEBIAN_FRONTEND=noninteractive && apt update && apt install curl wget htop git vim ccache -y && git clone https://github.com/bitcoin/bitcoin.git --depth=1 ./bitcoin-core && cd bitcoin-core && apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq libevent-dev libboost-dev gcc-8 g++-8 -y
    • ./autogen.sh && ./configure CC=gcc-8 CXX=g++-8 && make -j $(nproc) src/bitcoind
    • valgrind ./src/bitcoind

    Relevant log output

    # valgrind ./src/bitcoind 
    ==19993== Memcheck, a memory error detector
    ==19993== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==19993== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
    ==19993== Command: ./src/bitcoind
    ==19993== 
    ==19993== Invalid read of size 8
    ==19993==    at 0x1FD15F: ~vector (stl_vector.h:567)
    ==19993==    by 0x1FD15F: std::filesystem::__cxx11::path::~path() (fs_path.h:209)
    ==19993==    by 0x1FD18B: ~_Cmpt (fs_path.h:644)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt> (stl_construct.h:98)
    ==19993==    by 0x1FD18B: __destroy<std::filesystem::__cxx11::path::_Cmpt*> (stl_construct.h:108)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt*> (stl_construct.h:137)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (stl_construct.h:206)
    ==19993==    by 0x1FD18B: ~vector (stl_vector.h:567)
    ==19993==    by 0x1FD18B: std::filesystem::__cxx11::path::~path() (fs_path.h:209)
    ==19993==    by 0x1C5A7C: ~path (fs.h:30)
    ==19993==    by 0x1C5A7C: ArgsManager::GetConfigFilePath() const [clone .cold.494] (system.cpp:838)
    ==19993==    by 0x6057E0: ArgsManager::ReadConfigFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool) (system.cpp:849)
    ==19993==    by 0x4F557F: common::InitConfig(ArgsManager&, std::function<bool (bilingual_str const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)>) (init.cpp:24)
    ==19993==    by 0x1CC16E: AppInit (bitcoind.cpp:155)
    ==19993==    by 0x1CC16E: main (bitcoind.cpp:266)
    ==19993==  Address 0x2b is not stack'd, malloc'd or (recently) free'd
    ==19993== 
    ==19993== 
    ==19993== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==19993==  Access not within mapped region at address 0x2B
    ==19993==    at 0x1FD15F: ~vector (stl_vector.h:567)
    ==19993==    by 0x1FD15F: std::filesystem::__cxx11::path::~path() (fs_path.h:209)
    ==19993==    by 0x1FD18B: ~_Cmpt (fs_path.h:644)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt> (stl_construct.h:98)
    ==19993==    by 0x1FD18B: __destroy<std::filesystem::__cxx11::path::_Cmpt*> (stl_construct.h:108)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt*> (stl_construct.h:137)
    ==19993==    by 0x1FD18B: _Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (stl_construct.h:206)
    ==19993==    by 0x1FD18B: ~vector (stl_vector.h:567)
    ==19993==    by 0x1FD18B: std::filesystem::__cxx11::path::~path() (fs_path.h:209)
    ==19993==    by 0x1C5A7C: ~path (fs.h:30)
    ==19993==    by 0x1C5A7C: ArgsManager::GetConfigFilePath() const [clone .cold.494] (system.cpp:838)
    ==19993==    by 0x6057E0: ArgsManager::ReadConfigFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool) (system.cpp:849)
    ==19993==    by 0x4F557F: common::InitConfig(ArgsManager&, std::function<bool (bilingual_str const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)>) (init.cpp:24)
    ==19993==    by 0x1CC16E: AppInit (bitcoind.cpp:155)
    ==19993==    by 0x1CC16E: main (bitcoind.cpp:266)
    ==19993==  If you believe this happened as a result of a stack
    ==19993==  overflow in your program's main thread (unlikely but
    ==19993==  possible), you can try to increase the size of the
    ==19993==  main thread stack using the --main-stacksize= flag.
    ==19993==  The main thread stack size used in this run was 8388608.
    ==19993== 
    ==19993== HEAP SUMMARY:
    ==19993==     in use at exit: 122,654 bytes in 1,182 blocks
    ==19993==   total heap usage: 2,545 allocs, 1,363 frees, 383,342 bytes allocated
    ==19993== 
    ==19993== LEAK SUMMARY:
    ==19993==    definitely lost: 0 bytes in 0 blocks
    ==19993==    indirectly lost: 0 bytes in 0 blocks
    ==19993==      possibly lost: 136 bytes in 1 blocks
    ==19993==    still reachable: 122,518 bytes in 1,181 blocks
    ==19993==         suppressed: 0 bytes in 0 blocks
    ==19993== Rerun with --leak-check=full to see details of leaked memory
    ==19993== 
    ==19993== For lists of detected and suppressed errors, rerun with: -s
    ==19993== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    Segmentation fault (core dumped)
    
    
    ### How did you obtain Bitcoin Core
    
    Compiled from source
    
    ### What version of Bitcoin Core are you using?
    
    current master
    
    ### Operating system and version
    
    -
    
    ### Machine specifications
    
    _No response_
    
  2. maflcko added the label Bug on Apr 18, 2023
  3. maflcko added the label Upstream on Apr 18, 2023
  4. maflcko added the label Build system on Apr 18, 2023
  5. maflcko commented at 3:21 PM on April 18, 2023: member
  6. fanquake commented at 3:21 PM on April 18, 2023: member

    Need to double check, but iirc this is due to an issue with the libstdc++ shipped with Focal being incompatible with GCC 8 (for some std::filesystem usage), becuase it's actually from GCC 9.

  7. maflcko commented at 3:27 PM on April 18, 2023: member

    Thanks

  8. maflcko closed this on Apr 18, 2023

  9. bitcoin locked this on Apr 2, 2025

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-05-03 15:13 UTC

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