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.
$ uname -a
Linux 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
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Complete output:
$ ./configure --without-gui --with-incompatible-bdb
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/clang++-10 accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of /usr/bin/clang++-10... gcc3
checking whether /usr/bin/clang++-10 supports C++17 features with -std=c++17... yes
checking whether std::filesystem can be used without link library... no
checking whether std::filesystem needs -lstdc++fs... no
checking whether std::filesystem needs -lc++fs... configure: error: in `/root/bitcoin':
configure: error: cannot figure out how to use std::filesystem
See `config.log' for more details