[root@ruby-devserver 9.1]# gem install postgres
Building native extensions. This could take a while...
ERROR: Error installing postgres:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby 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
--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=/usr/local/rvm/rubies/ruby-1.9.3-p125/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
Gem files will remain installed in
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/pg-0.13.2 for inspection.
Results logged to
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/pg-0.13.2/ext/gem_make.out
Then if I try to run this
[root@ruby-devserver 9.1]# gem install postgres
--with-pg-config=/var/lib/psql/9.1/data/[root@ruby-devserver data]# gem
install postgres --with-pg-config=/var/lib/psql/9.1/data/postgresql.conf
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-pg-config=/var/lib/psql/9.1/data/postgresql.conf
[root@ruby-devserver data]# gem install postgres
--with-pg-config=/var/lib/psql/9.1/data/
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-pg-config=/var/lib/psql/9.1/data/
but whithout success, any help on this?
Regards
--
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
You probably miss the libpq-dev package.
Check this for reference:
If you still face problems, what is your exact version of Operating System ?
HTH,
Peter
...
run bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.1.0)
Using activesupport (3.2.1)
Using builder (3.0.0)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.1)
Using actionmailer (3.2.1)
Using arel (3.0.2)
Using tzinfo (0.3.31)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bundler (1.0.22)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.1)
Installing pg (0.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby 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
An error occured while installing pg (0.13.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.13.2'` succeeds before bundling.
This is the correct gem? pg? Any other help on get RoR and PostgreSQL up
and running?
[1]
http://davidghedini.blogspot.com/2010/10/install-postgresql-9-on-centos.html
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
> Installing pg (0.13.2) with native extensions
> Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
> extension.
>
> /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby 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
So what's unclear about that? If you believe the required files are
on your system, find them and provide the correct path to the gem
installer. And if they're not, install them :-)
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
[root@ruby-devserver yum.repos.d]# locate libpq-fe.h
/usr/pgsql-9.1/include/libpq-fe.h
So it's installed!!! :D
[root@ruby-devserver yum.repos.d]# gem install pg --
--with-pgsql-include-dir=/usr/psql-9.1/include
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
--with-pgsql-include-dir=/usr/psql-9.1/include
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
:( any help?
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
> checking for pg_config... no
> No pg_config... trying anyway. If building fails, please try again with
> --with-pg-config=/path/to/pg_config
So, it fails; where is pg_config, and have you followed the directive
to try building with that path?
[root@ruby-devserver ~]# gem install pg
--with-pg-include=/usr/pgsql-9.1/include/
--with-pg-config=/var/lib/pgsql/9.1/data/
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-pg-include=/usr/pgsql-9.1/include/
===========================
[root@ruby-devserver ~]# locate libpq-fe.h
/usr/pgsql-9.1/include/libpq-fe.h
[root@ruby-devserver ~]# ll /var/lib/pgsql/9.1/data/
total 92
drwx------ 5 postgres postgres 4096 Mar 1 08:46 base
drwx------ 2 postgres postgres 4096 Mar 1 18:42 global
drwx------ 2 postgres postgres 4096 Mar 1 08:46 pg_clog
-rw------- 1 postgres postgres 4266 Mar 1 12:42 pg_hba.conf
-rw------- 1 postgres postgres 1636 Mar 1 08:46 pg_ident.conf
drwx------ 2 postgres postgres 4096 Mar 1 08:47 pg_log
drwx------ 4 postgres postgres 4096 Mar 1 08:46 pg_multixact
drwx------ 2 postgres postgres 4096 Mar 1 18:41 pg_notify
drwx------ 2 postgres postgres 4096 Mar 1 08:46 pg_serial
drwx------ 2 postgres postgres 4096 Mar 1 19:04 pg_stat_tmp
drwx------ 2 postgres postgres 4096 Mar 1 08:46 pg_subtrans
drwx------ 2 postgres postgres 4096 Mar 1 08:46 pg_tblspc
drwx------ 2 postgres postgres 4096 Mar 1 08:46 pg_twophase
-rw------- 1 postgres postgres 4 Mar 1 08:46 PG_VERSION
drwx------ 3 postgres postgres 4096 Mar 1 08:46 pg_xlog
-rw------- 1 postgres postgres 19137 Mar 1 10:15 postgresql.conf
-rw------- 1 postgres postgres 71 Mar 1 18:41 postmaster.opts
-rw------- 1 postgres postgres 72 Mar 1 18:41 postmaster.pid
So what I'm doing wrong?
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
This time you left off the additional '--' after `gem install pg` - you had
it in there the time before. It tells gem the following flags are for the
specific gem you're installing, not for the gem command itself.
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
Just go one step at a time. Here's *exactly* what works on my Mac:
gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
You should be able to just substitute the appropriate location for
your own pg_config file.
Ok but can you tell me which is the correct line? I'm lost here :(
[root@ruby-devserver ~]# gem install pg --
--with-pg-include=/usr/pgsql-9.1/include/
--with-pg-config=/var/lib/pgsql/9.1/data/
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
--with-pg-include=/usr/pgsql-9.1/include/
--with-pg-config=/var/lib/pgsql/9.1/data/
Using config values from /var/lib/pgsql/9.1/data/
sh: /var/lib/pgsql/9.1/data/: is a directory
sh: /var/lib/pgsql/9.1/data/: is a directory
checking for libpq-fe.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
--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=/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in
`try_cpp'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:970:in
`block in find_header'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in
`block in checking_for'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in
`block (2 levels) in postpone'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in
`block in postpone'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in
`postpone'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in
`checking_for'
from
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:969:in
`find_header'
from extconf.rb:40:in `<main>'
Gem files will remain installed in
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/pg-0.13.2 for inspection.
Results logged to
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/pg-0.13.2/ext/gem_make.out
I notice this "You have to install development tools first." which DT is
needed here?
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
which looks nothing like the *working example* I gave you. Please
go back and read my last message.
[root@ruby-devserver ~]# gem install pg --
--with-pg-config=/var/lib/pgsql/9.1/data/
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
--with-pg-config=/var/lib/pgsql/9.1/data/
Using config values from /var/lib/pgsql/9.1/data/
sh: /var/lib/pgsql/9.1/data/: is a directory
sh: /var/lib/pgsql/9.1/data/: is a directory
checking for libpq-fe.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
--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=/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
Does that path end with a file named 'pg_config'? No. It does not.
So, again, nothing like the example I gave you.
Ing. Reynier Perez Mira
eMail: reyn...@gmail.com, reyn...@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com
> So what's unclear about that? If you believe the required files are
> on your system, find them and provide the correct path to the gem
> installer. And if they're not, install them :-)
What's unclear about it is that it doesn't fucking work.
Been there, done that, the error message and instructions are incorrect; providing the path to pg_config does not work, even when the postgres install is completely default with everything in the standard location. It's a bit frustrating that I can't find my notes right now, but basically nearly all the results from google searches are really bad advice, and what is required is to use the option that specifies the root of the postgres install.
--
Scott Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice
If there is a reproduceable bug in core Postgres, please show me here
so I can resolve it.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services