From 40ac705c465856c60dc7fd5ab49f60efa183d21d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 25 Jun 2025 11:21:58 +0700 Subject: [PATCH] remove openmp support entirely, system packages distribute it disabled, the ini disables it by default and the authors recommend disabling it. WIth a distinction between libgomp, libomp and the non-existent usable static libraries for them, it's just not worth it. --- docs/en/guide/extension-notes.md | 8 ++++---- docs/zh/guide/extension-notes.md | 6 +++--- src/SPC/builder/extension/imagick.php | 19 ++----------------- src/SPC/builder/unix/library/imagemagick.php | 3 +-- src/SPC/util/SPCConfigUtil.php | 4 ---- 5 files changed, 10 insertions(+), 30 deletions(-) diff --git a/docs/en/guide/extension-notes.md b/docs/en/guide/extension-notes.md index aa11c377..91ea531e 100644 --- a/docs/en/guide/extension-notes.md +++ b/docs/en/guide/extension-notes.md @@ -48,17 +48,17 @@ This extension contains an implementation of the coroutine environment for `pdo_ ## swow -1. Only PHP 8.0 ~ 8.4 is supported. +1. Only PHP 8.0+ is supported. ## imagick -1. The imagick extension currently only has openmp support on musl libc. This means that multithreading is disabled on glibc or other operating systems. The extension is still fully functional. +1. Openmp support is disabled, this is recommended by the maintainers and also the case system packages. ## imap 1. Kerberos is not supported -2. ext-imap is not thread safe due to the underlying c-client. It's not possible to use it in --enable-zts builds. -3. Because the extension may be dropped from php, we recommend you look for an alternative implementation, such as [Webklex/php-imap](https://github.com/Webklex/php-imap) +2. ext-imap is not thread safe due to the underlying c-client. It's not possible to use it in `--enable-zts` builds. +3. The extension was dropped from php 8.4, we recommend you look for an alternative implementation, such as [Webklex/php-imap](https://github.com/Webklex/php-imap) ## gd diff --git a/docs/zh/guide/extension-notes.md b/docs/zh/guide/extension-notes.md index 10e62eb0..dd153817 100644 --- a/docs/zh/guide/extension-notes.md +++ b/docs/zh/guide/extension-notes.md @@ -45,17 +45,17 @@ swoole-hook-sqlite 与 `pdo_sqlite` 扩展冲突。如需使用 Swoole 和 `pdo_ ## swow -1. swow 仅支持 PHP 8.0 ~ 8.4 版本。 +1. swow 仅支持 PHP 8.0+ 版本。 ## imagick -imagick 扩展目前仅在 musl libc 上支持 OpenMP(libgomp)。使用 glibc 方式构建的 imagick 扩展无法支持多线程特性。 +1. OpenMP 支持已被禁用,这是维护者推荐的做法,系统软件包也是如此配置。 ## imap 1. 该扩展目前不支持 Kerberos。 2. 由于底层的 c-client、ext-imap 不是线程安全的。 无法在 `--enable-zts` 构建中使用它。 -3. 由于该扩展可能会从未来的 PHP 中删除,因此我们建议您寻找替代实现,例如 [Webklex/php-imap](https://github.com/Webklex/php-imap)。 +3. 该扩展已在 PHP 8.4 中被移除,因此我们建议您寻找替代实现,例如 [Webklex/php-imap](https://github.com/Webklex/php-imap)。 ## gd diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index 16a8fa64..8623b8f3 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -10,31 +10,16 @@ use SPC\util\CustomExt; #[CustomExt('imagick')] class imagick extends Extension { - public function patchBeforeMake(): bool - { - if (PHP_OS_FAMILY !== 'Linux') { - return false; - } - if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { - return false; - } - // imagick with calls omp_pause_all, which requires openmp, on non-musl we build imagick without openmp - $extra_libs = trim(getenv('SPC_EXTRA_LIBS') . ' -lomp'); - f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); - return true; - } - public function getUnixConfigureArg(bool $shared = false): string { - $disable_omp = !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) ? '' : ' ac_cv_func_omp_pause_resource_all=no'; - return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp; + return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ac_cv_func_omp_pause_resource_all=no'; } protected function getStaticAndSharedLibs(): array { // on centos 7, it will use the symbol _ZTINSt6thread6_StateE, which is not defined in system libstdc++.so.6 [$static, $shared] = parent::getStaticAndSharedLibs(); - if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { + if (str_contains(getenv('CC'), 'devtoolset-10')) { $static .= ' -lstdc++'; $shared = str_replace('-lstdc++', '', $shared); } diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index ead786a2..8f4a7dad 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -32,8 +32,7 @@ trait imagemagick ->optionalLib('freetype', ...ac_with_args('freetype')) ->optionalLib('bzip2', ...ac_with_args('bzlib')) ->addConfigureArgs( - // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so - getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--disable-openmp' : '--enable-openmp', + '--disable-openmp', '--without-jxl', '--without-x', ); diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 5b7a0d5a..c5177bc6 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -149,10 +149,6 @@ class SPCConfigUtil } } } - // patch: imagick (imagemagick wrapper) for linux needs libgomp - if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux' && !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10'))) { - $short_name[] = '-lomp'; - } return implode(' ', $short_name); }