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?


I had the same issue and resolved it by installing the "pcre2-devel" package. I had pcre and pcre-devel packages, which worked for R 3.x as well as the pcre2 package, but the required "pcre2-devel" wasn't installed by default.

  • 1
    Thanks, can you please tell me how to install the pcre2-devel package? I couldn't find any source for that. Is it included in pcre2 source? – Dronacharya Mar 6 at 5:35
  • I only had to run "yum install pcre2-devel" but it's present in the "rhel-7-server-optional-rpms" repository on my machine. I'm not sure what the repository for RHEL 6.8 is but you could review the repositories in /etc/yum.repos.d/redhat.repo and set "enabled=true" for the optional RPMS repository. You may want to shoot in the dark and try "yum install --enable-repo=rhel-6-server-optional-rpms pcre2-devel" – Teague Sterling Mar 8 at 17:08
  • The only problem is I don't have sudo permissions. That's why I was doing local installs of the dependencies. Do you have any other suggestions? – Dronacharya Mar 10 at 6:40

I solved my problem like this:

  1. wget https://ftp.pcre.org/pub/pcre/pcre2-10.37.tar.gz
  2. tar - zxvf pcre2-10.37.tar.gz
  3. cd pcre2-10.37
  4. ./configure
  5. make -j 24
  6. make install

I am using Ubuntu 20.04 and R version 4.1.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.