I've had a very similar problem when compiling the pg gem for ruby 1.9.  As
it turned out, it was my install of ruby 1.9 that was busted.  I had it
installed via rvm, so I deleted everything rvm related and rebuilt ruby 1.9.
 After that, everything went smoothly.

One other thing you might try is passing the location of pg_config, and
making sure that pg_config is getting your installation information correct.

Have you tried installing the latest driver?  It seems to compile a lot
easier on OSX.  http://bitbucket.org/ged/ruby-pg/src/

Darren


On Thu, Feb 11, 2010 at 1:59 AM, Guyren G Howe <[email protected]> wrote:

> Trying to get pg gem installed on Snow Leopard with Postgres's install of
> Postgres 8.4 in /Library/PostgreSQL/8.4. I can find a million references to
> this problem online, but every one of them has a few "I got it working"s
> which don't work for me, followed by folks saying "well, it doesn't for me"
> and reproducing what I have below and then no solution.
>
> This is what I'm doing
>
> $export PATH=/Library/PostgreSQL/8.4/bin:${PATH}
> $export ARCHFLAGS='-arch x86_64' #I've also tried '-arch i386'
> $sudo gem install pg --
> -with-pgsql-include=/Library/PostgreSQL/8.4/include/
> -with-pgsql-lib=/Library/PostgreSQL/8.4/lib/
> Building native extensions.  This could take a while...
> ERROR:  Error installing pg:
>        ERROR: Failed to build gem native extension.
>
> /usr/local/bin/ruby extconf.rb
> -with-pgsql-include=/Library/PostgreSQL/8.4/include/
> -with-pgsql-lib=/Library/PostgreSQL/8.4/lib/
> checking for main() in -lpq... yes
> checking for libpq-fe.h... yes
> checking for libpq/libpq-fs.h... yes
> checking for PQconnectionUsedPassword()... no
> checking for PQisthreadsafe()... no
> checking for PQprepare()... no
> checking for PQexecParams()... no
> checking for PQescapeString()... no
> checking for PQescapeStringConn()... no
> checking for lo_create()... no
> checking for pg_encoding_to_char()... no
> checking for PQsetClientEncoding()... no
> creating Makefile
>
> make
> gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin10.2.0 -I.
> -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/Library/PostgreSQL/8.4/include
>  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -D_XOPEN_SOURCE=1
>  -fno-common -pipe -fno-common   -c compat.c
> In file included from compat.c:16:
> compat.h:38:2: error: #error PostgreSQL client version too old, requires
> 7.3 or later.
> In file included from compat.c:16:
> compat.h:69: error: conflicting types for ‘PQconnectionNeedsPassword’
> /Library/PostgreSQL/8.4/include/libpq-fe.h:293: error: previous declaration
> of ‘PQconnectionNeedsPassword’ was here
> ...
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to