swoole has date time conversion error in c++ code, clang needs -lunwind

This commit is contained in:
DubbleClick
2025-06-24 20:43:38 +07:00
parent 2433752273
commit e1028b0348
3 changed files with 12 additions and 3 deletions

View File

@@ -80,6 +80,7 @@ class LinuxBuilder extends UnixBuilderBase
}
// add libstdc++, some extensions or libraries need it
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : '');
$extra_libs .= (SystemUtil::getCCType(getenv('CC')) === 'clang' ? ' -lunwind' : '');
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
$cflags = $this->arch_c_flags;
f_putenv('CFLAGS=' . $cflags);
@@ -337,12 +338,16 @@ class LinuxBuilder extends UnixBuilderBase
private function getMakeExtraVars(): array
{
return [
$env = [
'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
'EXTRA_LIBS' => getenv('SPC_EXTRA_LIBS') . ' ' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS'),
'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
'EXTRA_LDFLAGS_PROGRAM' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM'),
];
if (str_contains(getenv('CC'), 'zig')) {
$env['LDFLAGS'] = getenv('LDFLAGS') . ' -L/usr/lib64';
}
return $env;
}
/**