Installing the Postgres gem on Ubuntu


#1

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.


#2

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


#3

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


#4

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.