[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 benchmark/CMakeLists.txt at master · google/benchmark · GitHub 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?

1 Like

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(gnulib/regex.h at master · coreutils/gnulib · GitHub) and POSIX_REGEX with libstd++(gcc/regex.h at master · gcc-mirror/gcc · GitHub).

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.

@_z.0 I’m facing the exact same problem here. Found several similar issues on github/benchmark, so far nothing helped me. How did you eventually solved this?

Here (Fedora 37) there just is no package providing /usr/include/gnuregex.h A Google search doesn’t turn up anything that isn’t some compatibility shim.