ruby-pg gem fails to install

R

Rajinder Yadav

i built postgres 9.0 from source and i am trying to install ruby-pg
and get the following error

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

/usr/local/bin/ruby extconf.rb
*** 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=/usr/local/bin/ruby
extconf.rb:4:in `<main>': uninitialized constant Object::pLATFORM (NameError)


Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-pg-0.7.9.2008.01.28 for
inspection.
Results logged to
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-pg-0.7.9.2008.01.28/ext/gem_make.out

--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
 
R

Rajinder Yadav

ruby-pg is ancient. you want the pg gem.

Ben

i tried the following

sudo gem install pg --
--with-pgsql-include=/opt/postgresql-9.0.1/src/interfaces/libpq

still getting an error, how do i tell it where to find the header files?

checking for pg_config... no
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.

--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
 
B

Ben Bleything

i tried the following

sudo gem install pg --
--with-pgsql-include=/opt/postgresql-9.0.1/src/interfaces/libpq

still getting an error, how do i tell it where to find the header files?

Did you try just "sudo gem install pg"? I suspect you did and it
failed. At any rate, that's definitely not the correct path; you
probably want something like /opt/postgresql-9.0.1/include

Run pg_config, it'll tell you what your include dir is.

Ben
 
A

Alex Stahl

[Note: parts of this message were removed to make it a legal post.]

Just ran into the same thing myself... installing 'libpq-dev' seemed to
have solved it:
sudo apt-get install libpq-dev


________________________________________________________________________

Alex Stahl | Sr. Quality Engineer | hi5 Networks, Inc. | (e-mail address removed)
| m: 415.710.6961
 
R

Rajinder Yadav

Did you try just "sudo gem install pg"? I suspect you did and it
failed. At any rate, that's definitely not the correct path; you
probably want something like /opt/postgresql-9.0.1/include

Run pg_config, it'll tell you what your include dir is.

Ben
i have tried the following not sure if my syntax is correct? i get the
same error

sudo gem install pg -- \
--with-pgsql-lib=/usr/local/pgsql/lib \
--with-pgsql-include=/usr/local/pgsql/include

sudo gem install pg -- --with-pg-config=/opt/postgresql-9.0.1/src/bin/pg_config


here is the output from pg_config

BINDIR = /opt/postgresql-9.0.1/src/bin/pg_config
DOCDIR = /usr/local/pgsql/share/doc
HTMLDIR = /usr/local/pgsql/share/doc
INCLUDEDIR = /usr/local/pgsql/include
PKGINCLUDEDIR = /usr/local/pgsql/include
INCLUDEDIR-SERVER = /usr/local/pgsql/include/server
LIBDIR = /usr/local/pgsql/lib
PKGLIBDIR = /usr/local/pgsql/lib
LOCALEDIR = /usr/local/pgsql/share/locale
MANDIR = /usr/local/pgsql/share/man
SHAREDIR = /usr/local/pgsql/share
SYSCONFDIR = /usr/local/pgsql/etc
PGXS = /usr/local/pgsql/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
-fwrapv
CFLAGS_SL = -fpic
LDFLAGS = -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgport -lz -lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 9.0.1


--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
 
B

Ben Bleything

Just ran into the same thing myself... installing 'libpq-dev' seemed to
have solved it:

That won't matter on an install from source, like the OP is doing.

Ben
 
R

Rajinder Yadav

Just ran into the same thing myself... installing 'libpq-dev' seemed to
have solved it:



________________________________________________________________________

Alex Stahl | Sr. Quality Engineer | hi5 Networks, Inc. | (e-mail address removed)
| m: 415.710.6961
that won't work for me, i built postgresql 9.0 from source, libpq-dev
is for version 8.4


--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
 
R

Rajinder Yadav

That won't matter on an install from source, like the OP is doing.

Ben

Ben thanks for your clue, I got the gem to build and install. I just
needed to add the executable pg_config not just its path:

sudo gem install pg --
--with-pg-config=/opt/postgresql-9.0.1/src/bin/pg_config/pg_config

--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1
 
V

Vince Vince

Try this



sudo gem install pg -- --with-opt-dir=/usr/local/lib/postgre/
--with-pg-dir=/usr/local/lib/postgre/


where /usr/local/lib/postgre/ should be changed to dir where your
postgresql was installed
 
R

Robert P.

Vince Vince wrote in post #967980:
Try this



sudo gem install pg -- --with-opt-dir=/usr/local/lib/postgre/
--with-pg-dir=/usr/local/lib/postgre/


where /usr/local/lib/postgre/ should be changed to dir where your
postgresql was installed

That one did the trick. Thank you!

Mine was:

sudo gem install pg -- --with-opt-dir=/usr/local/pgsql/
--with-pg-dir=/usr/local/pgsql/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top