[cxx feature check] what satisfies GNU_POSIX_REGEX | POSIX_REGEX?

trying to compile llvm 11 from source with cmake 3.19 and a llvm 11 toolchain on a X86 debian userland based node

llvm source is pulling in Google’s benchmarking https://github.com/google/benchmark/blob/master/CMakeLists.txt#L263 which tests for

  • GNU_POSIX_REGEX
  • POSIX_REGEX

and the test fails

-- Performing Test HAVE_GNU_POSIX_REGEX
 -- Performing Test HAVE_GNU_POSIX_REGEX
 -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
 -- Performing Test HAVE_POSIX_REGEX
 -- Performing Test HAVE_POSIX_REGEX
 -- Performing Test HAVE_POSIX_REGEX -- failed to compile
 CMake Warning at utils/benchmark/CMakeLists.txt:244 (message):
   Using std::regex with exceptions disabled is not fully supported

indicating that neither is available on the node.

since the node is based on the Debian package feed I was trying to find a package that satisfies either one but came up empty.

What package/code would satisfy GNU_POSIX_REGEX or POSIX_REGEX?

installed libghc-regex-posix-prof package but that did not help

ibpcre2-dev & libpcre2-posix2 are also installed, which according to https://pcre.org:

provides its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API.

I think GNU_POSIX_REGEX should be satisfied with gnulib(https://github.com/coreutils/gnulib/blob/master/lib/regex.h) and POSIX_REGEX with libstd++(https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/regex.h).

On my system but there is no gnuregex.h (https://github.com/llvm/llvm-project/blob/master/llvm/utils/benchmark/cmake/gnu_posix_regex.cpp#L1) available. So output is:-

– Performing Test HAVE_GNU_POSIX_REGEX – failed to compile
– Performing Test HAVE_POSIX_REGEX
– Performing Test HAVE_POSIX_REGEX
– Performing Test HAVE_POSIX_REGEX – success

If you don’t get a solution here you should either post on llvm-dev mailing list or open an issue on https://bugs.llvm.org/.

Thank you for the input/feedback

dpkg -L libstdc++-10-dev | grep regex.h
/usr/include/c++/10/bits/regex.h

With that the benchmark test fails, as cited in the initial post. Will check about the gnulib, currently though taking it up with the benchmark source developers.

It is not, it provides regex.h whilst, as you pointed out, CMake’s gnu_posix_regex.cpp is testing for gnuregex.h though. That seems rather for backward compatibility since gnuregex.h appears somehwat outdated and replaced by regex.h.