From a79299055363244e619b0cf03b16ece985a65fed Mon Sep 17 00:00:00 2001 From: rango Date: Thu, 7 May 2026 18:43:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20=E4=BF=AE=E5=A4=8DWindows?= =?UTF-8?q?=E4=B8=8B=E7=BC=96=E8=AF=91=E5=99=A8=E9=80=89=E6=8B=A9=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改Windows下编译器优先级顺序为:PHPX_CC环境变量 > cl (MSVC, 默认) > clang - 移除Clang作为默认首选编译器的逻辑 - 添加MSVC作为默认编译器的稳定性说明 - 更新相关注释以反映新的编译器选择策略 --- src/Php/CompilerBase.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index c9270506..fd295117 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -308,19 +308,15 @@ class CompilerBase extends \PhpAot\Core\Translator if ($this->isWindows) { // Windows 下检测使用哪个编译器 - // 优先级:环境变量 PHPX_CC > clang > cl (MSVC) + // 优先级:环境变量 PHPX_CC > cl (MSVC, 默认) > clang $compilerEnv = getenv('PHPX_CC'); if ($compilerEnv) { // 用户通过环境变量指定编译器 $this->cppCompiler = $compilerEnv; $this->climate->info("Using compiler from PHPX_CC: {$this->cppCompiler}"); - } elseif ($this->isClangAvailable()) { - // 优先使用 Clang(如果可用) - $this->cppCompiler = 'clang++'; - $this->climate->info('Using Clang compiler (clang++)'); } else { - // 默认使用 MSVC + // 默认使用 MSVC(更稳定,与链接器兼容) $this->cppCompiler = 'cl'; $this->climate->info('Using MSVC compiler (cl)'); }