Installing rmagick gem on Amezon AMI server getting error for ImageMagick dependencies - rmagick

Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2/ext/RMagick
/home/ec2-user/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210806-10706-10mubyf.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.7.7)... no
checking for gcc... yes
checking for GNUC... *** 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/ec2-user/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
/home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in block in try_compile'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:585:in try_compile'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:852:in macro_defined?' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:994:in block in have_macro'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:959:in block in checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:331:in open' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:357:in postpone'
from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:958:in checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/mkmf.rb:993:in have_macro'
from extconf.rb:99:in configure_compile_options' from extconf.rb:19:in initialize'
from extconf.rb:398:in new' from extconf.rb:398:in '
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.6.5/gems/rmagick-4.2.2 for inspection.
Results logged to /home/ec2-user/.rvm/gems/ruby-2.6.5/extensions/x86_64-linux/2.6.0/rmagick-4.2.2/gem_make.out

sudo yum -y install ImageMagick ImageMagick-devel
convert -version
Output:
Version: ImageMagick 6.9.10-68 Q16 x86_64 2021-02-03 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1)
Delegates (built-in): bzlib fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps tiff wmf x xml zlib
3. gem install rmagick
if you still get the error follow below commands
sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.spec /usr/lib64/libgomp.spec
sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/libgomp.a /usr/lib64/libgomp.a
sudo ln -s /usr/lib64/libgomp.so.1.0.0 /usr/lib64/libgomp.so
And run again gem install rmagick and its all done.
You can find the link below
https://senrenseyo.com/20210811/rails6_rmagick/

Related

Install R-3.6.0 on my local directory in Linux environment

Since I do not have a root account, I want to install the newest R (3.6.0) to my local directory. I downloaded a R-3.6.0.tar.gz file and save it to $HOME/Programs.
After
$ tar xvf R-3.6.0.tar.gz
$ cd R-3.6.0
$ ./configure --prefix=$HOME/Programs/R
I had some error like
checking if zlib version >= 1.2.5... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
So I got the newest zlib library (zlib-1.2.11.tar.gz) to $HOME/Programs, and then
$ tar xvf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure --prefix=$HOME/Programs/zlib-1.2.11
$ make && make install
This works perfectly, but after this when I tried to configure R($ ./configure --prefix=$HOME/Programs/R) again, it still produces the same problem.
checking if zlib version >= 1.2.5... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
I think this problem might be related to the PATH in my .bash_profile(currently it is set as PATH=$PATH:$HOME/bin).
I am completely new to Linux environment and bash commands, so it would be grateful if you could provide some detailed demonstration.

new version bzip2 ignored while installing R 3.4.0 in home directory in CentOS

I do not have enough permissions, so I need to install R3.4.0 in my home directory.
A newer version of bzip2 is required (>= 1.0.6)
The current version is v1.0.5
I've build bzip2 v1.0.6 in my home directory.
There are 4 directories in the build directory: bin, include, lib, man
I know I need to somehow modify paths, so I tried this:
PATH=path/to/bzip2-1.0.6_build/bin:$PATH
CPATH=path/to/bzip2-1.0.6_build/include:$CPATH
LIBRARY_PATH=path/to/bzip2-1.0.6_build/lib:$LIBRARY_PATH
LD_LIBRARY_PATH=path/to/bzip2-1.0.6_build/lib:$LD_LIBRARY_PATH
However, when I run ./configure to install R, I get the error:
checking if bzip2 version >= 1.0.6... no
checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
Which is the same error I got before installing bzip2 v1.0.6
But this time when I run bzip2 --version I get:
bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010.
Which is correct.
How can I make it, so that in the ./configure step, v1.0.6 is taken into acoount over v1.0.5?

configure error installing R-3.3.2 on Ubuntu: checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required

Trying to install R-3.3.2 but when I use $./configure, I keep getting the error:
checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
It worked for me after:
sudo apt-get install libbz2-dev
I have successfully compiled R from source, the following steps need special attention:
install dependent libraries:
zlib-1.2.8, bzip2-1.0.6, xz-5.2.2, pcre-8.39, curl-7.52.1.
Specifically, to compile bzip2, The Makefile should be modified:
original: CC=gcc
after modification: CC=gcc -fPIC
pass the library and header file to the configure with proper variables:
export CPATH=/opt/zlib-1.2.8/include/:/opt/bzip2-1.0.6/include/:/opt/xz-5.2.2/include/:/opt/pcre-8.39/include/
export LD_LIBRARY_PATH=/opt/zlib-1.2.8/lib/:/opt/bzip2-1.0.6/lib/:/opt/xz-5.2.2/lib/:/opt/pcre-8.39/lib/
./configure --prefix=/opt/R/R_soft/ --enable-R-shlib --with-libpth-prefix=/opt/ CPPFLAGS="-I/opt/bzip2-1.0.6/include/ -I/opt/zlib-1.2.8/include/ -I/opt/xz-5.2.2/include/ -I/opt/pcre-8.39/include/ -I/opt/curl-7.52.1/include/" LDFLAGS="-L/opt/xz-5.2.2/lib/ -L/opt/zlib-1.2.8/lib/ -L/opt/bzip2-1.0.6/lib/ -L/opt/pcre-8.39/lib/ -L/opt/curl-7.52.1/lib/"
It seems CPATH and CPPFLAGS is redundant here, I found the CPPFLAGS AND LDFLAGS not worked.
First off, are you aware that you can get prebuilt binaries of current R ?
Second, your comment on the bzip2 binary has no bearing on the need for the library R needs to compile and link against.
Third, you can search: apt-cache search bzip2 | grep library would have gotten you there.
Fourth, for all existing packages you can actually install their known build dependencies. But see point one, you probably do not want to build from source.
Fifth, and closing: sudo apt-get install libbz2-dev answers your (narrow) question but you will likely have further issues. There is an entire manual devoted to installing and administering R which has all the answers for you.

Rails rmagick error Ubuntu c9.io

I've been looking around on other rmagick threads for a good solution. Nothing has worked so far.
I'm working on a rails project on c9 IDE. I managed to successfully install imagemagick via the 'sudo apt get install imagemagick' command.
However when I try to run 'gem install rmagick' I get the following error
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/rmagick-2.15.4/ext/RMagick
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160608-3911-1hut05d.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=/usr/local/rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.15.4/mkmf.log extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby 2.3.0/gems/rmagick-2.15.4 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/rmagick-2.15.4/gem_make.out
Try this (working for rmagick 3.0.0):
brew install imagemagick#6
brew link --force imagemagick#6
gem install rmagick

pip install readline on Mac OS X (10.7.3) fails

When building the c extensions of readline when installing readline via pip install readline, I get an error message as follows:-
Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/Users/calvin/.virtualenvs/myproj/build/readline/rl/readline-lib':
configure: error: C compiler cannot create executables
See `config.log' for more details.
============ Building the readline library ============
============ Building the readline extension module ============
running install
running build
running build_ext
building 'readline' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.7.sdk
Searching for the location of MacOSX10.7.sdk on my system reveals:-
calvin$ sudo find / -name "MacOSX10.7.sdk"
Password:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
Which is not where the readline compilation is expecting.
Is there a bug with how pip locates the MacOSX10.7.sdk?
How do I resolve this without resorting to copying MacOSX10.7 into the /Developer/SDKs directory?
CLARIFICATION
This is how I temporarily solve my problem.
calvin$ sudo mkdir -p /Developer/SDKs/
Password:
calvin$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk
calvin$ pip install readline
But I am not too sure this is the "appropriate" way to solve it as there might be some inherent problems either from how pip is supposed to locate my .sdk location or I am missing something in my system PATH. So any advice on how to resolve this the "appropriate" way would be much appreciated!
That's a good question. As a point of note, I do have a MacOSX10.7.sdk folder in /Developer/SDKs, so perhaps it's your filesystem's state that's wrong.
The safest approach is probably to install XCode, but that's horribly expensive in terms of time. I would start by creating a soft link:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk
and see if that does the trick.

Resources