Use fixed location of libgomp.a

This commit is contained in:
crazywhalecc
2025-03-29 18:25:38 +08:00
parent bce513d189
commit ddff725222
2 changed files with 14 additions and 2 deletions

View File

@@ -21,7 +21,13 @@ class imagick extends Extension
$extra_libs = trim($extra_libs . ' -lgomp');
}
if (getenv('SPC_LIBC') === 'glibc') {
$extra_libs = trim($extra_libs . ' -l:libgomp.a -l:libgomp_nonshared.a');
$ld = f_exec('/usr/bin/gcc --print-file-name=libgomp.a', $output, $result_code);
if ($result_code !== 0) {
logger()->error('Cannot find libgomp.a, please install libgomp-dev');
$extra_libs = trim($extra_libs . ' -l:libgomp.a');
} else {
$extra_libs = trim($extra_libs . ' ' . $ld);
}
}
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
return true;

View File

@@ -93,7 +93,13 @@ class SPCConfigUtil
// patch: imagick (imagemagick wrapper) for linux needs -lgomp
if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux') {
if (getenv('SPC_LIBC') === 'glibc') {
$short_name[] = '-l:libgomp.a -l:libgomp_nonshared.a';
$ld = f_exec('/usr/bin/gcc --print-file-name=libgomp.a', $output, $result_code);
if ($result_code !== 0) {
// logger()->error('Cannot find libgomp.a, please install libgomp-dev');
$short_name[] = '-l:libgomp.a';
} else {
$short_name[] = $ld;
}
} else {
$short_name[] = '-lgomp';
}