Skip to content

Commit d023c25

Browse files
committed
fix: patch config.m4 directly to remove OMP check for static builds
The ac_cv_func_omp_pause_resource_all=no approach does not work for gmagick because its config.m4 uses PHP_CHECK_FUNC which does not honour ac_cv cache variables. Revert to patching config.m4 directly to remove the entire OpenMP check block, preventing the linker error on ubuntu-24.04 (undefined reference to omp_pause_resource_all).
1 parent f7b69d9 commit d023c25

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/SPC/builder/extension/gmagick.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ class gmagick extends Extension
1313
{
1414
public function patchBeforeBuildconf(): bool
1515
{
16+
// PHP 8.5 removed zend_exception_get_default(), use zend_ce_exception instead
1617
FileSystem::replaceFileStr($this->source_dir . '/gmagick.c', 'zend_exception_get_default()', 'zend_ce_exception');
18+
19+
// Remove the entire OpenMP check block from config.m4 to avoid linking
20+
// against libgomp in static builds. gmagick's config.m4 uses PHP_CHECK_FUNC
21+
// which does not honour ac_cv cache variables, so we must patch the source.
22+
FileSystem::replaceFileRegex(
23+
SOURCE_PATH . '/php-src/ext/gmagick/config.m4',
24+
'/AC_MSG_CHECKING\(omp_pause_resource_all usability\).*?AC_MSG_RESULT\(no\)\n\t\t\]\)/s',
25+
'dnl OMP check removed for static build'
26+
);
1727
return true;
1828
}
1929

2030
public function getUnixConfigureArg(bool $shared = false): string
2131
{
22-
$disable_omp = ' ac_cv_func_omp_pause_resource_all=no';
23-
return '--with-gmagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp;
32+
return '--with-gmagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
2433
}
2534
}

0 commit comments

Comments
 (0)