运行 clang64.exe 或 mingw64.exe 错误地设置 PATH

问题描述 投票:0回答:1

我的 Windows 计算机上安装了 MSYS2。安装包中包含mingw64.exe、clang64.exe等文件。根据这个页面,运行相应的可执行文件时,我们期望使用合适的环境。

但是,就我而言,存在以下奇怪之处:

  1. 运行

    mingw64.exe
    -> $
    echo $PATH
    出来的是
    /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

  2. 运行

    clang64.exe
    -> $
    echo $PATH
    出来的是
    /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

  3. 运行

    clangarm64.exe
    -> $
    echo $PATH
    出来的是
    /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
变量:

  1. 运行
    mingw64.exe
    ->
    echo $MSYSTEM
    -> MINGW64
  2. 运行
    clang64.exe
    ->
    echo $MSYSTEM
    -> CLANG64

结果正确

path msys2
1个回答
0
投票

当您运行

/clang64/bin
时,路径上有
mingw64.exe
是不正常的。必须有一个启动脚本在某处添加它。

运行以下命令以在启动脚本中查找任何提及

clang64
的内容:

grep clang64 /etc/profile /etc/profile.d/* ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc

如果这不能说明任何问题,您可能需要更仔细地查看这些脚本以了解它们在做什么。您还可以尝试手动运行它们(例如使用

source .bashrc
)以查看它们是否将
/clang64/bin
添加到您的 PATH。

© www.soinside.com 2019 - 2024. All rights reserved.