Skip to content

SLES15 compile error with mbstring oniguruma #20491

Closed

Description

@VARGA-Peter

Description

Compiling 8.4.14 fails with gcc 15.2.0
gcc-14 compiles 8.4.14, but has a warning.

/builds/php-8.4.14/ext/mbstring/php_mbregex.c: In function ‘php_mbregex_compile_pattern’:
/builds/php-8.4.14/ext/mbstring/php_mbregex.c:472:25: error: too many arguments to function ‘onig_error_code_to_str’; expected 0, have 3
  472 |                         onig_error_code_to_str(err_str, err_code, &err_info);
      |                         ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
In file included from /builds/php-8.4.14/ext/mbstring/php_mbregex.c:31:
/usr/include/oniguruma.h:751:5: note: declared here
  751 | int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
      |     ^~~~~~~~~~~~~~~~~~~~~~
/builds/php-8.4.14/ext/mbstring/php_mbregex.c: In function ‘_php_mb_regex_ereg_replace_exec’:
/builds/php-8.4.14/ext/mbstring/php_mbregex.c:1070:25: error: too many arguments to function ‘onig_error_code_to_str’; expected 0, have 2
 1070 |                         onig_error_code_to_str(err_str, err);
      |                         ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
/usr/include/oniguruma.h:751:5: note: declared here
  751 | int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
      |     ^~~~~~~~~~~~~~~~~~~~~~
/builds/php-8.4.14/ext/mbstring/php_mbregex.c: In function ‘zif_mb_split’:
/builds/php-8.4.14/ext/mbstring/php_mbregex.c:1242:17: error: too many arguments to function ‘onig_error_code_to_str’; expected 0, have 2
 1242 |                 onig_error_code_to_str(err_str, err);
      |                 ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
/usr/include/oniguruma.h:751:5: note: declared here
  751 | int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
      |     ^~~~~~~~~~~~~~~~~~~~~~
/builds/php-8.4.14/ext/mbstring/php_mbregex.c: In function ‘_php_mb_regex_ereg_search_exec’:
/builds/php-8.4.14/ext/mbstring/php_mbregex.c:1383:17: error: too many arguments to function ‘onig_error_code_to_str’; expected 0, have 2
 1383 |                 onig_error_code_to_str(err_str, err);
      |                 ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
/usr/include/oniguruma.h:751:5: note: declared here
  751 | int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...)); 

PHP Version

PHP 8.4.14

Operating System

SLES 15 SP7

Activity

  1. devnexen commented on Nov 15, 2025

    @devnexen
    Member

    Hi @VARGA-Peter what are your ./configure commands and environment variables (e.g. CFLAGS) ? Cheers.

  2. VARGA-Peter commented on Nov 15, 2025

    @VARGA-Peter
    Author

    That's all. I use the default compiler settings.

    CompilerName=gcc-15
    ./buildconf --force
    
    # prepare the config string
    CONFIGURE_STRING="                                  \
       --prefix=/usr                                    \
       --sysconfdir=/etc                                \
       --host=`sh config.guess`                         \
       --with-apxs2=/usr/bin/apxs2                      \
       --disable-cgi                                    \
       --enable-cli                                     \
       --with-config-file-scan-dir=/etc/php8/conf.d     \
       --with-config-file-path=/etc/php8/apache2        \
       --with-openssl                                   \
       --with-zlib                                      \
       --enable-bcmath                                  \
       --with-bz2                                       \
       --enable-calendar                                \
       --with-curl                                      \
       --enable-exif                                    \
       --enable-ftp                                     \
       --enable-gd                                      \
       --with-gettext                                   \
       --enable-mbstring                                \
       --with-mysqli=mysqlnd                            \
       --with-mysql-sock=MySQLi/PDO_MYSQL               \
       --with-pdo-mysql                                 \
       --without-sqlite3                                \
       --enable-shmop                                   \
       --enable-sockets                                 \
       --enable-xml                                     \
       --with-pear                                      \
       --enable-zts                                     \
       --enable-pcntl                                   \
    "
    
    ###########################################################
    
    rm config.status
    rm config.cache
    rm config.log
    make clean
    
    ###########################################################
    
    ./configure CC="$CompilerName" $CONFIGURE_STRING
    
  3. devnexen commented on Nov 15, 2025

    @devnexen
    Member

    I used gcc 15.2 but from ubuntu 25.10 and the mbstring extension had no issue compiling, not even a warning. Wonder if there is an env var involved (e.g. CFLAGS). Would be helpful to have the build log (with compiler commands)

  4. ndossche commented on Nov 15, 2025

    @ndossche
    Member

    The issue is specific to SLES15. Arguably this should be reported to them as it seems to me they meddled with the oniguruma source code.

    The definition in oniguruma.h on that platform looks like this (same as upstream):

    ONIG_EXTERN
    int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));

    Where PV_ is defined as (differs):

    #ifndef PV_
    #ifdef HAVE_STDARG_PROTOTYPES
    # define PV_(args) args
    #else
    # define PV_(args) ()
    #endif
    #endif

    So that means that HAVE_STDARG_PROTOTYPES is unset. This can be set if we define HAVE_STDARG_H, which we can do because PHP requires at least C99 in which the header is always available.

    I think the following patch would fix this but please confirm @VARGA-Peter :

    diff --git a/ext/mbstring/php_onig_compat.h b/ext/mbstring/php_onig_compat.h
    index c97ba0c5cb6..5a1fa8eeaaf 100644
    --- a/ext/mbstring/php_onig_compat.h
    +++ b/ext/mbstring/php_onig_compat.h
    @@ -5,4 +5,10 @@
     #define regex_t                     php_mb_regex_t
     #define re_registers                php_mb_re_registers
     
    +/* Required for some distros that conditionally override PV_.
    + * As we're in C99 this header is always available. */
    +#ifndef HAVE_STDARG_H
    +# define HAVE_STDARG_H
    +#endif
    +
     #endif /* _PHP_ONIG_COMPAT_H */
    
  5. devnexen commented on Nov 15, 2025

    @devnexen
    Member

    would updating configure.ac headers list work ?

  6. ndossche commented on Nov 15, 2025

    @ndossche
    Member

    would updating configure.ac headers list work ?

    Probably. You may risk that someone's going to remove that though because they may think "the header is always available, why do we need to check this?"

  7. devnexen commented on Nov 15, 2025

    @devnexen
    Member

    fair point

  8. 4 remaining items

  9. changed the title [-]gcc-15 can't compile 8.4.14[/-] [+]SLES15 compile error with mbstring oniguruma[/+] on Nov 16, 2025
  10. added a commit that references this issue on Nov 16, 2025
    37f5ccb
  11. added 4 commits that reference this issue on Nov 20, 2025
    10ac41f
    929e717
    c0cf841
    a1912e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions