1. 安装MSYS2
2. 更新源
修改msys64\etc\pacman.d 目录下有三个文件的内容:mirrorlist.mingw32 、mirrorlist.mingw64 、mirrorlist.msys为中国科学技术大学开源软件镜像
- mirrorlist.mingw32
##
## 32-bit Mingw-w64 repository mirrorlist
##
## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
Server = http://repo.msys2.org/mingw/i686
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686
Server = http://www2.futureware.at/~nickoe/msys2-mirror/i686/
- mirrorlist.mingw64
##
## 64-bit Mingw-w64 repository mirrorlist
##
## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/
Server = http://repo.msys2.org/mingw/x86_64
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86_64
Server = http://www2.futureware.at/~nickoe/msys2-mirror/x86_64/
- mirrorlist.msys
##
## MSYS2 repository mirrorlist
##
## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch/
Server = http://repo.msys2.org/msys/$arch
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/$arch
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/$arch/
注意镜像Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/必须放在第一行,否则依旧从repo.msys2.org中获取
1. 更新pacman:
pacman --noconfirm --needed -Sy bash pacman pacman-mirrors
2. 重新运行后,输入pacman -Su,回车,等待同步完成,输入y,回车
3. 遇到mingw-xxxxxxxx-any.pkg.tar.zst包下载失败,通过google搜索响应的包在https://packages.msys2.org/package进行下载,或者通过https://packages.msys2.org/package搜索进行下载。
下载完成后手动安装
pacman -U mingw-xxxxxxxx-any.pkg.tar.zst
3. 安装完整版mingw-w64-i686
pacman -S mingw-w64-i686-toolchain
4. 安装完整版mingw-w64
pacman -S mingw-w64-x86_64-toolchain
5. 在配置环境变量的时候两个根目录的位置
6. 安装github.com/gotk3/gotk3
1. 设置环境变量 PKG_CONFIG_PATH
2. go get github.com/gotk3/gotk3