Reputation: 21
I cloned my code from git to my Windows machine and when I run bundle install, I am getting this error:
An error occurred while installing rmagick (2.13.4), and Bundler cannot continue. Make sure that
gem install rmagick -v '2.13.4'
succeeds before bundling.
D:\project\MyProject2>gem install rmagick -v '2.13.4'
Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160721-7208-bn9t3e.rb extconf.rb checking for Ruby version
= 1.8.5... yes Invalid drive specification. Unable to get ImageMagick version * 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.
I tried downloading ImageMagick, and set environment paths as:
CPATH=D:\ImageMagick-6.9.5-Q8\include
LIBRARY_PATH=D:\ImageMagick-6.9.5-Q8\lib
and run bundle install but no use and also tried running
gem install rmagick -v '2.13.4' --platform=ruby -- --with-opt-lib=D:\ImageMagick-6.9.5-Q8\lib --with-opt-include=D:\ImageMagick-6.9.5-Q8\include
it is showing:
Unable to get ImageMagick version * 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.
Please help.
Upvotes: 2
Views: 2548
Reputation: 4343
I had this same issue myself until I finally stumbled upon the answer on Stackoverflow here and here.
Basically you need to follow these steps:
ImageMagick-6.9.5-9-Q16-x86-dll.exe
from imagemagick.org. It seems that rmagik
2.16 only supports ImageMagick 6, not ImageMagick 7.ruby -e "puts 1.size"
. It print 4 if x86 and 8 if x64. answer from here PATH
variable to include the path to ImageMagick. In my case: C:\Server\ImageMagick\
. Make sure it is the first variable in the variables list, or you may encounter an “Invalid drive specification” error when extconf.rb tries to identify the ImageMagick version.cd C:\YourRubyProject
. Example: C:\Server\htdocs\dev-ruby\redmine
.CPATH
and LIBRARY_PATH
environment variables to point respectively to ImageMagick installation directory include and lib subdirectories (so the DevKit will find them at build time)C:\Serever\RailsInstaller\DevKit\msys.bat
. More details heregem install rmagick --platform=ruby -- --with-opt-lib=C:/Server/ImageMagick/lib --with-opt-include=C:/Server/ImageMagick/include
. Adjust paths as necessary for your project.bundle install
, or if necessary bundle update
Note: for those that are looking to install redmine in xampp follow this tutorial. If you get stuck on installing the rmagick
lib, return here to this answer and follow the provided steps.
Upvotes: 3