Skip to content

Build error related to APR in config.c #3173

Closed
@Marcool04

Description

@Marcool04

Describe the bug

Building fails with these two errors related to APR:

config.c: In function ‘process_command_config’:                                                                        08:40:49 [85/3634]
config.c:1107:60: error: passing argument 1 of ‘apr_filepath_root’ from incompatible pointer type [-Wincompatible-pointer-types]         
 1107 |                                 status = apr_filepath_root(&rootpath, &incpath, APR_FILEPATH_TRUENAME | APR_FILEPATH_NATIVE, ptem
p);                                                                                                                                      
      |                                                            ^~~~~~~~~                                                             
      |                                                            |                                                                     
      |                                                            char **                                                               
In file included from /usr/include/apr-1/apr_file_io.h:29,                                                                               
                 from /usr/include/apr-1/apr_network_io.h:26,                                                                            
                 from /usr/include/apr-1/apr_buckets.h:29,                                                                               
                 from /usr/include/httpd/util_filter.h:26,                                                                               
                 from /usr/include/httpd/http_core.h:32,                                                                                 
                 from config.c:18:                                                                                                       
/usr/include/apr-1/apr_file_info.h:336:58: note: expected ‘const char **’ but argument is of type ‘char **’                              
  336 | APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,                                                               
      |                                             ~~~~~~~~~~~~~^~~~~~~~                                                                
config.c:1107:71: error: passing argument 2 of ‘apr_filepath_root’ from incompatible pointer type [-Wincompatible-pointer-types]         
 1107 |                                 status = apr_filepath_root(&rootpath, &incpath, APR_FILEPATH_TRUENAME | APR_FILEPATH_NATIVE, ptem
p);                                                                                                                                      
      |                                                                       ^~~~~~~~                                                   
      |                                                                       |                                                          
      |                                                                       char **                                                    
/usr/include/apr-1/apr_file_info.h:337:58: note: expected ‘const char **’ but argument is of type ‘char **’                              
  337 |                                             const char **filepath,                                                               
      |                                             ~~~~~~~~~~~~~^~~~~~~~

Logs and dumps

Full build log is here: https://termbin.com/4pis (too big for a github comment)

To Reproduce

The build script is this one: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libmodsecurity2 equivalent to getting the latest tagged v2 release (v2.9.7 and doing:

  ./autogen.sh
  ./configure \
    --prefix=/usr \
    --enable-standalone-module \
    --enable-htaccess-config
  echo "Fixing libtool for hardcoded_into_libs"
  sed -ri 's|(hardcode_into_libs)=.*|\1=no|' libtool
  echo "Fixing apache2/msc_lua.c to accept lua 5.4"
  sed -i 's#LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503#LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504#' "apache2/msc_lua.c"
  sed -ri 's/We are only tested under Lua 5.0, 5.1, 5.2, or 5.3./We are only tested under Lua 5.0, 5.1, 5.2, or 5.3 (and faking 5.4)./' "apache2/msc_lua.c"
  make

Expected behavior

Successful build.

Server (please complete the following information):

  • ModSecurity version (and connector): modsecurity v2.9.7
  • WebServer: N/A
  • OS (and distro): Arch linux

Rule Set (please complete the following information):
N/A

Additional context

Since the error is coming from the file /usr/include/apr-1/apr_file_io.h I checked that out, it is owned by package apr, so I checked if any recent changes had occurred there but we have:

$ pacman -F /usr/include/apr-1/apr_file_io.h                                                               
usr/include/apr-1/apr_file_io.h is owned by extra/apr 1.7.4-1 

$ pacman -Qi apr
Name            : apr
Version         : 1.7.4-1
Description     : The Apache Portable Runtime
[snip]
Build Date      : Wed 25 Oct 2023 08:24:16 PM CEST
Install Date    : Sun 29 Oct 2023 09:43:43 AM CET

so this is old stuff...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions