虚無庵

徒然なるままに

今日の php build 2024-01-10

興味本位で PHP のソースビルドをやってみた。

前置き

ruby のソースビルドは ruby/ruby の master ブランチのみでしている。ビルドする ruby は以下の 4 パターンである

  • 何も有効にしないノーマルな ruby
  • Universal Parser を有効にした ruby
  • YJIT を有効にした ruby
  • RJIT を有効にした ruby

ruby のコントリビュート方法はこちらを参考にしてもらいたい。ひとまず master ブランチに対してパッチを投げれば良いという認識でいる。

一方で PHPコントリビュート方法を参照すると ruby とは大分様子が異なる。以下のように解釈した。

PHPサポートバージョンを確認すると、アクティブサポートしているバージョンは 8.2 と 8.3 の 2 バージョンのみ。なので、master/PHP-8.3/PHP-8.2 ブランチをビルドしてみる。ビルド方法は公式を参照。ビルド環境は以下の通り。

  • OS: Linux - Linux jinroq-lenovo 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64
  • Autoconf: autoconf (GNU Autoconf) 2.71
  • Bundled Libtool: ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
  • Compiler: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
  • Bison: bison (GNU Bison) 3.8.2

今日のビルド(master)

16c1c49f1b9153fab8fb15935ffce1c764a398ae までを pull ってきてビルド。エラー/警告ともになし。

今日のテスト(master)

make TEST_PHP_ARGS=-j4 test を実行。

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    46 (bz2, oci8, soap, pgsql, mbstring, curl, odbc, com_dotnet, enchant, sysvsem, sysvshm, pdo_dblib, mysqli, ffi, exif, shmop, calendar, intl, zlib, pdo_pgsql, gmp, sodium, snmp, dl_test, imap, pdo_firebird, bcmath, readline, gd, sockets, pdo_mysql, zend_test, pdo_oci, ldap, zip, pcntl, xsl, mysqlnd, sysvmsg, dba, skeleton, tidy, openssl, ftp, gettext, pdo_odbc)
Exts tested     :    26
---------------------------------------------------------------------

Number of tests : 18950             13151
Tests skipped   :  5799 ( 30.6%) --------
Tests warned    :     0 (  0.0%) (  0.0%)
Tests failed    :     1 (  0.0%) (  0.0%)
Expected fail   :     9 (  0.0%) (  0.1%)
Tests passed    : 13141 ( 69.3%) ( 99.9%)
---------------------------------------------------------------------
Time taken      : 87.346 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #60591 (Memory leak when access a non-exists file) [sapi/cli/tests/php_cli_server_016.phpt]
=====================================================================

今日のビルド(PHP-8.3)

04954f6b2ca880dd0eb95bfc48111a36e9aadaec までを pull ってきてビルド。エラー/警告ともになし。

今日のテスト(PHP-8.3)

make TEST_PHP_ARGS=-j4 test を実行。

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    47 (bz2, oci8, soap, pspell, pgsql, mbstring, curl, odbc, com_dotnet, enchant, sysvsem, sysvshm, pdo_dblib, mysqli, ffi, exif, shmop, calendar, intl, zlib, pdo_pgsql, gmp, sodium, snmp, dl_test, imap, pdo_firebird, bcmath, readline, gd, sockets, pdo_mysql, zend_test, pdo_oci, ldap, zip, pcntl, xsl, mysqlnd, sysvmsg, dba, skeleton, tidy, openssl, ftp, gettext, pdo_odbc)
Exts tested     :    26
---------------------------------------------------------------------

Number of tests : 18729             12974
Tests skipped   :  5755 ( 30.7%) --------
Tests warned    :     0 (  0.0%) (  0.0%)
Tests failed    :     0 (  0.0%) (  0.0%)
Expected fail   :     9 (  0.0%) (  0.1%)
Tests passed    : 12965 ( 69.2%) ( 99.9%)
---------------------------------------------------------------------
Time taken      :    99 seconds
=====================================================================

今日のビルド(PHP-8.2)

d57a7767a2e9778646c6fd5f1c96860a191751d3 までを pull ってきてビルド。

In file included from /home/jinroq/dev/php/php-src/ext/opcache/jit/zend_jit.c:714:
ext/opcache/jit/zend_jit_trace.c: In function ‘zend_jit_trace_allocate_exit_point’:
/home/jinroq/dev/php/php-src/ext/opcache/jit/dynasm/dasm_x86.h:127:19: warning: array subscript -10 is outside array bounds of ‘void *[38]’ [-Warray-bounds]
  127 |   D->globals = gl - 10;  /* Negative bias to compensate for locals. */
      |                ~~~^~~~
In file included from /home/jinroq/dev/php/php-src/ext/opcache/jit/zend_jit.c:772:
/home/jinroq/dev/php/php-src/ext/opcache/jit/zend_jit_x86.dasc:143:14: note: while referencing ‘dasm_labels’
  143 | static void* dasm_labels[zend_lb_MAX];
      |              ^~~~~~~~~~~

今日のテスト(PHP-8.2)

make TEST_PHP_ARGS=-j4 test を実行。

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   47
Exts tested     :   27
---------------------------------------------------------------------

Number of tests : 18199             12568
Tests skipped   : 5631 ( 30.9%) --------
Tests warned    :    1 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    9 (  0.0%) (  0.1%)
Tests passed    : 12558 ( 69.0%) ( 99.9%)
---------------------------------------------------------------------
Time taken      :  104 seconds
=====================================================================
=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
Phar: bug #69958: Segfault in Phar::convertToData on invalid file [ext/phar/tests/bug69958.phpt] (warn: XFAIL section but test passes)
=====================================================================

まとめ

開発版は言わずもがな、Stable 版でもビルド時に警告が出ていたりするのでコントリビュートチャンスはありそう。