#66824 closed defect (fixed)

php70-mbstring @7.0.33: error: incomplete definition of type 'struct php_mb_re_pattern_buffer'

Reported by: Lomantik Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: php

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I'm trying to install the port on my MacBook Air (M1) and getting the error. Here is the log from my terminal:

# sudo port install php70-mbstring     
--->  Computing dependencies for php70-mbstring
--->  Fetching archive for php70-mbstring
--->  Attempting to fetch php70-mbstring-7.0.33_0.darwin_22.arm64.tbz2 from https://fra.de.packages.macports.org/php70-mbstring
--->  Attempting to fetch php70-mbstring-7.0.33_0.darwin_22.arm64.tbz2 from https://packages.macports.org/php70-mbstring
--->  Attempting to fetch php70-mbstring-7.0.33_0.darwin_22.arm64.tbz2 from https://nue.de.packages.macports.org/php70-mbstring
--->  Building php70-mbstring
Error: Failed to build php70-mbstring: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php70-mbstring/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port php70-mbstring failed

I'm attaching the main.log file (compressed with gzip).

Attachments (1)

main.log.gz (25.7 KB) - added by Lomantik 21 months ago.

Download all attachments as: .zip

Change History (5)

Changed 21 months ago by Lomantik

Attachment: main.log.gz added

comment:1 Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: set to ryandesign
Port: php added; php70-mbstring removed
Status: newassigned
Summary: php70-mbstring building errorphp70-mbstring @7.0.33: error: incomplete definition of type 'struct php_mb_re_pattern_buffer'

I'll have to investigate. The error in the log is:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php70-mbstring/work/php-7.0.33/ext/mbstring/php_mbregex.c:455:15: error: incomplete definition of type 'struct php_mb_re_pattern_buffer'
        if (!rc || rc->options != options || rc->enc != enc || rc->syntax != syntax) {
                   ~~^
/opt/local/include/oniguruma.h:707:8: note: forward declaration of 'struct php_mb_re_pattern_buffer'
struct re_pattern_buffer;
       ^
./php_onig_compat.h:4:37: note: expanded from macro 're_pattern_buffer'
#define re_pattern_buffer           php_mb_re_pattern_buffer
                                    ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php70-mbstring/work/php-7.0.33/ext/mbstring/php_mbregex.c:455:41: error: incomplete definition of type 'struct php_mb_re_pattern_buffer'
        if (!rc || rc->options != options || rc->enc != enc || rc->syntax != syntax) {
                                             ~~^
/opt/local/include/oniguruma.h:707:8: note: forward declaration of 'struct php_mb_re_pattern_buffer'
struct re_pattern_buffer;
       ^
./php_onig_compat.h:4:37: note: expanded from macro 're_pattern_buffer'
#define re_pattern_buffer           php_mb_re_pattern_buffer
                                    ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php70-mbstring/work/php-7.0.33/ext/mbstring/php_mbregex.c:455:59: error: incomplete definition of type 'struct php_mb_re_pattern_buffer'
        if (!rc || rc->options != options || rc->enc != enc || rc->syntax != syntax) {
                                                               ~~^
/opt/local/include/oniguruma.h:707:8: note: forward declaration of 'struct php_mb_re_pattern_buffer'
struct re_pattern_buffer;
       ^
./php_onig_compat.h:4:37: note: expanded from macro 're_pattern_buffer'
#define re_pattern_buffer           php_mb_re_pattern_buffer
                                    ^
3 errors generated.
make: *** [php_mbregex.lo] Error 1

comment:2 Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)

Status: assignedaccepted

This is an incompatibility with oniguruma 6.8.1 and later.

To work around it, deactivate oniguruma6 first and (assuming you still want it for other reasons) reactivate it later:

sudo port -f deactivate oniguruma6
sudo port clean php70-mbstring
sudo port install php70-mbstring
sudo port activate oniguruma6

(Trace mode (sudo port -t install php70-mbstring) would also work around the problem except that trace mode is currently broken on macOS Ventura and later; see #66358.)

This is the upstream bug report:

https://bugs.php.net/76113

Here is FreeBSD's bug report about it:

https://bugs.freebsd.org/226717

This is the fix which went into PHP 7.1 and later:

https://github.com/php/php-src/commit/4072b2787074ee8e247a6639585b49e10c5a55fe

php74-mbstring and later depend on and require MacPorts oniguruma6 to be installed. php73-mbstring and earlier have a bundled copy of oniguruma but php54-oniguruma and later will use the MacPorts oniguruma6 port if it is installed, which I didn't realize before.

I need to either make php54-mbstring through php73-mbstring not use a MacPorts oniguruma if installed, or I need to backport that fix to php 7.0 and earlier and add the oniguruma6 dependency to php54-mbstring through php73-mbstring.

comment:3 Changed 21 months ago by Lomantik

Wow! It was very fast! Thanks for the fast answer! You helped me!

comment:4 Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In ced951b8189f446673290e297d320856199e7ebd/macports-ports (master):

php-mbstring: Fix conflict with oniguruma6

Closes: #66824

Note: See TracTickets for help on using tickets.