[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PostgreSQL ruby pg gem not installing

Posted on 2012-09-21
6
Medium Priority
?
2,226 Views
Last Modified: 2013-01-22
gem install pg

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
      ERROR: Failed to build gem native extension.

        /home/ogottwald/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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
      --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/ogottwald/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
      --with-pg
      --without-pg
      --with-pg-dir
      --without-pg-dir
      --with-pg-include
      --without-pg-include=${pg-dir}/include
      --with-pg-lib
      --without-pg-lib=${pg-dir}/lib
      --with-pg-config
      --without-pg-config
      --with-pg_config
      --without-pg_config
      --with-pqlib
      --without-pqlib
      --with-libpqlib
      --without-libpqlib
      --with-ms/libpqlib
      --without-ms/libpqlib


Gem files will remain installed in /home/ogottwald/.rvm/gems/ruby-1.9.3-p194@cm/gems/pg-0.14.1 for inspection.
Results logged to /home/ogottwald/.rvm/gems/ruby-1.9.3-p194@cm/gems/pg-0.14.1/ext/gem_make.out


The I'm honestly at a complete loss on this one.

I have tried everything under the sun.  I used the following to configure PostgreSQL: http://linuxpoison.blogspot.com/2012/01/how-to-install-configure-postgresql.html

I'm totally puzzled I've tried 15 to 20 things to get it working
0
Comment
Question by:olivergwald
  • 4
5 Comments
 

Author Comment

by:olivergwald
ID: 38423357
I think it is either a permission (most likely) or path issue.

Things I've tried:

sudo apt-get libpg-dev

gem install pg -- --with-pg-lib=/var/lib/postgresql/9.1/main
Permission issue
I think this is where the pg libs are.

sudo apt-get install bundle-install

locate pg_config
/usr/bin/pg_config

gem install pg -- --with-pg-config=/usr/bin/pg_config

It works with sudo gem install pg but the problem is i need non-root for rvm

so i'm really confused on what to do
0
 

Author Comment

by:olivergwald
ID: 38423490
Now after all the above i did a /bundle install on my Gemfile and magically it is working.  But by itself with

gem install pg

it is not working.  Uh Uh Oh its magic...  you know...
in my gemFile I have the following:


platforms :mri, :mingw do
  group :postgresql do
    gem "pg"
  end

  group :sqlite do
    gem "sqlite3"
  end
end
0
 

Author Comment

by:olivergwald
ID: 38423638
I spoke to soon on this...
so now I do rails s and get the following error:

`require': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (cannot load such file -- pg_ext) (LoadError)

So something is not cool
0
 

Accepted Solution

by:
olivergwald earned 0 total points
ID: 38423822
Okay what I ended up happening to do is a complete remove of the rvm
http://www.mkoby.com/2011/06/03/completely-removing-rvm/

reinstall the rvm
configure rails etc..

and then it started working
something environmentally got messed up on my end.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 38804859
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Screencast - Getting to Know the Pipeline

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question