I am trying to do a build and local install of R 4.0.4 on Red Hat Linux 6.8. There were several unmet dependencies which I resolved by doing local installations (following the procedure in this). However, I couldn’t resolve the issue of pcre2 with that procedure. This is the configure command I run:

./configure --with-pcre2 --prefix=HOME/bin/R-4.0.4 --enable-R-shlib LDFLAGS="-L/HOME/local/zlib-1.2.11/lib -L/HOME/local/bzip2-1.0.8/lib -L/HOME/local/xz-5.2.5/lib -L/HOME/local/pcre2-10.00/lib" CPPFLAGS="-I/HOME/local/zlib-1.2.11/include"

This is the error I get:

checking whether PCRE support suffices... no
configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support

I also tried configure with a local installation of pcre-8.44 and –with-pcre1 flag but I get the same error.

What should I do so that the configure script detects the pcre2 local installation?