Note that there are some explanatory texts on larger screens.

plurals
  1. POInstalling the PostgreSQL gem with 'gem pq' fails with ERROR: Failed to build gem native extension
    text
    copied!<p>I am learning Ruby on Rails and trying to develop an application. In my application I am trying to use the default <strong>SQLite database in the Development Mode</strong> and <strong>PostgreSQL in the Production Mode</strong>. But I'm getting the following error while trying to install pg gem using: <code>gem install pg</code></p> <pre><code>Building native extensions.  This could take a while... ERROR:  Error installing pg:         ERROR: Failed to build gem native extension.       /home/tusharkhatiwada/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev  for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev  for building a client-side application. 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/tusharkhatiwada/.rvm/rubies/ruby-2.0.0-p247/bin/ruby         --with-pg         --without-pg         --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}/     Gem files will remain installed in /home/tusharkhatiwada/.rvm/gems/ruby-2.0.0-p247@rails4.0.0/g ems/pg-0.17.0 for inspection. Results logged to /home/tusharkhatiwada/.rvm/gems/ruby-2.0.0-p247@rails4.0.0/gems/pg-0.17.0/ext /gem_make.out </code></pre> <p>After that I again tried with <code>gem install pg -- --with-pg-config= '/usr/bin/pg_config'</code> and the following error is displayed:</p> <pre><code>Building native extensions with: '--with-pg-config= /usr/bin/pg_config' This could take a while... ERROR:  Error installing pg:         ERROR: Failed to build gem native extension.       /home/tusharkhatiwada/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb --with-pg-config= /us r/bin/pg_config Using config values from  sh: 1: : Permission denied sh: 1: : Permission denied 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/tusharkhatiwada/.rvm/rubies/ruby-2.0.0-p247/bin/ruby         --with-pg         --without-pg         --with-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}/     Gem files will remain installed in /home/tusharkhatiwada/.rvm/gems/ruby-2.0.0-p247@rails4.0.0/g ems/pg-0.17.0 for inspection. Results logged to /home/tusharkhatiwada/.rvm/gems/ruby-2.0.0-p247@rails4.0.0/gems/pg-0.17.0/ext /gem_make.out </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload