本节所需的程序包如未特别注明,都是从http://sourceforge.net/downloads/mingw/下载,本节下文称之为“下载站点”。
(1) 建立程序目录:在c盘建立msys目录,并在msys目录下建立mingw子目录;
(2) 安装MinGW:访问下载站点,
- 浏览MinGW->BaseSystem->GNU-Binutils->binutils-2.20.51,下载binutils-2.20.51-1-mingw32-bin.tar.lzma;
- 浏览MinGW->BaseSystem->RuntimeLibrary->MinGW-RT->mingwrt- 3.18,下载mingwrt-3.18-mingw32-dev.tar.gz和mingwrt-3.18-mingw32-dll.tar.gz;(如果在编译程序的时候,出现undefined reference to __dyn_tls_init_callback 链接错误时,可以换一个版本低一些的)
- 浏览MinGW->BaseSystem->RuntimeLibrary->Win32-API w32api-3.14,下载w32api-3.14-mingw32-dev.tar.gz;
- 浏览MinGW->BaseSystem->GCC Version4->gcc-4.5.0-1, 下载gcc-c++-4.5.0-1-mingw32-bin.tar.lzma、gcc-core-4.5.0-1-mingw32- bin.tar.lzma、libgcc-4.5.0-1-mingw32-dll-1.tar.lzma和libstdc++-4.5.0-1- mingw32-dll-6.tar.lzma;
- 浏览MinGW->mpfr->mpfr-2.4.1-1,下载libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma;
- 浏览MinGW->gmp->gmp-5.0.1-1,下载libgmp-5.0.1-1-mingw32-dll-10.tar.lzma;
- 浏览MinGW->mpc->mpc-0.8.1-1,下载libmpc-0.8.1-1-mingw32-dll-2.tar.lzma;
- 浏览MinGW->pthread-w32->pthread-w32-2.8.0-3,下载pthreads-w32-2.8.0-3-mingw32-dev.tar.lzma;
- 将以上所下载的压缩包解压缩到c:\msys\mingw目录下;
(3) 安装MSYS,访问下载站点,
- 浏览MSYS->BaseSystem->msys-1.0.14-1,下载msysCORE-1.0.14-1-msys-1.0.14-bin.tar.lzma;
- 浏览MSYS->coreutils->coreutils-5.97-3,下载coreutils-5.97-3-msys-1.0.13-bin.tar.lzma和coreutils-5.97-3-msys-1.0.13-ext.tar.lzma;
- 浏览MSYS->automake-1.11.1-1,下载automake-1.11.1-1-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->autoconf->autoconf-2.65-1,下载autoconf-2.65-1-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->libtool->libtool-2.2.7a-2,下载libtool-2.2.7a-2-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->crypt->crypt-1.1_1-3,下载crypt-1.1_1-3-msys-1.0.13-bin.tar.lzma和libcrypt-1.1_1-3-msys-1.0.13-dll-0.tar.lzma;
- 浏览MSYS->perl->perl-5.6.1_2-2,下载perl-5.6.1_2-2-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->gettext->gettext-0.17-2,下载gettext-0.17-2-msys-1.0.13-bin.tar.lzma、 gettext-0.17-2-msys-1.0.13-ext.tar.lzma、gettext-0.17-2-msys-1.0.13- dev.tar.lzma和libintl-0.17-2-msys-dll-8.tar.lzma;
- 浏览MSYS->bash->bash-3.1.17-3,下载bash-3.1.17-3-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->regex->regex-1.20090805-2,下载libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma;
- 浏览MSYSàtermcapàtermcapà0.20050421_1-2,下载libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma;
- 浏览MSYS->sed->sed-4.2.1-2,下载sed-4.2.1-2-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->libicon->libiconv-1.13.1-2,下载libiconv-1.13.1-2-msys-1.0.13-dll-2.tar.lzma;
- 浏览MSYS->make->make-3.81-3,下载make-3.81-3-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->gawk->gawk-3.1.7-2,下载gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->grep->grep-2.5.4-2,下载grep-2.5.4-2-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->diffutils->diffutils-2.8.7.20071206cvs-3,下载diffutils-2.8.7.20071206cvs-3-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->openssl->openssl-1.0.0-1,下载libopenssl-1.0.0-1-msys-1.0.13-dev.tar.lzma;
- 浏览MSYS->tar->tar-1.23-1,下载tar-1.23-1-msys-1.0.13-bin.tar.lzma;
- 浏览MSYS->m4->m4-1.4.14-1,下m4-1.4.14-1-msys-1.0.13-bin.tar.lzma;
- 将以上所下载的程序包解压到c:\msys目录下;
- 创建fstab文件:在c:\msys\etc目录下创建文件fstab,并增加如下内容,
c:/msys/mingw /mingw
测试基本环境:运行c:\msys\msys.bat,进入命令行界面执行gcc –version,确认基本环境已安装好;
源贴
http://www.cnblogs.com/joiner/archive/2010/06/18/1759941.html