首页 > 解决方案 > 将 MSYS2 降级到特定的 Mingw / gcc 版本

问题描述

我的系统中安装了 MSYS2 64 位。当我尝试检查 gcc 版本时,我得到以下输出。

$ gcc --version
gcc.exe (Rev9, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

但我想为使用 qt 库的项目使用特定的 mingw 版本。当我检查我的 qt 项目的构建日志和安装文件夹时,我发现了这个。

|Project name: DataManager
|Project version: undefined
|C++ compiler for the host machine: ccache c++ (gcc 4.9.2 "c++ (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 4.9.2")
|C++ linker for the host machine: c++ ld.bfd 2.24
|Program python3 found: YES
|Found qmake: C:\Qt\5.6.3\mingw49_32\bin\qmake.EXE (5.6.3)

我假设它使用 mingw49_32 版本和 gcc 版本 4.9.2。我想在 MSYS2 中使用相同的 gcc 版本(4.9.2)。

我怎样才能实现它?

标签: mingw-w64msys2

解决方案


你不能用 MSYS2 做到这一点。旧包最终会从 MSYS2 存储库中删除,所以即使它在过去的某个时候有 GCC 4.9,它也不再有。最早可用的版本是 GCC 9.3。

即使它在 repo 中,您也必须手动下载并安装它及其所有依赖项,因为无法直接从pacman.


但是,我怀疑:

  • 您已经在C:\Qt\5.6.3\mingw49_32\bin.
  • 即使您不这样做,您也可以使用最新的 GCC。

推荐阅读