Skip to content

Latest commit

 

History

History
73 lines (57 loc) · 2.18 KB

LinuxOnWin.md

File metadata and controls

73 lines (57 loc) · 2.18 KB

Windows 搭建 Linux 开发环境

MSYS2(Minimal SYStem 2)

安装修改 MSYS2

  • 把安装⽬录下的msys2_shell.cmd中注释掉的rem set MSYS2_PATH_TYPE=inherit改成启用,这是为了将vs的环境继承给MSYS2
  • 编辑/etc/pacman.d/mirrorlist.mingw32,在⽂件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/
Server = http:https://mirrors.ustc.edu.cn/msys2/mingw/i686/
  • 编辑/etc/pacman.d/mirrorlist.mingw64,在⽂件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64/
Server = http:https://mirrors.ustc.edu.cn/msys2/mingw/x86_64/
  • 编辑/etc/pacman.d/mirrorlist.msys,在⽂件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch/
Server = http:https://mirrors.ustc.edu.cn/msys2/msys/$arch/
  • 重命名/usr/bin/link.exe/usr/bin/link.exe.bak

使用 VS 命令行运行 msys2

#32位
msys2_shell.cmd -mingw32
#64位
msys2_shell.cmd -mingw64
# msys2中执行
pacman -Sy
#32位
pacman -S mingw-w64-i686-toolchain
pacman -S mingw-w64-i686-nasm mingw-w64-i686-gcc mingw-w64-i686-SDL2
#64位
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
#通用
pacman -S git
pacman -S make
pacman -S automake
pacman -S autoconf
pacman -S perl
pacman -S libtool
pacman -S pkg-config

TDM-GCC

安装配置 TDM-GCC-64

  • 安装(解压)msysTDM-GCC的安装目录中
  • call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"加到msys.bat的第一行中
  • 复制yasm-1.3.0-win64.exe(重命名为yasm.exe)到msysbin目录下
  • 重命名msysbin目录下的link.exelinkold.exe

运行 msys.bat 进入环境