3

I installed ruby 2.1.0 and package pdfbeads on 32bit 12.04 last year following the blog https://railssavvy.wordpress.com/2012/06/02/install_ruby_and_rails/, and it worked. Now it seems that I have installed ruby 2.2.0 on 64bit 14.04, but met the problem when installing pdfbeads.

  1. Installing rvm and ruby:

    I heard the ruby in Ubuntu repository does not work (but I don't know if that still applies), so I followed https://railssavvy.wordpress.com/2012/06/02/install_ruby_and_rails/ to install rvm and ruby. I am not sure if I did the right things in the following:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    
    curl -L get.rvm.io | bash -s stable
    

    I originally first ran curl -L get.rvm.io | bash -s stable first, but it asked me to run the gpg command before it.

    Then I add a line to ~/.bashrc:

    PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
    

    And a couple of lines to ~/.bash_profile:

    [[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
    

    Then I ran:

    source ~/.rvm/scripts/rvm
    rvm requirements
    rvm autolibs disable
    
    
    $ rvm install 2.2.0
    Already installed ruby-2.2.0.
    To reinstall use:
    
        rvm reinstall ruby-2.2.0
    

    it tells me I have installed ruby already, then I checked the output of the previous commands, and found that curl -L get.rvm.io | bash -s stable seems already installed ruby. Then I ran:

    rvm --default use 2.2.0
    

    Did I install rvm and ruby correctly? Or is there some better way to do that?

  2. Now I would like to install a package pdfbeads:

    $  gem install  pdfbeads
    Building native extensions.  This could take a while...
    ERROR:  Error installing pdfbeads:
        ERROR: Failed to build gem native extension.
    
        /home/t/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150322-21902-q15297.rb extconf.rb
    checking for Ruby version >= 1.8.5... yes
    checking for gcc... yes
    checking for Magick-config... no
    checking for pkg-config... yes
    checking for ImageMagick version >= 6.4.9... 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
    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
    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
    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 stdint.h... yes
    checking for sys/types.h... yes
    checking for wand/MagickWand.h... no
    
    Can't install RMagick 2.13.4. 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=/home/t/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /home/t/.rvm/gems/ruby-2.2.0/gems/rmagick-2.13.4 for inspection.
    Results logged to /home/t/.rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/rmagick-2.13.4/gem_make.out
    t@ocean:/h/t/./archives$ man gem
    No manual entry for gem
    See 'man 7 undocumented' for help when manual pages are not available.
    

    I follow this link https://askubuntu.com/a/528798/1471 suggestion to run

    rvm install 2.2.0-dev
    

    After it seems that I still have the same error:

    $  gem install  pdfbeads
    Building native extensions.  This could take a while...
    ERROR:  Error installing pdfbeads:
        ERROR: Failed to build gem native extension.
    
        /home/t/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150322-24037-mauac1.rb extconf.rb
    checking for Ruby version >= 1.8.5... yes
    checking for gcc... yes
    checking for Magick-config... no
    checking for pkg-config... yes
    checking for ImageMagick version >= 6.4.9... 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
    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
    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
    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 stdint.h... yes
    checking for sys/types.h... yes
    checking for wand/MagickWand.h... no
    
    Can't install RMagick 2.13.4. 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=/home/t/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /home/t/.rvm/gems/ruby-2.2.0/gems/rmagick-2.13.4 for inspection.
    Results logged to /home/t/.rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/rmagick-2.13.4/gem_make.out
    

    I wonder how I can install the pdfbeads package?

Thanks!

6

To check if your version of ruby is set up correctly, you can use the following.

$ which ruby
  /path/to/ruby
$ ruby --version
  ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]

In your case, it looks like ruby is setup fine. Rvm is just a tool to help you manage your rubies. You'll know if you don't like it.

There are clues to why the installation of the gem failed. Particularly,

checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no                   <------   There's your problem
checking for pkg-config... yes
checking for ImageMagick version >= 6.4.9... yes

You are missing a library that is required for the gem to build successfully. This solution suggests it's available in the repos. So, you should be able to install it with:

sudo apt-get install libmagickwand-dev

Once that is done, you should be able to install the gem.

gem install  pdfbeads

Note: I haven't tested this solution, and the more prudent reader might notice I'm not even using ubuntu here anymore. Leave a comment if this doesn't get you sorted.

2

Try this. It worked for me:

sudo apt-get install ruby-dev
sudo gem install pdfbeads

Reference: https://stackoverflow.com/a/26161563/2433023

1

I also recently came across this issue recently with RVM.

I tried installing Compass and it failed on the native binaries with a recent clean install of Ubuntu.

The solution was to reinstall the Ruby version (2.3.0) using an additional flag afterwards of --disable-binary which means you don't install the pre-compiled binaries that comes with RVM. This means your native binaries are compiled on your machine. This will take some time to complete.

So, if you are having this issue try:

rvm reinstall --disable-binary 2.2.0

Be sure to update the ruby version to whatever version you are having the issue with

  • This solved the problem I was having with RVM. Thanks a lot. The final parameter in the command is the version of ruby you want to install. – Yathi Aug 3 '16 at 20:49
0

When I run sudo apt install build-essential, then it works again.

Ubuntu 18.04, Ruby 2.5.1p57.

0

For WSL (Windows Subsystem for Linux) you need install build-essential package:

sudo apt install build-essential

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.