Skip to content

Improved building mbstring on PHP 7.4#1124

Merged
morozov merged 1 commit into
phpbrew:masterfrom
morozov:php74-mbstring
Dec 25, 2019
Merged

Improved building mbstring on PHP 7.4#1124
morozov merged 1 commit into
phpbrew:masterfrom
morozov:php74-mbstring

Conversation

@morozov
Copy link
Copy Markdown
Contributor

@morozov morozov commented Dec 24, 2019

As of PHP 7.4, the oniguruma library is no longer bundled with PHP, instead libonig needs to be available on the system.

As of [PHP 7.4][1], the oniguruma library is no longer bundled with PHP, instead libonig needs to be available on the system.

[1]: https://www.php.net/manual/en/migration74.other-changes.php#migration74.other-changes.mbstring
@morozov morozov added this to the Release 1.25.0 milestone Dec 24, 2019
@morozov morozov self-assigned this Dec 24, 2019
@morozov morozov merged commit d0093fa into phpbrew:master Dec 25, 2019
@morozov morozov deleted the php74-mbstring branch December 25, 2019 03:34
Copy link
Copy Markdown
Contributor

@markwu markwu left a comment

Choose a reason for hiding this comment

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

I just fire a PR #1132 to fix this typo.

$this->variants['mbstring'] = function (ConfigureParameters $params, Build $build, $value) {
$params = $params->withOption('--enable-mbstring');

if ($build->compareVersion('5.4') >= 0 && !$build->isDisabledVariant('mbregex')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@morozov Is this for php-5.4 or php-7.4? It looks weird.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It will cause following problems when building php-5.6.40. If I change the statement to $build->compareVersion('7.4') fixed the problem.

make '-j8' >> '/Users/mark/.phpbrew/build/php-5.6.40/build.log' 2>&1
Error: Make failed:
The last 5 lines in the log file:
3 errors generated.

make: *** [ext/mbstring/php_mbregex.lo] Error 1

make: *** Waiting for unfinished jobs....

2 warnings generated.

1 warning generated.

Please checkout the build log file for more details:
	 tail /Users/mark/.phpbrew/build/php-5.6.40/build.log

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could you find why exactly it failed, maybe a few lines above in the log? It works fine for me:

./configure '--cache-file=/home/morozov/.phpbrew/cache/config.cache' '--prefix=/home/morozov/.phpbrew/php/php-5.6.40' '--with-config-file-path=/home/morozov/.phpbrew/php/php-5.6.40/etc' '--with-config-file-scan-dir=/home/morozov/.phpbrew/php/php-5.6.40/var/db' '--with-libdir=lib/x86_64-linux-gnu' '--with-bz2=/usr' '--with-curl=/usr' '--enable-fpm' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-freetype-dir=/usr' '--with-iconv' '--enable-mbstring' '--with-onig=/usr' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-openssl=/usr' '--with-sqlite3' '--enable-soap' '--with-zlib=/usr' '--enable-dom' '--enable-libxml' '--with-libxml-dir=/usr' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--enable-opcache' >> '/home/morozov/.phpbrew/build/php-5.6.40/build.log' 2>&1
===> Checking patches...
Checking patch for php5.3.29 multi-sapi
Checking patch for php5.3.x on 64bit machine when intl is enabled.
Checking patch for openssl dso linking patch
Checking patch for php5.6 with openssl 1.1.x patch.
---> Applying patch...
patching file ext/openssl/openssl.c
patching file ext/openssl/xp_ssl.c
patching file ext/phar/util.c
patching file ext/openssl/openssl.c
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 651 with fuzz 1.

Done.
1 changes patched.
===> Building...
make >> '/home/morozov/.phpbrew/build/php-5.6.40/build.log' 2>&1
Build finished: 4.7 minutes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here comes my phpbrew command and log

command

phpbrew --debug install --jobs "$(nproc)" 5.6.40 +default +dbs +dba +apxs2 +ftp +soap +gettext +exif +iconv +bz2 +zli

log
https://gist.github.com/markwu/520647ce338f3d8a0543a731e20c8152

Copy link
Copy Markdown
Contributor Author

@morozov morozov Dec 26, 2019

Choose a reason for hiding this comment

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

I only tried to build PHP 7.4 against Homebrew dependencies, and it worked for me as well. Judging by the log output, there might be an older version of oniguruma required for PHP 5.6.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If it turns out that this is because of the incompatible version, we can either find a way to enforce the version of the library used to build PHP 5.6 or reopen #1132 and use the external library only if it's required (PHP 7.4).

Copy link
Copy Markdown
Contributor

@markwu markwu Dec 26, 2019

Choose a reason for hiding this comment

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

Okay, I think I found the problem.

PHP-5.6.40 and PHP-7.3.13 ships it's own oniguruma, but PHP-7.4.1 doesn't. It located under

~/.phpbrew/build/php-5.6.40/ext/mbstring/oniguruma
~/.phpbrew/build/php-7.3.13/ext/mbstring/oniguruma

I guess PHP-7.(0|1|2) ships with it's ownoniguruma, too.

But, PHP-5.6.40 can only build --enable-mbregex with it's shipped oniguruma, and php-7.3.13 can build --enable-mbregex with both shipped and external oniguruma

So, as you said, maybe we should reopen #1132 to force build previous PHP version (Before PHP-7.4.0) with it's own shipped oniguruma.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's why homebrew's php formula has additional oniguruma dependency after PHP-7.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants