Fix linux imagick openmp linking issue (#424)

This commit is contained in:
Jerry Ma 2024-04-26 11:00:33 +08:00 committed by GitHub
parent b14894fab7
commit aaa4510f25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -14,11 +14,11 @@ class imagick extends Extension
public function patchBeforeMake(): bool public function patchBeforeMake(): bool
{ {
// imagick may call omp_pause_all which requires -lgomp // imagick may call omp_pause_all which requires -lgomp
$extra_libs = $this->builder->getOption('extra-libs', ''); $extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
if ($this->builder instanceof LinuxBuilder) { if ($this->builder instanceof LinuxBuilder) {
$extra_libs .= ' -lgomp '; $extra_libs .= (empty($extra_libs) ? '' : ' ') . '-lgomp ';
} }
$this->builder->setOption('extra-libs', $extra_libs); f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
return true; return true;
} }

View File

@ -19,7 +19,7 @@ trait imagemagick
protected function build(): void protected function build(): void
{ {
// TODO: imagemagick build with bzip2 failed with bugs, we need to fix it in the future // TODO: imagemagick build with bzip2 failed with bugs, we need to fix it in the future
$extra = '--without-jxl --without-x --disable-openmp --without-bzlib '; $extra = '--without-jxl --without-x --enable-openmp --without-bzlib ';
$required_libs = ''; $required_libs = '';
$optional_libs = [ $optional_libs = [
'libzip' => 'zip', 'libzip' => 'zip',

View File

@ -13,8 +13,8 @@ declare(strict_types=1);
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) { $extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'intl,posix', 'Linux', 'Darwin' => 'imagick',
'Windows' => 'mbstring,pdo_sqlite,mbregex,curl', 'Windows' => 'mbstring,pdo_sqlite,mbregex',
}; };
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).