I'm trying to deploy an app on OpsWorks, but there are problems with installing rmagick gem. I have the following OS packages:
libmagickwand-dev imagemagick libmagickcore-dev
Below is the log file with errors during deployment:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
*** 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=/usr/local/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/deploy/.bundler/myapp/ruby/2.1.0/gems/rmagick-2.13.3 for inspection.
Results logged to /home/deploy/.bundler/myapp/ruby/2.1.0/extensions/x86_64-linux/2.1.0/rmagick-2.13.3/gem_make.out
An error occurred while installing rmagick (2.13.3), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.3'` succeeds before bundling.
STDERR:
---- End output of sudo su - deploy -c 'cd /srv/www/myapp/releases/20140929182350 && /usr/local/bin/bundle install --path /home/deploy/.bundler/myapp --without=test development' 2>&1 ----
Ran sudo su - deploy -c 'cd /srv/www/myapp/releases/20140929182350 && /usr/local/bin/bundle install --path /home/deploy/.bundler/myapp --without=test development' 2>&1 returned 5
[2014-09-29T18:24:08+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
In your shell, run the following command:
apt-get install libmagickwand-dev
I had the same problem after upgrading ubuntu to 15.05, some how the Magick-config file is no longer in my PATH.
To fix this I first found the location of Magick-config
sudo find / -name "Magick-config"
which was /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config then I added it to the path. Bundle succeeded afterwards.
sudo apt-get install libmagickwand5 libmagickwand-dev
gem install rmagick -v 2.13.3
Install Imagemagick-dev libraries
Ubuntu systems: sudo apt-get install libmagickwand-dev
RHEL systems: yum install ImageMagick-devel
Mac: brew install imagemagick
In Ubuntu 14.04 I also needed to install the libgmp-dev library to get working the newer rmagick 2.15.4 version:
sudo apt-get install libgmp-dev
Hope this helps!
to fix it permanently we could just do:
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
First of all we need to search configuration
sudo find / -name "Magick-config"
You will get output something like this:
/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config
Now you just need to setup bin location in your environment by using this:
PATH=$PATH:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/
Don't forget to remove Magick-config from end of line.
Related
Here is the log from my bundle install
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
...
...
Cannot find mysql_config at /usr/local/opt/mysql#5.6/bin/mysql_config
--with-ldflags=-L/usr/local/opt/openssl/lib
--with-cppflags=-I/usr/local/opt/openssl/include
-----
*** 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=/Users/admin/.asdf/installs/ruby/2.6.3/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
To see why this extension failed to compile, please check the mkmf.log which can be found
here:
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2 for
inspection.
Results logged to
/Users/admin/development/locari/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.2/gem_make.out
An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds
before bundling.
So I do what it says, and run sudo gem install mysql2 -v '0.5.2' --source
$ sudo gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed
And it installs fine! But when I run bundle install again, I get the same error. I've tried uninstalling, unlinking, and reinstalling mysql in brew.
What can I try next??
Run these commands first:
bundle config --local build.mysql2 "--with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib"
Then run bundle install it works.
Installation on M1 macs
This method helped me on ruby v2.7.2 and macOS Big Sur 11.4.
Install dependencies
brew install mysql zstd openssl
Install the gem
gem install mysql2 -- --with-ldflags="-L $(brew --cellar zstd)/1.5.0/lib -L $(brew --prefix openssl)/lib" --with-ldlibs="-lzstd -lssl" --with-cppflags="-I $(brew --prefix openssl)/include"
As an alternative, you can modify bundler config:
bundle config --local build.mysql2 --with-ldflags="-L $(brew --cellar zstd)/1.5.0/lib -L $(brew --prefix openssl)/lib" --with-ldlibs="-lzstd -lssl" --with-cppflags="-I $(brew --prefix openssl)/include"
and run bundle install.
Use build options with bundler.
Try running this in your application directory:
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
This sets it just for your application, which can be handy for checking into your repo if others need a similar configuration. But you can also make it a global configuration on your computer by replacing --local with --global and it will apply to all your bundle install commands on your User account.
Update
This actually didn't end up working for me but I'll leave it here because it should have worked. I basically just had to run:
gem install mysql2 -v '0.5.3' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Instead of using bundler, even though setting this build config should have done this.
I have twitter-text gem in my application.
When I do a bundle install I am getting the below error.
Need to solve it on high priority.
I also went to the github page https://github.com/twitter/twitter-text/issues/225
but could not find a solution there.
I tried to install directly using the line below but got the same error.
gem install idn-ruby -v '0.1.0'
Error
Fetching idn-ruby 0.1.0
Installing idn-ruby 0.1.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/inuscg/.rvm/gems/ruby-2.3.0#idt-two/gems/idn-ruby-0.1.0/ext
/home/inuscg/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20180427-13217-1wpq9sy.rb extconf.rb
checking for main() in -lidn... no
ERROR: could not find idn library!
Please install the GNU IDN library or alternatively specify at least one
of the following options if the library can only be found in a non-standard
location:
--with-idn-dir=/path/to/non/standard/location
or
--with-idn-lib=/path/to/non/standard/location/lib
--with-idn-include=/path/to/non/standard/location/include
*** 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=/home/inuscg/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-idn-dir
--without-idn-dir
--with-idn-include
--without-idn-include=${idn-dir}/include
--with-idn-lib
--without-idn-lib=${idn-dir}/lib
--with-idnlib
--without-idnlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/inuscg/.rvm/gems/ruby-2.3.0#idt-two/extensions/x86_64-linux/2.3.0/idn-ruby-0.1.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/inuscg/.rvm/gems/ruby-2.3.0#idt-two/gems/idn-ruby-0.1.0 for inspection.
Results logged to /home/inuscg/.rvm/gems/ruby-2.3.0#idt-two/extensions/x86_64-linux/2.3.0/idn-ruby-0.1.0/gem_make.out
An error occurred while installing idn-ruby (0.1.0), and Bundler cannot continue.
Make sure that `gem install idn-ruby -v '0.1.0'` succeeds before bundling.
In Gemfile:
twitter-text was resolved to 2.1.0, which depends on
idn-ruby
Thank you in advance
As per the error show in logs
ERROR: could not find idn library!. idn library is required to install twitter text. Try to install that first and then install the gem. Try with
sudo apt-get install libldap2-dev
sudo apt-get install libidn11-dev
Hope this solves your problem.
For mac:
brew install libidn
On a Mac, you can do:
$ brew install libidn
If you're using Mac OS, then here's how to install libidn:
$ brew install libidn
On Centos 7 I had to install libidn-devel via yum install libidn-devel
If you are using Windows and facing same error, then try
Instruction for Windows
Get the appropriate build of GNU LibIDN Library from here
Unpack it where you prefer (e.g. c:\tmp\libs\libidn)
Add option to bundler config
BUNDLE_BUILD__IDN-RUBY: "--with-idn-dir=C:/tmp/libs/libidn/"
Launch bundler install
As for me I used libidn-1.33-win64.zip package
You're required to install LibIDN beforehand, since the gem is just ruby bindings for it.
Requirements
GNU LibIDN Library
Rake to run the tests and generate the documentation
RubyGems to produce a Gem package
Ruby 1.9.1 or above. Patches welcome to make this work in 1.8.7
The specific download method would depend on your OS, but if it's Ubuntu, try sudo apt-get install libidn
I 'm on Ubuntu 16.04 ,
in gemfile I have gem "rmagick" and when I bundle it says
An error occurred while installing rmagick (2.16.0), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.16.0'` succeeds before bundling.
as suggested above when I try gem install rmagick -v '2.16.0' it says
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/faisal/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/ext/RMagick
/home/faisal/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160926-26223-16sn0dg.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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=/home/faisal/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/faisal/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/faisal/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to /home/faisal/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/rmagick-2.16.0/gem_make.out
I have tried dozen of different ways provided in different questions but none of the work.
In MacOS, you can do this:
brew unlink imagemagick
brew install imagemagick#6 && brew link imagemagick#6 --force
Try this, You need to run the following commands for ubuntu
sudo apt-get install libmagick++-dev
sudo apt-get install imagemagick
Then try to install
gem install rmagick
On Ubuntu you should first install this
sudo apt-get install libmagickwand-dev
Then install gem install rmagick
On mac/osx, make sure you brew install imagemagick#6 (NOT 7)
On Mac High Sierra - 10.13.4 - https://www.imagemagick.org/script/download.php
sudo port install ImageMagick
sudo gem install rmagick
the only thing that worked for me was
brew unlink pkgconfig
bundle install
brew link pkgconfig
On Fedora (when I installed Redmine) that worked for me:
sudo dnf install ImageMagick-devel
bundle install
You are missing dependencies from Imagemagick which are required for rmagick gem to work
sudo apt-get update
sudo apt-get install imagemagick
Once done, bundle should execute successfully and install the gems.
try this
$ sudo apt-get install libmagick++-dev
and then
bundle install
and install Imagemagick
$ sudo apt-get install imagemagick
Then, install the rmagick gem :
$ sudo gem install rmagick
Type in the following commands on the console -
sudo apt-get install libmagick9-dev
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install libmagickwand-dev
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagick++-dev
Let me know if it solves the issue
On Mac OSX 10.12.3, I have also tried many methods to install rmagick and finally I solved my problem.
brew doctor says
............
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:
imagemagick
Warning: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
brew link <formula> will cause other formulae to detect them during
the ./configure step. This may cause problems when compiling those
other formulae.
Binaries provided by keg-only formulae may override system binaries
with other strange results.
You may wish to brew unlink these brews:
imagemagick#6
I did
>brew unlink imagemagick#6
Unlinking /usr/local/Cellar/imagemagick#6/6.9.7-9... 60 symlinks removed
>brew link imagemagick
Linking /usr/local/Cellar/imagemagick/6.9.7-3... 75 symlinks created
then
>gem install rmagick
works for me
My advice: Try to install correct version of imagemagick and listen brew doctors advice.
A little late to the game but the following worked for me on Ubuntu 16.04:
Probably overkill a bit but first you'll want to enable all deb-src lines in your sources.list:
sudo vi /etc/apt/sources.list
Then do an apt update:
sudo apt update
Now you should be able to install all the required packages:
sudo apt install libfreetype6-dev libfontconfig1-dev libpng-dev libwmf-dev libpango1.0-dev librsvg2-dev libmagickcore-dev libmagickwand-dev imagemagick
(personally I installed libmagickcore-dev, libmagickwand-dev, imagemagick one at a time during my debugging but you should be able to install them all at once)
Hope this helps
For Centos 6 for the and above
yum install ImageMagick-devel
bundle install
Following this tutorial [link] to install gitlab on a dedicated server. I need to :
sudo -u git -H bundle install --deployment --without development test postgres aws
But an error occurred while installing rugged :
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** 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=/usr/local/bin/ruby
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/ext/rugged/gem_make.out
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
So I installed rugged -> I installed CMake & config-pkg :
/home/git/gitlab$ sudo gem install rugged
Building native extensions. This could take a while...
Successfully installed rugged-0.21.2
Parsing documentation for rugged-0.21.2
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for lib/rugged/rugged.so, skipping
1 gem installed
But it doesnt change anything :
Errno::EACCES: Permission denied - /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/LICENSE
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
Any idea ?
For OSX if you're using homebrew:
brew install cmake
bundle install
First, try installing cmake:
sudo apt-get install cmake
Then, repeat the command:
sudo -u git -H bundle install --deployment --without development test postgres aws
For me, gem was complaining about pkg-config missing dependence, so I did:
sudo apt-get install pkg-config
and then
sudo gem install rugged -v '0.22.2'
after that, I revert to my older version of gitlab and re-run the script for the upgrade.
My older version of gitlab was 6.9.2 and the upgraded version 8.0.5
Can fix this problem only that way:
download from https://cmake.org/download/. Extract the downloaded tar file and then:
cd $CMAKE_DOWNLOAD_PATH
./configure
make
make install
And after this steps I could successfully run:
gem install rugged -v '0.26.0'
Note: The above mentioned solutions did not work for me.
Here is the error log I got
checking for gmake... no
checking for make... yes
Building Rugged using system libraries.
libgit2 version is not compatible, expected ~> 0.99.0
*** 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.
It was mainly saying libgit2 version is not compatible, expected ~> 0.99.0
and I tried gem install rugged -v '0.99.0' and then bundle install.
then the problem is solved.
Mac OSX 10.6 or later please refer to this url:
http://www.cmake.org/download/
For me it was Openssl problem in a WSL ubuntu 20.04 env
Run
apt install cmake libssl-dev
might also help to run
apt install ruby-dev pkg-config
I've installed ImageMagick(6.8.6-3) by Homebrew.
When try to install rmagick gem(2.13.2) on Max OS X Mountain Lion, show errors 'Abort trap: 6'
gem install rmagick -v 2.13.2
Abort trap: 6
When switch version to '2.13.1', show errors below.
gem install rmagick -v 2.13.1
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** 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=/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby
Gem files will remain installed in /Users/Macmini/.rvm/gems/ruby-1.8.6-p420#sis/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/Macmini/.rvm/gems/ruby-1.8.6-p420#sis/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
I can't figure out what's wrong?
to install rmagick 2.13.1 on mac, you need Imagemagick version 6.7.x (it wont work with 6.8.x). And you may have to run this command before installing the gem
cd "`Magick-config --prefix`/lib"; ln -s libMagick++-Q8.7.dylib libMagick++.dylib; ln -s libMagickCore-Q8.7.dylib libMagickCore.dylib; ln -s libMagickWand-Q8.7.dylib libMagickWand.dylib
The above is actually equivalent of running these commands
cd "`Magick-config --prefix`lib"
ln -s libMagick++-Q16.7.dylib libMagick++.dylib
ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
After this, you can
gem install rmagick -v '2.13.1'
And to install ImageMagick 6.7 using homebrew, run these commands
cd /usr/local/
brew versions imagemagick
You should see something like this
6.8.0-10 git checkout 883f549 /usr/local/Library/Formula/imagemagick.rb
6.7.7-6 git checkout 834ce4a /usr/local/Library/Formula/imagemagick.rb
6.7.5-7 git checkout f965101 /usr/local/Library/Formula/imagemagick.rb
6.7.1-1 git checkout be8e0ff /usr/local/Library/Formula/imagemagick.rb
6.6.9-4 git checkout 4e7c332 /usr/local/Library/Formula/imagemagick.rb
6.6.7-10 git checkout 0476235 /usr/local/Library/Formula/imagemagick.rb
6.6.7-8 git checkout db99927 /usr/local/Library/Formula/imagemagick.rb
6.6.7-1 git checkout 7cd042f /usr/local/Library/Formula/imagemagick.rb
6.6.4-5 git checkout 53886de /usr/local/Library/Formula/imagemagick.rb
Then choose your version by running
git checkout 834ce4a /usr/local/Library/Formula/imagemagick.rb
followed by
brew install imagemagick