Forum: Ruby on Rails installing ruby-postgres gem

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.
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2009-02-07 07:32
I'm starting to look at postgres because I'm going to need it for its
GIS extensions. But I run in into a problem when trying to install the
ruby-postgres gem. I get this error

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-postgres:
  ERROR: Failed to build gem native extension.
blah
blah
blah etc
postgres.c:31: error: conflicting types for ‘pg_encoding_to_char’
/usr/include/postgresql/libpq-fe.h:518: error: previous declaration of
‘pg_encoding_to_char’ was here
postgres.c: In function ‘pgconn_s_escape_bytea’:
postgres.c:370: warning: pointer targets in passing argument 1 of
‘PQescapeBytea’ differ in signedness
postgres.c: In function ‘pgconn_s_unescape_bytea’:
postgres.c:401: warning: pointer targets in passing argument 1 of
‘PQunescapeBytea’ differ in signedness
make: *** [postgres.o] Error 1

Presumably some people have installed Postgresql and got it to work with
Ruby. Does anyone have any experience solving this problem?

Thanks

John Small
72362b8e516797ee5112ed883581e819?d=identicon&s=25 Jorge Queiruga (jque)
on 2009-04-08 18:40
change /usr/include/libpq-fe.h (extern const char
*pg_encoding_to_char(int encoding); to extern char
*pg_encoding_to_char(int encoding);) # remove const
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2009-04-09 07:56
Jorge Queiruga wrote:
> change /usr/include/libpq-fe.h (extern const char
> *pg_encoding_to_char(int encoding); to extern char
> *pg_encoding_to_char(int encoding);) # remove const

Thanks for that I've already switched to using the newer ruby-pg gem and
that seems OK.

Ta

John Small
This topic is locked and can not be replied to.