-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEGV on static build php >= 8.3 with gettext #17735
Comments
can t reproduce with bare php however having experienced with static-php-cli in the past, I ll have a look at this soon-ish. |
Can reproduce with 8.3.16 indeed (static cli version only). Looking. |
Spent a bit of time, it only segfault from 8.3.0 indeed, 8.2.27 is fine. I had few questions.
What was the setting for the last time it did worked ? e.g. PHP version/static-cli-php version itself? was the musl toolchain the same ? |
Thank you for your long time. I just compared the code carefully two months ago. The problem may be in the gettext build command. # 2 month ago
$extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : '';
$extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : '';
shell()->cd($this->source_dir)
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
->execWithEnv(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
'--disable-java ' .
'--disable-c+ ' .
$extra .
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
'--prefix=' . BUILD_ROOT_PATH
)
->execWithEnv('make clean')
->execWithEnv("make -j{$this->builder->concurrency}")
->execWithEnv('make install'); # now
$extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : '';
$extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : '';
shell()->cd($this->source_dir)
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
->execWithEnv(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
'--disable-java ' .
'--disable-c+ ' .
$extra .
'--with-included-gettext ' .
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
'--prefix=' . BUILD_ROOT_PATH
)
->execWithEnv('make clean')
->execWithEnv("make -j{$this->builder->concurrency}")
->execWithEnv('make install'); The only thing that seems to have changed in the past two months is So the conclusion should be that the built-in GNU gettext is now included, which causes the segmentation fault. In other words, either there is a problem with gettext itself, or I am missing some necessary compilation parameters or patches. I'll dig a little deeper locally, and let me know if there are any details I've overlooked. |
I finally figured it out. In short, libintl/gettext was not built in multithreaded mode correctly. I ended up compiling the gettext library with I didn't look up how to build it for official or common Linux distributions though, I can only confirm that this method works for static-php-cli. |
Good to know ! |
Description
The following code:
Resulted in this output:
But I expected this output instead:
Additional Information
The PHP build is from source and gettext is statically linked. This bug did not exist 2 months ago and only affected PHP 8.3 and 8.4.
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
)static-php-cli build command:
# static-php-cli has extension check, at this time it fails when checking for gettext and got segfault. bin/spc build --build-cli gettext --no-strip
Build detail log:
This is static-php-cli build log that shows which build command used. If more details need, I'd like to show.
GDB debug log:
php.tgz
I'm not sure if it's a problem with PHP or gettext itself, I'll be happy to follow up with static-php-cli if any clues are available.
PHP Version
PHP 8.4.3
Operating System
Debian 12 x86_64
The text was updated successfully, but these errors were encountered: