Forum: Ruby on Rails Installing the Postgres gem on Ubuntu

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David E. (Guest)
on 2006-05-16 15:46
Hi,

I'm having difficulty installing the "postgres" gem. postgres-pr
installed fine, but whenever I run:

sudo gem install postgres

I get:

ERROR:  While executing gem ... (RuntimeError)
    ERROR: Failed to build gem native extension.
Gem files will remain installed in
/usr/lib/ruby/gems/1.8/gems/postgres-0.7.1 for inspection.

I've had a bit of a poke around, and gathered that the problem is gem
not knowing where to find the postgres libraries and includes. However,
I've tried various combinations of
--with-pgsql-dir/--with-pgsql-lib-dir/--with-pgsql-include-dir/etc, with
no luck so far. Has anyone encountered a smiliar problem and managed to
resolve it?

I'm running ruby 1.8.4, rails 1.1.2, gem 0.8.11, and postgres 8.0. I
also have the postgresql-dev package installed.

Thanks.
Gregory S. (Guest)
on 2006-05-16 16:02
(Received via mailing list)
On Tue, May 16, 2006 at 01:46:21PM +0200, David E. wrote:
} Hi,
}
} I'm having difficulty installing the "postgres" gem. postgres-pr
} installed fine, but whenever I run:

The postgres-pr does not have any native extension. The -pr stands for
Pure
Ruby. Your issue is with building the native extensions.

} sudo gem install postgres
}
} I get:
}
} ERROR:  While executing gem ... (RuntimeError)
}     ERROR: Failed to build gem native extension.
} Gem files will remain installed in
} /usr/lib/ruby/gems/1.8/gems/postgres-0.7.1 for inspection.
}
} I've had a bit of a poke around, and gathered that the problem is gem
} not knowing where to find the postgres libraries and includes.
However,
} I've tried various combinations of
} --with-pgsql-dir/--with-pgsql-lib-dir/--with-pgsql-include-dir/etc,
with
} no luck so far. Has anyone encountered a smiliar problem and managed
to
} resolve it?
}
} I'm running ruby 1.8.4, rails 1.1.2, gem 0.8.11, and postgres 8.0. I
} also have the postgresql-dev package installed.

I'm working from Debian knowledge rather than Ubuntu knowledge, but
things
should be similar. First, have you tried installing libpgsql-ruby (or
libpgsql-ruby1.8)? Under Debian, it is the package for the Ruby driver
for
PostgreSQL in a system package rather than a gem. I usually prefer to
install system packages rather than gems when possible, especially those
with native extensions (e.g. librmagick-ruby).

If those packages do not exist in Ubuntu, be sure that ruby-dev (or
ruby1.8-dev) is installed, as well as libpq-dev, then try the gem
install
again. Again, I am working from Debian knowledge so it might not apply.
Good luck. If this doesn't help I recommend consulting an Ubuntu mailing
list.

} Thanks.
--Greg
Nicholas T. (Guest)
on 2006-05-16 16:20
(Received via mailing list)
Although I cannot remember the name of the package, there is a
Postgres/Ruby lib for connecting these two technologies.

I have used Postgres on Ubuntu before without any problems.

HTH

Nicholas
Michael G. (Guest)
on 2006-05-16 21:43
Nicholas T. wrote:
> Although I cannot remember the name of the package, there is a
> Postgres/Ruby lib for connecting these two technologies.
>
> I have used Postgres on Ubuntu before without any problems.
>
> HTH
>
> Nicholas

This may help, http://mgreenly.metaspot.net/?p=38 or maybe not.
This topic is locked and can not be replied to.