aachyeeのブログ

備忘録的メモ。主にIT(プログラミング、電子工作)、DIY、アウトドアネタ。詳細はaboutを。

RubyInstallerでMSYS2 and MINGW development toolchainをインストルール中にエラーが起きる

rubyinstaller 2.4.1-1-x64 をインストールするときに"Run 'ridk install' to install MSYS2 and development toolchan."をチェックし、コンソールで"3 - MSYS2 and MINGW development toolchain"を選んだときに、"error: target not found: mingw-w64-x86_64-winstorecompat-git" というエラーが出てインストールできない。
OSはWindows 10 Home 64bitです。

1 - MSYS2 base installation
2 - MSYS2 repository update
3 - MSYS2 and MINGW development toolchain
Which components shall be installed? 3

MSYS2 seems to be already installed
Install MSYS2 and MINGW development toolchain ...
> pacman -S --needed --noconfirm autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 diffutils file gawk grep libtool m4 make patch pkg-config sed texinfo texinfo-tex wget mingw-w64-x86_64-binutils mingw-w64-x86_64-crt-git mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-headers-git mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-tools-git mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-winstorecompat-git
warning: autoconf-2.69-3 is up to date -- skipping
中略
warning: mingw-w64-x86_64-winpthreads-git-5.0.0.4634.697f757-1 is up to date -- skipping
error: target not found: mingw-w64-x86_64-winstorecompat-git
Install MSYS2 and MINGW development toolchain failed
Installation failed: pacman failed

原因は、すでにシステムにMSYS2がインストールされているが、バージョンが古いためのようである。

回復の仕方

方法は2つ。

  1. インストールされているMSYS2のシェルを起動してパッケージのアップデート行う。
  2. 既存のMSYS2を消しても良いならアンインストール後、最新のMSYS2をインストールしてアップデートを行う。

なお、実行しているRubyInstaller(コンソールの方)はそのままでもよい。

MSYS2のアップデート方法

キャッシュを全て削除してパッケージを更新する。

$ pacman -Scc #全てy
$ pacman -Syy
$ pacman -Suu

ファイルのダウンロード中に何度も切断され失敗するような場合は、wget をインストールして、/etc/pacman.conf の[options]に下記の1行を追加して再試行する。

XferCommand = /usr/bin/wget --timeout=30 --tries=100 --passive-ftp -c -O %o %u

MSYS2 and MINGW development toolchainのインストール

MSYS2のパッケージを更新後、MSYS2 and MINGW development toolchainのインストールを再度試みる。

1 - MSYS2 base installation
2 - MSYS2 repository update
3 - MSYS2 and MINGW development toolchain
Which components shall be installed? 3

MSYS2 seems to be already installed
Install MSYS2 and MINGW development toolchain ...
> pacman -S --needed --noconfirm autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 diffutils file gawk grep libtool m4 make patch pkg-config sed texinfo texinfo-tex wget mingw-w64-x86_64-binutils mingw-w64-x86_64-crt-git mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-headers-git mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-tools-git mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-winstorecompat-git
warning: autoconf-2.69-3 is up to date -- skipping
中略
warning: libtool-2.4.6-2 is up to date -- skipping
resolving dependencies...
looking for conflicting packages...

Packages (32) glib2-2.48.2-1 libgc-7.6.0-1 libgcrypt-1.6.4-1
libguile-2.0.14-1 libunistring-0.9.7-1 libxslt-1.1.29-1
autoconf2.13-2.13-2 autogen-5.18.12-1 diffutils-3.5-1
file-5.30-1 gawk-4.1.4-2 grep-3.0-1 m4-1.4.18-1 make-4.2.1-1
mingw-w64-x86_64-binutils-2.28-1
mingw-w64-x86_64-crt-git-5.0.0.4834.33ee6cab-1
mingw-w64-x86_64-gcc-6.3.0-3 mingw-w64-x86_64-gcc-libs-6.3.0-3
mingw-w64-x86_64-headers-git-5.0.0.4836.670da35c-1
mingw-w64-x86_64-libmangle-git-5.0.0.4760.d3089b5-1
mingw-w64-x86_64-libwinpthread-git-5.0.0.4833.f057c525-1
mingw-w64-x86_64-make-4.2.1-1
mingw-w64-x86_64-pkg-config-0.29.2-1
mingw-w64-x86_64-tools-git-5.0.0.4760.d3089b5-1
mingw-w64-x86_64-winpthreads-git-5.0.0.4833.f057c525-1
mingw-w64-x86_64-winstorecompat-git-5.0.0.4760.d3089b5-1
patch-2.7.5-1 pkg-config-0.29.2-1 sed-4.4-2 texinfo-6.3-1
texinfo-tex-6.3-1 wget-1.19.1-1

Total Download Size: 59.66 MiB
Total Installed Size: 402.53 MiB
Net Upgrade Size: 58.96 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...

MSYS2にすでにインストールされているパッケージによるだろうが、400MB以上ディスクを使用します。

追記

こんな面倒なことしなくても1,2,3とすればいいだけのようでした。

Windows環境でRailsを動かしてみた - 或るプログラマの開発日記

インストール時に"Use UTF-8 as default external encoding."にチェックを入れておいたほうが良いこともわかりました。もし付け忘れたときは、環境変数に"RUBYOPT=-Eutf-8"を追加しましょう。

あと、toochainのインストーラは、"/Ruby24-x64/lib/ruby/site_ruby/2.4.0/ruby_installer/runtime/ridk.rb" にありました。