configure: error: cannot figure out how to use std::filesystem #27148

issue pinheadmz openend this issue on February 23, 2023
  1. pinheadmz commented at 4:05 pm on February 23, 2023: member

    Got this error from configure when trying to build from tag v24.0.1 on Ubuntu 18.

    At first my gcc was version gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) so I tried installing clang 10: clang version 10.0.0-4ubuntu1~18.04.2 and linked to CXX, etc… still got the same error.

    0$ uname -a
    1Linux party 4.15.0-163-generic [#171](/bitcoin-bitcoin/171/)-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    2
    3$ lsb_release -a
    4No LSB modules are available.
    5Distributor ID: Ubuntu
    6Description:    Ubuntu 18.04.4 LTS
    7Release:        18.04
    8Codename:       bionic
    

    Complete output:

     0$ ./configure --without-gui --with-incompatible-bdb
     1checking for pkg-config... /usr/bin/pkg-config
     2checking pkg-config is at least version 0.9.0... yes
     3checking build system type... x86_64-pc-linux-gnu
     4checking host system type... x86_64-pc-linux-gnu
     5checking for a BSD-compatible install... /usr/bin/install -c
     6checking whether build environment is sane... yes
     7checking for a thread-safe mkdir -p... /bin/mkdir -p
     8checking for gawk... gawk
     9checking whether make sets $(MAKE)... yes
    10checking whether make supports nested variables... yes
    11checking whether to enable maintainer-specific portions of Makefiles... yes
    12checking whether make supports nested variables... (cached) yes
    13checking whether the C++ compiler works... yes
    14checking for C++ compiler default output file name... a.out
    15checking for suffix of executables...
    16checking whether we are cross compiling... no
    17checking for suffix of object files... o
    18checking whether we are using the GNU C++ compiler... yes
    19checking whether /usr/bin/clang++-10 accepts -g... yes
    20checking for style of include used by make... GNU
    21checking dependency style of /usr/bin/clang++-10... gcc3
    22checking whether /usr/bin/clang++-10 supports C++17 features with -std=c++17... yes
    23checking whether std::filesystem can be used without link library... no
    24checking whether std::filesystem needs -lstdc++fs... no
    25checking whether std::filesystem needs -lc++fs... configure: error: in `/root/bitcoin':
    26configure: error: cannot figure out how to use std::filesystem
    27See `config.log' for more details
    
  2. pinheadmz added the label Bug on Feb 23, 2023
  3. fanquake commented at 4:07 pm on February 23, 2023: member

    ./configure –without-gui –with-incompatible-bdb

    I see clang is being used in the output, but how are you passing clang through? CC=clang=10 CXX=clang++? What is the actual output in config.log?

  4. pinheadmz commented at 4:12 pm on February 23, 2023: member

    yeah:

    0$ env | grep clang
    1CC=/usr/bin/clang-10
    2CXX=/usr/bin/clang++-10
    

    This is the relevant chunk from config.log:

     0
     1configure:4823: checking whether /usr/bin/clang++-10 supports C++17 features with -std=c++17
     2configure:5619: /usr/bin/clang++-10 -std=c++17 -c -g -O2  conftest.cpp >&5
     3configure:5619: $? = 0
     4configure:5628: result: yes
     5configure:6565: checking whether std::filesystem can be used without link library
     6configure:6581: /usr/bin/clang++-10 -std=c++17 -o conftest -g -O2   conftest.cpp  >&5
     7conftest.cpp:11:12: fatal error: 'filesystem' file not found
     8  #include <filesystem>
     9           ^~~~~~~~~~~~
    101 error generated.
    11configure:6581: $? = 1
    12configure: failed program was:
    13| /* confdefs.h */
    14| #define PACKAGE_NAME "Bitcoin Core"
    15| #define PACKAGE_TARNAME "bitcoin"
    16| #define PACKAGE_VERSION "24.0.1"
    17| #define PACKAGE_STRING "Bitcoin Core 24.0.1"
    18| #define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
    19| #define PACKAGE_URL "https://bitcoincore.org/"
    20| #define HAVE_CXX17 1
    21| /* end confdefs.h.  */
    22|
    23|   #include <filesystem>
    24|
    25|   namespace fs = std::filesystem;
    26|
    27|   int main() {
    28|     (void)fs::current_path().root_name();
    29|     return 0;
    30|   }
    31|
    32configure:6588: result: no
    33configure:6592: checking whether std::filesystem needs -lstdc++fs
    34configure:6607: /usr/bin/clang++-10 -std=c++17 -o conftest -g -O2   conftest.cpp  -lstdc++fs >&5
    35conftest.cpp:11:12: fatal error: 'filesystem' file not found
    36  #include <filesystem>
    37           ^~~~~~~~~~~~
    381 error generated.
    39configure:6607: $? = 1
    40configure: failed program was:
    41| /* confdefs.h */
    42| #define PACKAGE_NAME "Bitcoin Core"
    43| #define PACKAGE_TARNAME "bitcoin"
    44| #define PACKAGE_VERSION "24.0.1"
    45| #define PACKAGE_STRING "Bitcoin Core 24.0.1"
    46| #define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues"
    47| #define PACKAGE_URL "https://bitcoincore.org/"
    48| #define HAVE_CXX17 1
    49| /* end confdefs.h.  */
    50|
    51|   #include <filesystem>
    52|
    53|   namespace fs = std::filesystem;
    54|
    55|   int main() {
    56|     (void)fs::current_path().root_name();
    57|     return 0;
    58|   }
    59configure:6614: result: no
    60configure:6616: checking whether std::filesystem needs -lc++fs
    61configure:6632: /usr/bin/clang++-10 -std=c++17 -o conftest -g -O2   conftest.cpp  -lc++fs >&5
    62conftest.cpp:11:12: fatal error: 'filesystem' file not found
    63  #include <filesystem>
    64           ^~~~~~~~~~~~
    
  5. pinheadmz commented at 4:16 pm on February 23, 2023: member

    Errors in config.log look the same with gcc 7 too:

    0checking whether g++ supports C++17 features with -std=c++17... yes
    1checking whether std::filesystem can be used without link library... no
    2checking whether std::filesystem needs -lstdc++fs... no
    3checking whether std::filesystem needs -lc++fs... configure: error: in `/root/bitcoin':
    4configure: error: cannot figure out how to use std::filesystem
    5See `config.log' for more details
    
  6. hebasto commented at 4:16 pm on February 23, 2023: member

    yeah:

    0$ env | grep clang
    1CC=/usr/bin/clang-10
    2CXX=/usr/bin/clang++-10
    

    You’re still using an old libstdc++.

  7. maflcko commented at 4:19 pm on February 23, 2023: member
    gcc 7 doesn’t have filesystem. You can try CC=clang-10 CXX="clang++-10 -stdlib=libc++"
  8. fanquake commented at 4:22 pm on February 23, 2023: member

    This is the relevant chunk from config.log:

    Installing libstdc++-8-dev will solve the problem.

  9. pinheadmz commented at 4:23 pm on February 23, 2023: member

    Installing libstdc++-8-dev will solve the problem.

    YES! Thanks. Add to docs ?

  10. hebasto commented at 4:28 pm on February 23, 2023: member

    Add to docs ?

    Probably, it does not worth, considering that Ubuntu 18 is about to reach “End of Standard Support” soon.

  11. hebasto removed the label Bug on Feb 23, 2023
  12. hebasto added the label Build system on Feb 23, 2023
  13. hebasto added the label Questions and Help on Feb 23, 2023
  14. pinheadmz closed this on Feb 23, 2023

  15. pinheadmz added the label Docs on Mar 27, 2023
  16. wangtao19911111 commented at 8:35 am on May 31, 2023: none

    This is the relevant chunk from config.log:

    Installing libstdc++-8-dev will solve the problem.

    how to install this lib?

  17. maflcko commented at 10:55 am on May 31, 2023: member
    @wangtao19911111 The minimum required version is installed by default with g++, if you use the latest LTS release of your operating system.
  18. bitcoin locked this on May 30, 2024

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: 2024-12-21 15:12 UTC

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