mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
sanity check after toolset init
This commit is contained in:
@@ -5,8 +5,10 @@ declare(strict_types=1);
|
||||
namespace SPC\toolchain;
|
||||
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\util\GlobalEnvManager;
|
||||
use SPC\util\SPCTarget;
|
||||
|
||||
class ToolchainManager
|
||||
{
|
||||
@@ -47,7 +49,13 @@ class ToolchainManager
|
||||
public static function afterInitToolchain(): void
|
||||
{
|
||||
if (!getenv('SPC_TOOLCHAIN')) {
|
||||
throw new WrongUsageException('SPC_TOOLCHAIN not set');
|
||||
throw new WrongUsageException('SPC_TOOLCHAIN was not properly set. Please contact the developers.');
|
||||
}
|
||||
if (SPCTarget::getLibc() === 'musl' && !SPCTarget::isStatic() && !file_exists('/lib/ld-musl-x86_64.so.1')) {
|
||||
throw new RuntimeException('You are linking against musl libc dynamically, but musl libc is not installed. Please install it with `sudo dnf install musl-libc` or `sudo apt install musl`');
|
||||
}
|
||||
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
|
||||
throw new RuntimeException('You are linking against glibc libc dynamically, which is only supported on glibc distros.');
|
||||
}
|
||||
$toolchain = getenv('SPC_TOOLCHAIN');
|
||||
/* @var ToolchainInterface $toolchain */
|
||||
|
||||
Reference in New Issue
Block a user