Installing ruby-postgres gem


#1

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 S.


#2

change /usr/include/libpq-fe.h (extern const char
*pg_encoding_to_char(int encoding); to extern char
*pg_encoding_to_char(int encoding):wink: # remove const


#3

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):wink: # remove const

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

Ta

John S.