Skip to content

fix(build): update pcre2 autoconf macro and dependencies #2813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

fzipi
Copy link
Contributor

@fzipi fzipi commented Oct 11, 2022

This PR fixes pcre2 builds for extended architectures. In summary:

  • moved from custom m4 to using standard macro from autoconf-archive
  • updated dependent automake files
  • fixed calls to echo in configure.ac to standard, to be more portable

Signed-off-by: Felipe Zipitria felipe.zipitria@owasp.org

Fixes #2810

@fzipi fzipi changed the title fix(build): add libpcre2-8 to possible names fix(build): update pcre2 autoconf macro and dependencies Oct 13, 2022
@fzipi fzipi force-pushed the fix-pcre2-config-usage branch 2 times, most recently from 2b947f3 to 1e3fbc3 Compare October 14, 2022 01:14
@fzipi
Copy link
Contributor Author

fzipi commented Oct 17, 2022

I have a less intrusive patch for this, if needed.

Copy link
Contributor

@martinhsv martinhsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only commenting on one of three aspects for now.

@fzipi
Copy link
Contributor Author

fzipi commented Dec 7, 2022

Is this of any value, or should I close it?

@martinhsv
Copy link
Contributor

@fzipi ,

I haven't looked at this since your comment #2813 (comment) .

I had understood that you were going to make some changes. But perhaps I misunderstood you?

@fzipi
Copy link
Contributor Author

fzipi commented Dec 7, 2022

Will rebase first and split the change, you are right.

fzipi added 4 commits December 7, 2022 16:17
Fixes debian builds using pcre2 on extended architectures.

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
@fzipi fzipi force-pushed the fix-pcre2-config-usage branch from e350ea4 to 97d13ac Compare December 7, 2022 19:23
@manojkavali
Copy link

When will be Modsecurity 2.9.7 will be released ? Since we need PCRE2 support for our Apache Modsecurity Binary.

@martinhsv
Copy link
Contributor

martinhsv commented Jan 5, 2023 via email

@agebhar1
Copy link

Would be great if the fix gets into v3. PCRE2 is also not found on SUSE.

@martinhsv
Copy link
Contributor

martinhsv commented Apr 25, 2023

Finally getting back to this.

FIrst off, I'm not clear on the precise scope of the proposed fix. In general, ModSecurity .m4 files are structured to attempt to find a dependency automatically, but to also allow the path to be specified via the configure option. Is it the case that A) one can still successfully specify the pcre2 location via the option or B) even that fallback option does not work.

A second concern is that the this PR introduces a second .m4 file for pcre2. The pattern thus far has been for a single .m4 file to deal with a particular dependency. Even if there is no problem with the two stepping on each other, I expect it's undesirable to deviate from the existing convention unless it's truly necessary.

Finally, the introduction of the include 'config.h' requires more information. What is this file exactly? Are the required pcre2 definitions housed in this file in some of those more esoteric environments? I'm a little uneasy about making presumptions about what a "config.h" file is and including it this way. For one thing, what if at some point a "config.h" file is created within ModSecurity's /src directory at some point in the future. What is some other component or dependency has a "config.h" file.

@agebhar1
Copy link

I'm not able to reproduce it anymore. Add the --with-pcre2 works on SuSE to detect PCRE2. From the config.log:

…
configure:6934: PCRE2 support was marked as mandatory by the utilization of --with-pcre2=yes
configure:6956: Nothing about PCRE2 was informed during the configure phase. Trying to detect it on the platform...
configure:7022: PCRE2 headers found at: /usr/include
configure:7017: PCRE2 library found at: /usr/lib64//libpcre2-8.so
configure:7022: PCRE2 headers found at: /usr/include
configure:7017: PCRE2 library found at: /usr/lib64//libpcre2-8.so
configure:7022: PCRE2 headers found at: /usr/include
configure:7092: PCRE2 library found at: /usr/lib64//libpcre2-8.so
configure:7097: PCRE2 headers found at: /usr/include
configure:7133: using PCRE2 v
…
PCRE2_CFLAGS='-DWITH_PCRE2 -I/usr/include'
PCRE2_CFLAGS_FALSE='#'
PCRE2_CFLAGS_TRUE=''
PCRE2_DISPLAY='-lpcre2-8, -DWITH_PCRE2 -I/usr/include'
PCRE2_FOUND='1'
PCRE2_LDADD='-lpcre2-8'
PCRE2_LDFLAGS='-L/usr/lib64/'
PCRE2_LIBS=''
PCRE2_VERSION=''
…

But, the information is not taken from pkg-config, since at SuSE the library is not within PCRE2_POSSIBLE_LIB_NAMES.

$ pkg-config --list-all | grep pcre
libpcreposix     libpcreposix - PCREPosix - Posix compatible interface to libpcre
libpcrecpp       libpcrecpp - PCRECPP - C++ wrapper for PCRE
libpcre2-8       libpcre2-8 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 8 bit character support
libpcre          libpcre - PCRE - Perl compatible regular expressions C library with 8 bit character support
libpcre2-posix   libpcre2-posix - Posix compatible interface to libpcre2-8
libpcre2-16      libpcre2-16 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 16 bit character support
libpcre2-32      libpcre2-32 - PCRE2 - Perl compatible regular expressions C library (2nd API) with 32 bit character support
libpcre16        libpcre16 - PCRE - Perl compatible regular expressions C library with 16 bit character support

The commit from @fzipi fix(build): add libpcre2-8 to possible names resolves the issue and pkg-config can request the information about PCRE2.

@martinhsv
Copy link
Contributor

Thanks @agebhar1 for the clarification.

Even though there was no problem with the overall functionality, for the sake of completeness/tidiness, I have gone ahead and merged that narrower change via #2939 .

I'll go ahead and close this item.

@martinhsv martinhsv closed this Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PCRE2 library is not found in all debian supported architectures
4 participants