Skip to content

legacy pcre being preferred over pcre2 during ./configure #3453

@Vitadek

Description

@Vitadek

Just to say, this is probably a skill issue, but I've been building this through a Dockerfile:
Docker version 28.5.1, build e180ab8

...
#
# Check for libpcre only if explicitly requested
#
if test "x${with_pcre}" != "x" && test "x${with_pcre}" != "xno"; then
  CHECK_PCRE
else
  #
  # Check for pcre2
  #
  PROG_PCRE2
fi
...

##PCRE
if test "x${with_pcre}" != "x" \
   && test "x${with_pcre}" != "xno" \
   && test "x${PCRE_VERSION}" == "x"; then
    AC_MSG_NOTICE([*** pcre library not found.])
else
    echo "   + PCRE                                          ....found "
    echo "     using pcre v${PCRE_VERSION}"
    echo "      ${PCRE_LDADD}, ${PCRE_CFLAGS}"
fi


## PCRE2
if test "x$PCRE2_FOUND" = "x0"; then
    echo "   + PCRE2                                          ....not found"
fi
if test "x$PCRE2_FOUND" = "x1"; then
    AS_ECHO_N("   + PCRE2                                          ....found ")
    if ! test "x$PCRE2_VERSION" = "x"; then
        echo "v${PCRE2_VERSION}"
    else
        echo ""
    fi
    echo "      ${PCRE2_DISPLAY}"
fi
if test "x$PCRE2_FOUND" = "x2"; then
    echo "   + PCRE2                                          ....disabled"
fi
...

For some reason, during build time, even though pcre is an optional package, it complains that pcre (legacy) is needed during build time. I was able to successfully build this with the trixie:latest docker image by using explicit ./configure flags, but when trying this on alma8/alma9 builds, I get some issues when setting my .spec %configure macro.

...
RUN export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig && \
    ./configure \                                                                                                                                             
        --prefix=/usr \                                                        
        --libdir=/usr/lib/x86_64-linux-gnu \                                                                                                                  
        --enable-examples=no \
        --disable-debug-logs \
       #### I had to explicitly set the following for it to work ###
        --with-pcre=no \
        --with-pcre2=/usr
...

The following build errors out

...
%configure \
        --prefix=/usr \                                                        
        --libdir=/usr/lib64 \                                                                                                                                 
        --enable-examples=no \
        --disable-debug-logs \    
       #### Same flags ####                                             
        --with-pcre=no \                                                       
        --with-pcre2=/usr
...
12.01 checking for libpcre config script... checking for pcre-config... no                                                                                    
12.01 configure: pcre-config not found in environment. checking known paths                                                                                   
12.01 no                                                                                                                                                      
12.01 configure: *** pcre library not found.                                                                                                                  
12.01 configure: error: pcre library is required                                                                                                              
12.04                                                                                                                                                         
12.04                                                                                                                                                         
12.04 RPM build errors:                                                                                                                                       
12.04 error: Bad exit status from /var/tmp/rpm-tmp.lZBCcV (%build)                                                                                            
12.04     Macro expanded in comment on line 48: %{_libdir} is /usr/lib64                                                                                      
12.04                                                                                                                                                         
12.04     Macro expanded in comment on line 49: %{_includedir} is /usr/include                                                                                
12.04                                                                                                                                                         
12.04     Bad exit status from /var/tmp/rpm-tmp.lZBCcV (%build)

I've tried removing the pcre flags to let the build.sh and autoconf figure things out, and I've tried installing pcre-devel anyways with prcre2-devel and the same issues occur.

Sometimes, configure will pass through to the build stage, but it'll find out that the pcre header files don't exist and chastise me.

EDIT: I guess I set it up with pcre-devel (legacy package) and it worked and identified pcre2 afterwards, but even with explicit ./configure flag it still looks for the pcre-devel package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xRelated to ModSecurity version 3.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions