RealPath:
WebPath:
2017/02/12 02:24 (JST) 更新
MinGW-w64 on MSYS2 >>

MSYS2/MinGW-w64導入

Contents

概要

MSYS2 を用いると割と簡単に 32bit と 64bit の開発環境を併設できる。

MSYS のパッケージ管理が mingw-get であるのに対して MSYS2 のパッケージ管理は pacman を用いる。
この pacman によるパッケージ管理は mingw-get に比べるとなかなか快適で良い。

旧 MSYS 環境について

旧 MSYS 環境が残っていると (主にPATH解決周りが) MSYS2 と混ざってしまって厄介なので、旧 MSYS 環境は削除またはリネームしておくのが安全。

基本的に MSYS2 がうまく導入されていれば、旧 MSYS 環境をわざわざ触る機会は無くなると思う。

MSYS2 導入

インストーラを起動してインストール先を選ぶ。
デフォルトで C:\msys64 になっているはずなので、特に支障なければそのまま進める。

MSYS2 起動

スタートメニューから MSYS2 64bit - MSYS2 MSYS を起動

必要モジュール導入

MSYS2 MSYS
$ pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime

プロンプト確認では全て y を選択する。

この時点で bash が更新されるので MSYS2 MSYS を一度終了し起動しなおす。

モジュール更新その1

MSYS2 MSYS
$ pacman -Syu
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
 msys is up to date
:: Starting core system upgrade...
warning: terminate other MSYS2 programs before proceeding
resolving dependencies...
looking for conflicting packages...

Packages (2) filesystem-2017.02-2  mintty-1~2.7.3-1

Total Download Size:   0.21 MiB
Total Installed Size:  0.45 MiB
Net Upgrade Size:      0.05 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 filesystem-2017.02-...    39.0 KiB  6.36M/s 00:00 [#####################] 100%
 mintty-1~2.7.3-1-x86_64  174.9 KiB   394K/s 00:00 [#####################] 100%
(2/2) checking keys in keyring                     [#####################] 100%
(2/2) checking package integrity                   [#####################] 100%
(2/2) loading package files                        [#####################] 100%
(2/2) checking for file conflicts                  [#####################] 100%
(2/2) checking available disk space                [#####################] 100%
warning: could not get file information for opt/
:: Processing package changes...
(1/2) upgrading filesystem                         [#####################] 100%

      WARNING: the shell starting scripts have been unified. Please update your
      shortcuts to the following targets, otherwise they will STOP WORKING:

          * MSYS2_ROOT\msys2_shell.cmd -mingw32
          * MSYS2_ROOT\msys2_shell.cmd -mingw64
          * MSYS2_ROOT\msys2_shell.cmd -msys

(2/2) upgrading mintty                             [#####################] 100%
warning: terminate MSYS2 without returning to shell and check for updates again
warning: for example close your terminal window instead of calling exit

この時点で mintty が更新されるので MSYS2 MSYS を一度終了し起動しなおす。

モジュール更新その2

$ pacman -Syu
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
 msys is up to date
:: Starting core system upgrade...
 there is nothing to do
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (25) bsdcpio-3.2.2-2  bsdtar-3.2.2-2  curl-7.52.1-1  file-5.29-1
              flex-2.6.3-1  gcc-libs-6.3.0-1  gmp-6.1.2-1  gnupg-1.4.21-1
              grep-2.27-1  libarchive-3.2.2-2  libcurl-7.52.1-1
              libexpat-2.2.0-2  libgpg-error-1.25-1  liblzma-5.2.3-1
              libpcre-8.40-1  libpcre16-8.40-1  libpcre32-8.40-1
              libpcrecpp-8.40-1  libpcreposix-8.40-1  m4-1.4.18-1
              mpfr-3.1.5.1-3  ncurses-6.0.20170121-1  pcre-8.40-1  xz-5.2.3-1
              zlib-1.2.11-1

Total Download Size:    9.00 MiB
Total Installed Size:  42.21 MiB
Net Upgrade Size:       0.51 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 gcc-libs-6.3.0-1-x86_64  819.1 KiB   762K/s 00:01 [#####################] 100%
 liblzma-5.2.3-1-x86_64    78.3 KiB  15.3M/s 00:00 [#####################] 100%
 zlib-1.2.11-1-x86_64      55.1 KiB  26.9M/s 00:00 [#####################] 100%
 gmp-6.1.2-1-x86_64       371.3 KiB  2.18M/s 00:00 [#####################] 100%
 ncurses-6.0.2017012...  1141.8 KiB  1413K/s 00:01 [#####################] 100%
 bsdcpio-3.2.2-2-x86_64   728.3 KiB  1533K/s 00:00 [#####################] 100%
 bsdtar-3.2.2-2-x86_64    765.4 KiB  1625K/s 00:00 [#####################] 100%
 libpcre-8.40-1-x86_64     93.7 KiB  30.5M/s 00:00 [#####################] 100%
 libexpat-2.2.0-2-x86_64   59.3 KiB  29.0M/s 00:00 [#####################] 100%
 libcurl-7.52.1-1-x86_64  198.2 KiB  19.4M/s 00:00 [#####################] 100%
 curl-7.52.1-1-x86_64     641.9 KiB  1377K/s 00:00 [#####################] 100%
 file-5.29-1-x86_64       453.6 KiB  1440K/s 00:00 [#####################] 100%
 m4-1.4.18-1-x86_64       213.6 KiB  1378K/s 00:00 [#####################] 100%
 flex-2.6.3-1-x86_64      294.0 KiB  1815K/s 00:00 [#####################] 100%
 gnupg-1.4.21-1-x86_64   1030.1 KiB  1622K/s 00:01 [#####################] 100%
 grep-2.27-1-x86_64       239.5 KiB  1555K/s 00:00 [#####################] 100%
 libarchive-3.2.2-2-...   724.2 KiB  1538K/s 00:00 [#####################] 100%
 libgpg-error-1.25-1...   110.4 KiB  21.6M/s 00:00 [#####################] 100%
 libpcre16-8.40-1-x86_64   92.3 KiB  22.5M/s 00:00 [#####################] 100%
 libpcre32-8.40-1-x86_64   86.6 KiB  21.1M/s 00:00 [#####################] 100%
 libpcrecpp-8.40-1-x...    22.4 KiB  0.00B/s 00:00 [#####################] 100%
 libpcreposix-8.40-1...    15.8 KiB  15.5M/s 00:00 [#####################] 100%
 mpfr-3.1.5.1-3-x86_64    242.0 KiB  1582K/s 00:00 [#####################] 100%
 pcre-8.40-1-x86_64       588.8 KiB  1858K/s 00:00 [#####################] 100%
 xz-5.2.3-1-x86_64        145.4 KiB  20.3M/s 00:00 [#####################] 100%
(25/25) checking keys in keyring                   [#####################] 100%
(25/25) checking package integrity                 [#####################] 100%
(25/25) loading package files                      [#####################] 100%
(25/25) checking for file conflicts                [#####################] 100%
(25/25) checking available disk space              [#####################] 100%
:: Processing package changes...
( 1/25) upgrading gcc-libs                         [#####################] 100%
( 2/25) upgrading liblzma                          [#####################] 100%
( 3/25) upgrading zlib                             [#####################] 100%
( 4/25) upgrading gmp                              [#####################] 100%
( 5/25) upgrading ncurses                          [#####################] 100%
( 6/25) upgrading bsdcpio                          [#####################] 100%
( 7/25) upgrading bsdtar                           [#####################] 100%
( 8/25) upgrading libpcre                          [#####################] 100%
( 9/25) upgrading libexpat                         [#####################] 100%
(10/25) upgrading libcurl                          [#####################] 100%
(11/25) upgrading curl                             [#####################] 100%
(12/25) upgrading file                             [#####################] 100%
(13/25) upgrading m4                               [#####################] 100%
(14/25) upgrading flex                             [#####################] 100%
(15/25) upgrading gnupg                            [#####################] 100%
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: Generating pacman keyring master key...
gpg: skipping control `%no-protection' ()
..+++++
.+++++
gpg: key 2C51FE5A marked as ultimately trusted
gpg: Done
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Appending keys from msys2.gpg...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Locally signing trusted keys in keyring...
  -> Locally signing key D55E7A6D7CE9BA1587C0ACACF40D263ECA25678A...
  -> Locally signing key 123D4D51A1793859C2BE916BBBE514E53E0D0813...
  -> Locally signing key B91BCF3303284BF90CC043CA9F418C233E652008...
  -> Locally signing key 9DD0D4217D75A33B896159E6DA7EF2ABAEEA755C...
==> Importing owner trust values...
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   4  signed:   3  trust: 0-, 0q, 0n, 4m, 0f, 0u
gpg: depth: 2  valid:   3  signed:   0  trust: 3-, 0q, 0n, 0m, 0f, 0u
(16/25) upgrading grep                             [#####################] 100%
(17/25) upgrading libarchive                       [#####################] 100%
(18/25) upgrading libgpg-error                     [#####################] 100%
(19/25) upgrading libpcre16                        [#####################] 100%
(20/25) upgrading libpcre32                        [#####################] 100%
(21/25) upgrading libpcrecpp                       [#####################] 100%
(22/25) upgrading libpcreposix                     [#####################] 100%
(23/25) upgrading mpfr                             [#####################] 100%
(24/25) upgrading pcre                             [#####################] 100%
(25/25) upgrading xz                               [#####################] 100%

参考