I don't know if this question belongs here, but I'll take a shot. Hi. I'm running ubuntu 11.10 dual-boot with windows vista on my machine. On Ubuntu, I've installed RVM, rails gem, & PostgreSQL (the postgres server, client, & other packages like libpq5, because I installed it via Software Center).
I'm trying to deploy my app on heroku, but seems like i need to install pg gem. I tried to install it, but got this error instead:
ERROR: Failed to build gem native extension.
/home/pcr/.rvm/rubies/ruby-1.9.3-p0/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... * extconf.rb failed *
After searching google & stackoverflow for a while, many people said that libpq-dev has to be installed. I tried, via software center but fail do to unmet dependencies. I tried via apt-get, it said that I need libkrb5-dev and krb5-multidev. I tried sudo apt-get install libpq-dev libkrb5-dev krb5-multidev
, and got this:
The following packages have unmet dependencies: krb5-multidev :
Depends: libkrb5-3 (= 1.9.1+dfsg-1ubuntu1) but 1.9.1+dfsg-1ubuntu2.1 is to be installed
Depends: libk5crypto3 (= 1.9.1+dfsg-1ubuntu1) but 1.9.1+dfsg-1ubuntu2.1 is to be installed
Depends: libgssapi-krb5-2 (= 1.9.1+dfsg-1ubuntu1) but 1.9.1+dfsg-1ubuntu2.1 is to be installed E: Unable to correct problems, you have held broken packages.
But I already have libkrb5-3, libk5crypto3, and libgssapi-krb5-2 (all with version 1.9.1+dfsg-1ubuntu2.1) on my system! I think maybe the version needed is 1.9.1+dfsg-1ubuntu1. So, maybe I have to remove the 1.9.1+dfsg-1ubuntu2.1 packages first. Do you think it's safe for me to remove it? I tried to remove one of them, but software center warns me that it will also remove postgres, openssl-client, smbclient, cups, and many other packages.
What should I do to resolve this? And, is pg gem really necessary to be installed on my local machine to create rails app with postgres as the dbms? Is there a way to "hand over" the responsibility to include pg gem to heroku instead?
I got same issue today. I followed message You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. So installed libpq-dev and bundle rails app again and the error disappeared.
The real solution is, as correctly pointed out by Amit Patel, to install
libpq-dev
Here is a workaround if you were unable to setup pg at you development machine. You can use sqlite in your local machine and pg in Heroku. Here is what you should have in your Gemfile
And use this command for installing bundle to ignore production gems:
Please keep in mind that not having same environment in production and development machines is not recommended.