diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 0e3b6ab6..79afdf16 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -205,17 +205,19 @@ abstract class UnixBuilderBase extends BuilderBase if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') { $lens .= ' -static'; } - [$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens); - if ($ret !== 0) { - throw new RuntimeException('embed failed sanity check: build failed. Error message: ' . implode("\n", $out)); - } // if someone changed to EMBED_TYPE=shared, we need to add LD_LIBRARY_PATH if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'shared') { $ext_path = 'LD_LIBRARY_PATH=' . BUILD_ROOT_PATH . '/lib:$LD_LIBRARY_PATH '; FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.a'); } else { $ext_path = ''; - FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.so'); + foreach (glob(BUILD_LIB_PATH . '/libphp*.so') as $file) { + unlink($file); + } + } + [$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens); + if ($ret !== 0) { + throw new RuntimeException('embed failed sanity check: build failed. Error message: ' . implode("\n", $out)); } [$ret, $output] = shell()->cd($sample_file_path)->execWithResult($ext_path . './embed'); if ($ret !== 0 || trim(implode('', $output)) !== 'hello') {