###前提・実現したいこと
windows7にruby-filemagicをインストールしようとしています。
###発生している問題・エラーメッセージ
ruby-filemagicをbundle installしたところ次のようなエラーが出ました。
ERROR: Could not find a valid gem 'file' (>= 0) in any repository ERROR: Possible alternatives: fife, fige, fileq, filer, files ERROR: Could not find a valid gem 'file-devel' (>= 0) in any repository ERROR: Possible alternatives: file_model, file_server, file_tee, filedesc C:\Users\terashin\rails_projects\musicpost>bundle install Fetching gem metadata from https://rubygems.org/ Fetching version metadata from https://rubygems.org/ Fetching dependency metadata from https://rubygems.org/ Could not find gem 'file x64-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. C:\Users\terashin\rails_projects\musicpost>bundle install Fetching gem metadata from https://rubygems.org/ Fetching version metadata from https://rubygems.org/ Fetching dependency metadata from https://rubygems.org/ Resolving dependencies... Using rake 11.2.2 Using i18n 0.7.0 Using json 1.8.3 Using minitest 5.9.0 Using thread_safe 0.3.5 Using builder 3.2.2 Using erubis 2.7.0 Using mini_portile2 2.1.0 Using pkg-config 1.1.7 Using rack 1.6.4 Using mime-types-data 3.2016.0521 Using arel 6.0.3 Using debug_inspector 0.0.2 Using bundler 1.12.5 Using byebug 9.0.5 Using mimemagic 0.3.2 Installing ruby-filemagic 0.7.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: C:/Users/terashin/rails_projects/musicpost/vendor/bundle/ ruby/2.3.0/gems/ruby-filemagic-0.7.1/ext/filemagic C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20160904-8876-ysduuz.rb extconf.rb checking for main() in -lgnurx... no checking for magic_open() in -lmagic... no *** ERROR: missing required library to compile this module *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby23-x64/bin/$(RUBY_BASE_NAME) --with-magic-dir --without-magic-dir --with-magic-include --without-magic-include=${magic-dir}/include --with-magic-lib --without-magic-lib=${magic-dir}/lib --with-gnurx-dir --without-gnurx-dir --with-gnurx-include --without-gnurx-include=${gnurx-dir}/include --with-gnurx-lib --without-gnurx-lib=${gnurx-dir}/lib --with-gnurxlib --without-gnurxlib --with-magiclib --without-magiclib To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Users/terashin/rails_projects/musicpost/vendor/bundle/ruby/2.3.0/extensions /x64-mingw32/2.3.0/ruby-filemagic-0.7.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Users/terashin/rails_projects/musicpost/ve ndor/bundle/ruby/2.3.0/gems/ruby-filemagic-0.7.1 for inspection. Results logged to C:/Users/terashin/rails_projects/musicpost/vendor/bundle/ruby/ 2.3.0/extensions/x64-mingw32/2.3.0/ruby-filemagic-0.7.1/gem_make.out Using coffee-script-source 1.8.0 Using execjs 2.7.0 Using thor 0.19.1 Using concurrent-ruby 1.0.2 Using multi_json 1.12.1 Using rmagick 2.16.0 Using sass 3.4.22 Using tilt 2.0.5 Using sqlite3 1.3.11 Using turbolinks-source 5.0.0 Using rdoc 4.2.2 Using tzinfo 1.2.2 Using nokogiri 1.6.8 Using rack-test 0.6.3 Using mime-types 3.1 Using binding_of_caller 0.7.2 An error occurred while installing ruby-filemagic (0.7.1), and Bundler cannot continue. Make sure that `gem install ruby-filemagic -v '0.7.1'` succeeds before bundling.
調べたところfailというライブラリがないことが原因みたいでした。
そこで、以下のやり方に従ってfileのインストールを試みました。
For Ruby 1.9.3
Download file-5.21.tar.gz from ftp://ftp.astron.com/pub/file/ and extract to a directory.
Download libgnurx 2.5.1 bin + dev from sourceforge and extract both to another directory.
Run the DevKit msys shell
c:\path\to\devkit-4.5.2\msys.bat -mintty
Build file from the directory you extracted it to.
cd /the/path/to/extracted/file-5.21
LDFLAGS=-L/the/path/to/libgnurx-2.5.1/lib
CFLAGS=-I/the/path/to/libgnurx-2.5.1/include
./configure --prefix=/a/path/for/file-2.21
make install
From inside the DevKit msys shell
gem install ruby-filemagic -- --with-magic-dir=/a/path/for/file-2.21
しかし、./configure --prefix=/a/path/for/file-2.21 のコマンドを入力したところで以下のようなエラーが出てしまいます。
configure: error: libgnurx is required to build file(1) with MinGW
これは、どうすれば解決できるでしょうか?
ご教授頂けると非常に助かります。
よろしくお願いします。
あなたの回答
tips
プレビュー