Problems installing postgres in Ruby

Hi,

I got some problems getting the postgres installed in Ruby. This
is the output I get:

gem install postgres

Building native extensions. This could take a while…
ruby extconf.rb install postgres
checking for cygwin32_socket() in -lwsock32… no
checking for socket() in -lsocket… no
checking for gethostbyname() in -linet… no
checking for gethostbyname() in -lnsl… yes
checking for sys/un.h… yes
checking for socket()… yes
checking for hsterror()… no
checking for gethostname()… yes
checking for PQsetdbLogin() in -lpq… yes
checking for PQsetClientEncoding()… yes
checking for pg_encoding_to_char()… yes
checking for PQescapeString()… yes
creating Makefile

make
gcc -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux -I. -DHAVE_SYS_UN_H -DHAVE_SOCKET
-DHAVE_GETHOSTNAME -DHAVE_PQSETCLIENTENCODING -DHAVE_PG_ENCODING_TO_CHAR
-DHAVE_PQESCAPESTRING -c postgres.c
gcc -shared -L"/usr/lib" -o postgres.so postgres.o -lruby -lpq -lnsl
-ldl -lcrypt -lm -lc

make install
make: Nothing to be done for `install’.

make clean
Successfully installed postgres-0.7.1

It ends sucessfully so it looks ok except for the fact that make install
doesnt do anything.

But when I test it I get:

ruby -e ‘require “rubygems”; require_gem “postgres”;’

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- postgres (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:229:in activate' from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:228:inactivate’
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
active_gem_with_options' from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:59:inrequire_gem’
from -e:1

Can anyone here help me out?

Regards,
Torkel

On 9/26/06, Torkel M. [email protected] wrote:

checking for cygwin32_socket() in -lwsock32… no
checking for PQescapeString()… yes
make install

ruby -e ‘require “rubygems”; require_gem “postgres”;’

Can anyone here help me out?

Regards,
Torkel


Posted via http://www.ruby-forum.com/.

have you considered using the “pure ruby” version?

gem install postgres-pr

Aaron K. wrote:

have you considered using the “pure ruby” version?

gem install postgres-pr

Yes. I did try that earlier and I got that installed and working with
the test from above.

However I did not get it to work from the program that I want this for
so I don’t know if its supported. Is postgres and postgres-pr different
in any case or should both work from any program?

Its the new Metasploit I want to try if anyone got any more tips then.

On Tue, 26 Sep 2006 14:33:39 +0200, Torkel M. wrote:

It ends sucessfully so it looks ok except for the fact that make install
doesnt do anything.

I just had exactly the same problem installing the ruby-postgres-0.7.1
gem,
which I -believe- is the latest version of what used to just be called
the
“postgres” gem. It seemed to install, yet ‘require "postgres’" failed.

I’m using Postgres 8.1 on Ubuntu 6.06. I’d previously used Postgres 8.0
on
Mandrake 10 with no problems.

Torkel, which Postgres and what OS?

Can anyone confirm my recollection that ruby-postgres is the rightful
descendant of postgres? The postgres gem itself wouldn’t build on my
system, as it depends on libpq-fe.h which is apparently missing from 8.1
(or at least Ubuntu’s packaging of it).

Jay L.

Jay L. wrote:

I’m using Postgres 8.1 on Ubuntu 6.06. I’d previously used Postgres 8.0
on Mandrake 10 with no problems.

Torkel, which Postgres and what OS?

Postgres 8.1.4-1 and Fedora Core 5

Did you do “gem install postgres” or “gem install ruby-postgres” ?

Looks like it gets installed, but not built on my FC5 setup:

How I got it to work:

gem install postgres
cd /usr/lib/ruby/gems/1.8/gems/postgres-0.7.1/
make

On Thu, 28 Sep 2006 09:33:48 +0200, Torkel M. wrote:

Postgres 8.1.4-1 and Fedora Core 5

Interesting.

Did you do “gem install postgres” or “gem install ruby-postgres” ?

I tried both. “gem install postgres” failed to build the native
extension;
it depends on libpq-fe.h which is apparently gone in 8.1. “gem install
ruby-postgres”, which I believe is the updated replacement for the
former,
appeared to succeed but then was still “missing”.

Maybe someone will have the answer…

Jay

[email protected] wrote:

Looks like it gets installed, but not built on my FC5 setup:

How I got it to work:

gem install postgres
cd /usr/lib/ruby/gems/1.8/gems/postgres-0.7.1/
make

Thank you. It works now!

Regards,
Torkel

Torkel M. wrote:

Regards,
Torkel

This fixed my install of ruby-postgres on Ubuntu Dapper as well. The
extra make put files postgres.o and postgres.so into the
/usr/local/lib/site_ruby/gems/gems/ruby-postgres-0.7.1.2006.04.06
directory.

Tony