msys2 安裝注意事項


它一直在使用 msys。有一個最近發現 msys2。而且msys2 配套的編譯器是MinGW-w64

 就試着用了用,感覺還不錯,這里把安裝過程記錄一下。

簡單的說,MSYS2 MSYS的一個升級版提供了bash shell, Autotools, 版本號控制軟件和MinGW-w64 工具鏈。與MSYS最大的差別是移植了 Arch Linux的軟件包管理系統 Pacman。有了 Pacman 升級系統,安裝新軟件包,還有解決軟件包間的依賴問題就變得簡單多了。

能夠在這里查看MSYS2包含了哪些軟件包:

https://github.com/Alexpux/MSYS2-packages

安裝

msys2 的主頁地址:

http://sourceforge.net/projects/msys2/

 

首先下載安裝文件,我的系統是32位的,所下面載32位的安裝包:

msys2-i686-20140910.exe

 

msys2 要求安裝文件夾僅僅能有 ascii 字符而且不能有空格。我選擇安裝在:

C:/msys32

這樣安裝完后僅僅有最主要的系統,沒有gcc開發環境。

執行例如以下命令能夠打開一個bash shell

msys2_shell.bat

剩下的工作都在這個bash shell下進行。

msys2 移植了Arch Linux 上的軟件包管理系統 Pacman。有了包管理系統,升級、安裝新的軟件就非常easy了。 只是我一直在用redhat 系的linux沒有接觸過 Pacman。學習新命令還是花了些時間。這里把一些常見的Pacman命令記錄一下。

更新本地軟件包

更新本地軟件包數據庫:

pacman -S --refresh

能夠縮寫為:pacman -Sy

然后升級軟件包:

pacman -S --refresh --sysupgrade 

能夠縮寫為:pacman -Syu

 

這里須要特別注意,不能寫為:

pacman -Su

給出的理由例如以下,我水平太低。沒全然理解是啥意思:

because all MSYS2 programs share the same address space for DLLs due to how MSYS2 (well, Cygwin) implements 'fork', and because any Pacman package (both MSYS2 and MinGW-w64 ones) may use MSYS2's bash to run a post-install script, issuing this command can cause these scripts to fail to run should any updated, core MSYS2 DLLs end up in a different location to where they were. For this reason, the safest procedure for updating MSYS2 is to do it in two stages;

首先更新MSYS2核心程序包:

pacman -S --needed filesystem msys2-runtime bash libreadline libiconv libarchive libgpgme libcurl pacman ncurses libintl

 

假設這一步更新了一些軟件包,那么就須要關閉 msys2 然后再又一次執行例如以下兩個批處理文件:

autorebase.bat

msys2_shell.bat

否則更新其它軟件包是會報錯。(看來MSYS2 還是有點弱,希望以后可以把這個問題改好了)

之后就能夠用:

pacman -Su

更新系統的其它軟件包了。

列出全部安裝了的軟件

pacman -Q --explicit

或者

pacman -Q -e

安裝新的軟件包

pacman -S <package_names|package_groups>

比方我要安裝 gcc。那么運行:

pacman -S gcc 

然后依照提示安裝就能夠了。

搜索軟件包

非常多時候,我們不知道要依照的軟件的准確名稱,這時就要先查詢軟件包的名稱。

pacman -Ss <name_pattern>

 

比方我想安裝gcc相關的軟件,那么能夠這樣搜索

pacman -Ss gcc

 

pacman -Q --groups

能夠列出全部的軟件組,在我這里運行的結果例如以下:

base bash

base bash-completion

base bsdcpio

base bsdtar

base bzip2

base catgets

base coreutils

base crypt

base curl

base dash

base file

base filesystem

base findutils

base flex

base gawk

base gcc-libs

base getopt

base grep

base gzip

base less

base lndir

base man-db

base mintty

base msys2-runtime

base ncurses

base pacman

base pacman-mirrors

base pkgfile

base rebase

base sed

base texinfo

base tzcode

base which

msys2-devel binutils

msys2-devel gcc

msys2-devel msys2-w32api-headers

msys2-devel msys2-w32api-runtime

compression bzip2

compression gzip

compression liblzo2

compression xz

libraries cloog

libraries gmp

libraries heimdal-libs

libraries icu

libraries isl

libraries libarchive

libraries libasprintf

libraries libbz2

libraries libcares

libraries libcatgets

libraries libcrypt

libraries libcurl

libraries libdb

libraries libexpat

libraries libffi

libraries libgdbm

libraries libgettextpo

libraries libgpg-error

libraries libgpgme

libraries libiconv

libraries libidn

libraries libintl

libraries liblzma

libraries liblzo2

libraries libmetalink

libraries libnettle

libraries libopenssl

libraries libp11-kit

libraries libpcre

libraries libpipeline

libraries libreadline

libraries libsqlite

libraries libssh2

libraries libtasn1

libraries libxml2

libraries mpc

libraries mpfr

libraries zlib

Database db

Database gdbm

base-devel file

base-devel flex

base-devel gawk

base-devel gettext

base-devel grep

base-devel groff

base-devel m4

base-devel pacman

base-devel perl

base-devel pkgfile

base-devel sed

base-devel texinfo

MSYS2-devel msys2-runtime-devel

 

刪除一個軟件包

pacman -R <package_names|package_groups>


版權聲明:本文博客原創文章。博客,未經同意,不得轉載。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM