Issue 1 - Error in installing pg gem

Installing pg 0.19.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/luke/.rvm/gems/ruby-2.4.1/gems/pg-0.19.0/ext
/home/luke/.rvm/rubies/ruby-2.4.1/bin/ruby -I /home/luke/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0 -r
./siteconf20200623-185-13imfro.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/luke/.rvm/rubies/ruby-2.4.1/bin/$(RUBY_BASE_NAME)
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/luke/.rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/pg-0.19.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/luke/.rvm/gems/ruby-2.4.1/gems/pg-0.19.0 for inspection.
Results logged to /home/luke/.rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/pg-0.19.0/gem_make.out

An error occurred while installing pg (0.19.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.19.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  pg

Solution 1

gem install bundler:1.17.3
sudo apt-get install libpq-dev
sudo dpkg --configure -a
sudo apt-get install libpq-dev
bundle install

 

Issue 2 - Error installing rmagick

Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/luke/.rvm/gems/ruby-2.4.1/gems/rmagick-2.16.0/ext/RMagick
/home/luke/.rvm/rubies/ruby-2.4.1/bin/ruby -I /home/luke/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0 -r
./siteconf20200623-15666-15teuz4.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/luke/.rvm/rubies/ruby-2.4.1/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/luke/.rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/rmagick-2.16.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/luke/.rvm/gems/ruby-2.4.1/gems/rmagick-2.16.0 for inspection.
Results logged to /home/luke/.rvm/gems/ruby-2.4.1/extensions/x86_64-linux/2.4.0/rmagick-2.16.0/gem_make.out

An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.16.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rmagick

Solution 2

sudo apt-get install imagemagick sudo apt-get install libmagickwand-dev bundle install

Issue 3

An error occurred while installing pg (0.19.0), and Bundler cannot continue.Make sure that `gem install pg -v '0.19.0' --source 'https://rubygems.org/'` succeeds before bundling.

Solution 3

 sudo apt-get install libpq-dev

 bundle i