chenexe
V2EX  ›  C++

如何用 Windows 下载 gcc 指定版本

  •  
  •   chenexe · Dec 14, 2021 · 3048 views
    This topic created in 1809 days ago, the information mentioned may be changed or developed.

    背景

    go 项目,项目运行需要 gcc 版本为 10.3

    走过的路

    1. 已经用 msys2 、mingw-w64-install 、mingw-get-setup 尝试下载指定版本的 gcc ,都失败了。
    2. 也尝试过在http://repo.msys2.org/mingw/x86_64/上下载离线包,然后使用 7-Zip-zstd 解压,导致报错:
    F:\work\go1.16\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
    collect2.exe: fatal error: cannot find 'ld'
    compilation terminated.
    

    这个报错应该是直接解压.zst 文件,导致没有 x86_64-w64-mingw32 文件夹,所以找不到 ld.exe 然后报的错。

    需求:

    想问下应该怎么下载并正确安装指定 gcc 版本呢

    4 replies  •  2021-12-16 08:03:53 +08:00
    newmlp
    newmlp
    Dec 14, 2021
    1
    go 项目要 gcc 干嘛
    h404bi
    h404bi
    Dec 14, 2021❤️4
    2
    到 https://winlibs.com/ 上面下载吧,里面有 10.3 的包。Zip 包解压加到 PATH 里就能用了。
    chenexe
    chenexe
    OP
    Dec 14, 2021
    3
    @h404bi 感谢,你帮助到了我
    rophie123
    rophie123
    Dec 16, 2021 via iPhone
    4
    @newmlp cgo
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1908 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:39 · PVG 23:39 · LAX 07:39 · JFK 10:39
    ♥ Do have faith in what you're doing.