Skip to content

Conversation

@henderkes
Copy link
Collaborator

@henderkes henderkes commented May 15, 2025

What does this PR do?

fix building of shared libphp.so with icu and a few other extensions

closes #738
closes #735
closes #725
closes #720
closes #749
closes #744
enables #724

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php, run composer cs-fix at local machine.

@henderkes
Copy link
Collaborator Author

henderkes commented May 15, 2025

Success:

Installing PHP SAPI module:       embed
[08:28:41] [I] Patching phpize prefix
[08:28:41] [I] Replacing file with type[1]: /home/m/static-php-cli/buildroot/bin/phpize
[08:28:41] [I] Replacing file with type[1]: /home/m/static-php-cli/buildroot/bin/phpize
[08:28:41] [I] Patching php-config prefix and libs order
[08:28:41] [I] running cli sanity check
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "echo \"hello\";"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/unix/UnixBuilderBase.php:143
[08:28:41] [I] testing ext: apcu
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "apcu"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] testing ext: bcmath
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "bcmath"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('bcscale'));"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:41] [I] testing ext: calendar
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "calendar"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('cal_info'));assert(is_array(cal_info(0)));"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:41] [I] testing ext: ctype
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "ctype"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] testing ext: curl
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "curl"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('curl_init'));assert(function_exists('curl_setopt'));assert(function_exists('curl_exec'));assert(function_exists('curl_close'));\$curl_version = curl_version();if (stripos(\$curl_version['ssl_version'], 'schannel') "'!'"== false) {    \$curl = curl_init();    curl_setopt(\$curl, CURLOPT_URL, 'https://example.com/');    curl_setopt(\$curl, CURLOPT_RETURNTRANSFER, 1);    curl_setopt(\$curl, CURLOPT_HEADER, 0);    \$data = curl_exec(\$curl);    curl_close(\$curl);    assert(\$data "'!'"== false);}"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:41] [I] testing ext: dba
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "dba"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] testing ext: dom
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "dom"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(class_exists('\DOMDocument'));\$doc = new DOMDocument();\$doc->loadHtml('<html><head><meta charset=\"UTF-8\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body id=\"app\">Hello</body></html>');assert(\$doc->getElementById('app')->nodeValue === 'Hello');"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:41] [I] testing ext: exif
[08:28:41] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "exif"
[08:28:41] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: fileinfo
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "fileinfo"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: filter
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "filter"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('filter_var'));"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: zlib
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "zlib"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('gzcompress'));assert(gzdecode(gzencode('aaa')) === 'aaa');"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: gd
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "gd"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('gd_info'));\$info = gd_info();assert(\$info['PNG Support'] ?? false);assert(\$info['GIF Create Support'] ?? false);assert(\$info['GIF Read Support'] ?? false);"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: gettext
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "gettext"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('gettext'));assert(function_exists('bindtextdomain'));assert(function_exists('textdomain'));if ("'!'"is_dir('locale/en_US/LC_MESSAGES/')) {    mkdir('locale/en_US/LC_MESSAGES/', 0755, true);}if ("'!'"file_exists('locale/en_US/LC_MESSAGES/test.mo')) {    \$mo = '3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABgAAAFEAAAAXAQAAWAAAAAcAAABwAQAAAQAAAAAAAAAAAAAAAgAAAAAAAAAA56S65L6LAFByb2plY3QtSWQtVmVyc2lvbjogUEFDS0FHRSBWRVJTSU9OClJlcG9ydC1Nc2dpZC1CdWdzLVRvOiAKUE8tUmV2aXNpb24tRGF0ZTogWUVBUi1NTy1EQSBITzpNSStaT05FCkxhc3QtVHJhbnNsYXRvcjogRlVMTCBOQU1FIDxFTUFJTEBBRERSRVNTPgpMYW5ndWFnZS1UZWFtOiBMQU5HVUFHRSA8TExAbGkub3JnPgpMYW5ndWFnZTogCk1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA4Yml0CgBFeGFtcGxlAA==';    file_put_contents('locale/en_US/LC_MESSAGES/test.mo', base64_decode(\$mo));}putenv('LANG=en_US');assert(setlocale(LC_ALL, 'en_US.utf-8') === 'en_US.utf-8');\$domain = 'test';bindtextdomain(\$domain, 'locale/');textdomain(\$domain);assert(gettext(json_decode('\"\u793a\u4f8b\"', true)) === 'Example');"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: iconv
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "iconv"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('iconv'));assert(iconv('UTF-8', 'CP437', 'foo') === 'foo');"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: session
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "session"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: igbinary
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "igbinary"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: imagick
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "imagick"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(class_exists('Imagick'));assert(Imagick::queryFormats('AVIF') "'!'"== []);assert(Imagick::queryFormats('HEIF') "'!'"== []);assert(Imagick::queryFormats('HEIC') "'!'"== []);assert(Imagick::queryFormats('WEBP') "'!'"== []);assert(Imagick::queryFormats('JPEG') "'!'"== []);assert(Imagick::queryFormats('PNG') "'!'"== []);assert(Imagick::queryFormats('TIFF') "'!'"== []);"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: intl
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "intl"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(class_exists(NumberFormatter::class));assert(function_exists('locale_get_default'));\$fmt = new NumberFormatter('de-DE', NumberFormatter::DECIMAL);assert(strval(\$fmt->parse('1.100')) === '1100');"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:42] [I] testing ext: xml
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "xml"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: libxml
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "libxml"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: mbstring
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "mbstring"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: mbregex
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "mbstring" | grep regex
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/extension/mbregex.php:29
[08:28:42] [I] testing ext: mysqlnd
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "mysqlnd"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: mysqli
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "mysqli"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: opcache
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "Zend Opcache"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] testing ext: openssl
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "openssl"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:42] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(function_exists('openssl_digest'));assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e');if (file_exists('/etc/ssl/openssl.cnf')) {    assert(file_get_contents('https://example.com/') "'!'"== false);}"
[08:28:42] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:43] [I] testing ext: pcntl
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "pcntl"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: pdo
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "pdo"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: pdo_mysql
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "pdo_mysql"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: sqlite3
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "sqlite3"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: pdo_sqlite
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "pdo_sqlite"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: phar
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "phar"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: posix
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "posix"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: readline
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "readline"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: redis
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "redis"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(class_exists('\Redis'));"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:43] [I] testing ext: simplexml
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "simplexml"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: sockets
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "sockets"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: sodium
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "sodium"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: ssh2
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "ssh2"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: tokenizer
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "tokenizer"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:43] [I] testing ext: zip
[08:28:43] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "zip"
[08:28:43] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n -r "assert(class_exists('\ZipArchive'));"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:227
[08:28:44] [I] testing ext: xlswriter
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "xlswriter"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] testing ext: xmlreader
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "xmlreader"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] testing ext: xmlwriter
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "xmlwriter"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] testing ext: xsl
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "xsl"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] testing ext: zstd
[08:28:44] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "zstd"
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:214
[08:28:44] [I] running embed sanity check
[08:28:44] [I] Entering dir: /home/m/static-php-cli/source/embed-test
[08:28:44] [I] [EXEC] gcc -o embed embed.c -fPIC -I/home/m/static-php-cli/buildroot/include -I/home/m/static-php-cli/buildroot/include/php -I/home/m/static-php-cli/buildroot/include/php/main -I/home/m/static-php-cli/buildroot/include/php/TSRM -I/home/m/static-php-cli/buildroot/include/php/Zend -I/home/m/static-php-cli/buildroot/include/php/ext -L/home/m/static-php-cli/buildroot/lib -lphp -lc -lxslt -lexslt -lsodium -lreadline -lsqlite3 -lonig -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lzip -lheif -laom -lde265 -ltiff -lintl -lncurses -lfreetype -lbz2 -ljpeg -lturbojpeg -lwebp -lwebpdecoder -lwebpdemux -lwebpmux -lsharpyuv -lpng16 -lcurl -lzstd -lxml2 -licui18n -licuio -licuuc -licudata -liconv -lcharset -lbrotlidec -lbrotlienc -lbrotlicommon -lssh2 -lssl -lcrypto -lz -ldl -lpthread -lm -lresolv -lutil -lrt -lstdc++
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/unix/UnixBuilderBase.php:191
[08:28:44] [I] Entering dir: /home/m/static-php-cli/source/embed-test
[08:28:44] [I] [EXEC] LD_LIBRARY_PATH=/home/m/static-php-cli/buildroot/lib:$LD_LIBRARY_PATH ./embed
[08:28:44] [I] Executed at: /home/m/static-php-cli/src/SPC/builder/unix/UnixBuilderBase.php:203
[08:28:44] [I]
[08:28:44] [I]    Build complete, used 176.334 s !
[08:28:44] [I]
[08:28:44] [I] Static php binary path: /home/m/static-php-cli/buildroot/bin/php

@henderkes
Copy link
Collaborator Author

closes #725

@crazywhalecc
Copy link
Owner

Ehhh....finally back, finished hard exam and day job.

It seems that there have been a lot of changes recently. I will review it soon. If there are any unfinished parts, you could put them in the draft.

@henderkes
Copy link
Collaborator Author

Welcome back! It's a part of preparing the project to build "all" shared extensions and libphp.so for deb/rpm packages. Most extensions build without any changes, but some take different arguments when building them shared.

I will wrap this up later today. There's still an unsolved problem where it seems that some shared extensions need other shared extensions to be built first, if they're both enabled. I.e. we cannot build event before sockets if they are both enabled. And there's a dependency on some shared extensions on others too, don cannot be built if xml wasn't also built before.

@henderkes
Copy link
Collaborator Author

I will leave this as it is for now. There are still some extensions similar to mysqlnd or libxml that cannot be built as a shared library as they don't even have a config.m4 file. There are also some extensions that currently fail building shared, like ldap. Dom and xmlreader/xmlwriter require xml to be built first, so we'll need a new "shared-ext-depends" key in the json and maybe some way to configure the build order even if two extensions are both selected, such as event and sockets. For sockets and a few others it also seems like they don't install the headers into buildroot/include/php/ext folder.

Too many things to do than is appropriate for this PR.

For now, all the extensions I've tested can be built statically into libphp.so.

@henderkes
Copy link
Collaborator Author

it's insane how many libraries ignore -fPIC in some places. postgresql too and it doesn't even understand --with-pic

@henderkes
Copy link
Collaborator Author

maybe we need to put -fpic -fPIC into CXXFLAGS too

@crazywhalecc
Copy link
Owner

crazywhalecc commented Jun 11, 2025

I may found why mongodb and dom will cause embed test failed.....

  1. MacOSBuilder re-archives the libphp.a, which extracts all *.o and archive again. (Linux doesn't need it)
  2. During step 1, dom's document.o conflicts with mongodb's BSON/Document.o, and the result is missing symbol.
  3. macOS is a case-insensitive operating system.

I remember that this re-archive process was to solve the problem that macOS could not directly use libphp.a in #153

But what surprised me even more is it took me so long to encounter the first error caused by duplicate object names. If there was a conflict, why didn't an error occur when there were so many files with the same name?

@henderkes
Copy link
Collaborator Author

we should use

ar -t | xargs ... ar -#. I use it in ngtcp2 because it puts dependent .a files in the ngtcp2.a, which macos linker does not understand.

@henderkes
Copy link
Collaborator Author

@henderkes
Copy link
Collaborator Author

I'll spin up my fake macos docker image and test various extension combinations just in case. Linux is stable on centos 7, rhel 9, rhel 10 and ubuntu/musl. Alpine will work again with 8.3.23, the php-src issue was merged.

@henderkes
Copy link
Collaborator Author

glfw is failing to build, but everything else works.

@crazywhalecc
Copy link
Owner

Solved. The source dir getter for lib was using wrong dirname.

@henderkes
Copy link
Collaborator Author

I'm currently adding fastlz because memcached + yac both build it unless --with-system-fastlz is specified. The ld64 linker doesn't support -Wl,--allow-multiple-definition, so we'd either have to install lld or build fastlz beforehand.

@crazywhalecc
Copy link
Owner

Oh, btw we could use commit messages to trigger build tests. This would avoid redundant builds and ensure that the content of each test is controllable. WDYT?

@henderkes
Copy link
Collaborator Author

depends if we're running out of resources. if resource usage is fine, it's fine to keep testing every commit

@henderkes
Copy link
Collaborator Author

[03:45:35] [D] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:275
[03:45:35] [D] testing ext: memcached
[03:45:35] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "memcached"
[03:45:35] [D] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:262
[03:45:35] [D] testing ext: igbinary
[03:45:35] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "igbinary"
[03:45:35] [D] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:262
[03:45:35] [D] testing ext: yac
[03:45:35] [I] [EXEC] /home/m/static-php-cli/buildroot/bin/php -n --ri "yac"
[03:45:35] [D] Executed at: /home/m/static-php-cli/src/SPC/builder/Extension.php:262

@henderkes
Copy link
Collaborator Author

you should update the spc mirror of libmemcached, I updated away from the 11 year old library to the maintained fork

Copy link
Collaborator Author

@henderkes henderkes left a comment

Choose a reason for hiding this comment

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

Can't approve my own PR, but I've built all extensions (including memcached) in various rotations and they all build fine now on both macos 15 (x86_64) and linux.

@henderkes henderkes requested a review from crazywhalecc June 12, 2025 04:02
@henderkes
Copy link
Collaborator Author

🥳

@henderkes henderkes merged commit 289f4b3 into main Jun 12, 2025
10 checks passed
@crazywhalecc crazywhalecc deleted the fix/icurel branch June 12, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mixed PR This PR contains multiple updates

Projects

None yet

2 participants