我的 Windows 计算机上安装了 MSYS2。安装包中包含mingw64.exe、clang64.exe等文件。根据这个页面,当运行相应的可执行文件时,我们期望使用合适的环境。
然而,就我而言,存在以下奇怪之处:
运行
mingw64.exe
-> $echo $PATH
out 是/clang64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
运行
clang64.exe
-> $echo $PATH
out 是/clang64/bin:/clang64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
运行
clangarm64.exe
-> $echo $PATH
out 是/clang64/bin:/clangarm64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
因此,将以某种方式使用clang编译器,这是完全不期望的
更新
根据ChatGPT的建议,我测试了该$MSYSTEM
变量:
- 运行
mingw64.exe
->echo $MSYSTEM
-> MINGW64 - 运行
clang64.exe
->echo $MSYSTEM
-> CLANG64
结果是正确的
/clang64/bin
当您运行时,在您的 PATH 中是不正常的mingw64.exe
。一定有一个启动脚本正在添加它。运行以下命令以查找
clang64
启动脚本中的任何提及:如果这不能说明任何问题,您可能需要更仔细地查看这些脚本以了解它们在做什么。您还可以尝试
echo $PATH
在这些脚本的不同位置放置命令来调试它们。