Installing imagemagick and rmagick on Lion 10.7 - ruby-on-rails

I used this link http://rmagick.rubyforge.org/install-osx.html and now I cannot do brew install imagemagic too..
I did this
gem install rmagick --version 1.15.17
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby gem_extconf.rb
sh configure
Configuring RMagick 1.15.17
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking for ruby... /usr/bin/ruby
checking Ruby version... 1.8.7
checking for Magick-config... Magick-config
checking ImageMagick version... 6.7.4
checking for library containing InitializeMagick... no
configure: error: Can't install RMagick. Can't find libMagick or one of the dependent libraries.
Check the config.log file for more detailed information.
RMagick configuration failed with status 1.

Before install rmagick, you should install imagemagick ahead.
Can use brew
brew install imagemagick
then
gem install rmagick

Related

rmagick gem install problem undeclared identifier 'IsGrayImage' Macbook M1

I'm having problems installing Rmagick gem on my M1 Macbook. I installed the latest version of ImageMagick via brew arch -arm64 brew install imagemagick and tested it with the following commands:
magick logo: logo.gif
identify logo.gif
Once I confirmed it was working correctly I added the rmagick gem to my Gemfile.
Below is the output of the bundle install command.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
/Users/user/.rvm/rubies/ruby-2.7.2/bin/ruby -I /Users/user/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0 -r ./siteconf20210721-75512-tve65x.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for forced use of ImageMagick 6... no
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for gcc... yes
checking for __GNUC__... yes
checking for MagickCore/MagickCore.h... yes
checking for rb_gc_adjust_memory_usage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for posix_memalign() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for malloc_usable_size() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for malloc_size() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... yes
checking for _aligned_msize() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for GetImageChannelEntropy() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for SetImageGray() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for SetMagickAlignedMemoryMethods() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,sys/types.h,MagickCore/MagickCore.h... no
checking for malloc.h... no
checking for malloc/malloc.h... yes
creating extconf.h
creating Makefile
======================================================================
Wed 21 Jul 21 07:25:56
This installation of RMagick 4.2.2 is configured for
Ruby 2.7.2 (x86_64-darwin20) and ImageMagick 7.1.0
======================================================================
Configured compile options: {:magick_version=>"7.1.0", :local_libs=>" -L/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/lib -lMagickCore-7.Q16HDRI", :cflags=>" -Xpreprocessor -fopenmp
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/include/ImageMagick-7 -std=gnu99", :cppflags=>" -Xpreprocessor -fopenmp
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/include/ImageMagick-7", :ldflags=>"
-L/opt/homebrew/Cellar/imagemagick/7.1.0-4_1/lib -lMagickCore-7.Q16HDRI", :defs=>[], :config_h=>"Makefile"}
current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
make DESTDIR\= clean
current directory: /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2/ext/RMagick
make DESTDIR\=
compiling rmagick.c
compiling rmdraw.c
compiling rmenum.c
compiling rmfill.c
compiling rmilist.c
compiling rmimage.c
rmimage.c:7552:32: error: use of undeclared identifier 'IsGrayImage'
return has_attribute(self, IsGrayImage);
^
1 error generated.
make: *** [Makefile:245: rmimage.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.7.2/gems/rmagick-4.2.2 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-2.7.2/extensions/x86_64-darwin-20/2.7.0/rmagick-4.2.2/gem_make.out
An error occurred while installing rmagick (4.2.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '4.2.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rmagick
Make sure your Ruby, rmagick and ImageMagick are all 64-bit or are all 32-bit. That was my problem on Windows 10 (see Github post you replied to).

Impossible to install Nokogiri in Rails app Since OSX Mojave 10.14.2

Since the recent update (10.14.2) Nokogiri gem cannot be installed in my app.
When I run bundle install, I get this error:
./siteconf20190109-70456-1diyett.rb extconf.rb --use-system-libraries
checking if the C compiler accepts -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE
-fstack-protector-strong -O2 -pipe... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future...
no
Building nokogiri using system libraries.
Using pkg-config gem version 1.3.2
checking for libxml-2.0... yes
checking for libxslt... yes
checking for libexslt... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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 already checked the Nokogiri's installation guide for Mojave, but it does not work, even after having used this patch:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Setup:
OS:
OSX Mojave 10.14.2
Ruby version:
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]
Do you have any idea to solve this issue?
Thank you in advance for your help.
The log message is saying libxml2 is missing.
So, try to run this:
brew install libxml2
if you have homebrew installed.
Check this link for more information.

Bundle Error Installing CLD, macOS Sierra

I have been having some problems with bundle install since updating my OS to Sierra. The latest one is related with the gem cld:
Installing cld 0.7.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/zn/wqrzmg6d4nq55m38xmpfyyn80000gn/T/bundler20161018-17743-2nngwicld-0.7.0/gems/cld-0.7.0/ext/cld
/Users/seque1990/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20161018-17743-1l1g1xa.rb
extconf.rb
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build_aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking build system type... i386-apple-darwin16.0.0
checking host system type... i386-apple-darwin16.0.0
checking how to print strings... printf
checking for style of include used by make... none
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
Makefile not found
Gem files will remain installed in
/var/folders/zn/wqrzmg6d4nq55m38xmpfyyn80000gn/T/bundler20161018-17743-2nngwicld-0.7.0/gems/cld-0.7.0
for inspection.
Results logged to
/var/folders/zn/wqrzmg6d4nq55m38xmpfyyn80000gn/T/bundler20161018-17743-2nngwicld-0.7.0/extensions/x86_64-darwin-15/2.2.0-static/cld-0.7.0/gem_make.out
An error occurred while installing cld (0.7.0), and Bundler cannot continue.
Make sure that `gem install cld -v '0.7.0'` succeeds before bundling.
What is the best approach to solve this?
Thanks.
As #MarsAtomico suggested I did update xcode and homebrew and was able to install the gem.

Error installing rvm 2.3.0 , installation halts

I am trying to install rvm 2.3.0 for 2 days but getting below error.I tried using "rvm install ruby-2.3.0" command.It did not work.Then again I did
rvm get master
rvm install 2.3.1
Again got the same error.Anyone have an idea regarding this.thanks in advance.
Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/smrutisumanpanda/.rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...
ruby-2.3.0 - #extracting ruby-2.3.0 to /Users/smrutisumanpanda/.rvm/src/ruby-2.3.0....
ruby-2.3.0 - #configuring.......
Error running './configure --prefix=/Users/smrutisumanpanda/.rvm/rubies/ruby-2.3.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
showing last 15 lines of /Users/smrutisumanpanda/.rvm/log/1475218763_ruby-2.3.0/configure.log
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... no
configure: error: something wrong with CFLAGS="-g -O2 "
There has been an error while running configure. Halting the installation.
Issue resolved.I updated my OS mac version 10.10.2 to 10.10.5.After that i tried installing rvm (rvm install 2.3.0) and it got installed.

Failed to gem install nokogiri in Fedora16

I'm running Ruby 1.9.3p194 & Rails 3.2.9 in Fedora 16.
When I gem install nokogiri, it fails with error message:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/chelseaw/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
checking for iconv_open() in -liconv... no
checking for libiconv_open() in iconv.h... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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've googled around for quite a while but only found some solutions for MacOS. I've no idea what to do, please help.
Edit 1
The results of yum search iconv:
mingw32-iconv-debuginfo.noarch : Debug information for package mingw32-iconv
mingw32-iconv-static.noarch : Static version of the MinGW Windows Iconv library
mingw32-win-iconv.noarch : MinGW Windows Iconv library
mingw32-win-iconv-debuginfo.noarch : Debug information for package
: mingw-win-iconv
mingw32-win-iconv-static.noarch : Static version of the MinGW Windows Iconv
: library
perl-Text-Iconv.i686 : Perl interface to iconv() codeset conversion function
perl-Text-Iconv-debuginfo.i686 : Debug information for package perl-Text-Iconv
psiconv-debuginfo.i686 : Debug information for package psiconv
psiconv-devel.i686 : Development files for psiconv
uniconvertor-debuginfo.i686 : Debug information for package uniconvertor
mingw32-iconv.noarch : GNU libraries and utilities for character set conversion
perl-HTML-WikiConverter.noarch : Perl module to convert HTML to wiki markup
perl-HTML-WikiConverter-Markdown.noarch : Convert HTML to Markdown markup
psiconv.i686 : A conversion utility for Psion files
uniconvertor.i686 : Universal vector graphics translator
Finally got it work, here are the steps:
Download libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
Extract files tar -xvzf libiconv-1.11.tar.gz
Enter the directory cd libiconv-1.11
Configure libiconv Library ./configure --prefix=/usr/local/libiconv
Compile libiconv make CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" (I have to add CFLAGS to make the compiling work.)
Install libiconv sudo make install
Install nokogiri
CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" gem install nokogiri -- --with-iconv-dir=/usr/local/libiconv --with-iconv-lib=/usr/local/libiconv/lib --with-iconv-include=/usr/local/libiconv/include
Voila, it shows the success message!
No need to compile it yourself, try running this command:
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
Or:
rvm get head && rvm requirements run force
Try:
yum install -y iconv-devel
and then:
gem install nokogiri
Error message indicates libiconv is missing. Did you install it? you may need to install libiconv and libiconv-devel packages.

Resources