Re: Error trying to install Ruby postgres gems on OS/X

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Error trying to install Ruby postgres gems on OS/X
Date: 2011-01-29 01:54:17
Message-ID: AANLkTik+H=dwR8y2v2PDRM=6ccm2wNRLoUmYUgn89_Rm@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

So I installed the postgres-pg library, which if I understand
correctly is a Ruby implementation of the adapter (as opposed to
native code that has to be built) and that's working fine..

From what I've read, this adapter is much slower but probably fine for
non-production use (I'm just learning for now)..

However, if anyone has any ideas how to install the native adapter, lemme know!

On Fri, Jan 28, 2011 at 5:50 PM, Mike Christensen <mike(at)kitchenpc(dot)com> wrote:
> Now I get:
>
> /Library/PostgreSQL/9.0>export ARCHFLAGS='-arch i386'
> /Library/PostgreSQL/9.0>sudo -E gem install postgres
> Password:
> Building native extensions.  This could take a while...
> ERROR:  Error installing postgres:
>        ERROR: Failed to build gem native extension.
>
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
> extconf.rb:73: command not found: pg_config --bindir
> extconf.rb:46: command not found: pg_config --includedir
> extconf.rb:53: command not found: pg_config --libdir
> checking for main() in -lpq... no
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.
>
> Provided configuration options:
>        --with-opt-dir
>        --without-opt-dir
>        --with-opt-include
>        --without-opt-include=${opt-dir}/include
>        --with-opt-lib
>        --without-opt-lib=${opt-dir}/lib
>        --with-make-prog
>        --without-make-prog
>        --srcdir=.
>        --curdir
>        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
>        --with-pgsql-dir
>        --without-pgsql-dir
>        --with-pgsql-include
>        --without-pgsql-include=${pgsql-dir}/include
>        --with-pgsql-lib
>        --without-pgsql-lib=${pgsql-dir}/lib
>        --with-pqlib
>        --without-pqlib
> Could not find PostgreSQL build environment (libraries & headers):
> Makefile not created
>
>
> Gem files will remain installed in
> /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28 for inspection.
> Results logged to
> /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out
> /Library/PostgreSQL/9.0>
>
>
> On Fri, Jan 28, 2011 at 5:46 PM, Thom Brown <thom(at)linux(dot)com> wrote:
>> On 29 January 2011 01:37, Mike Christensen <mike(at)kitchenpc(dot)com> wrote:
>>> I'm trying to install the Postgres gem on OS/X but getting errors no
>>> matter what I try..  In theory, it should be as simple as "gem install
>>> postgres", correct?  Here's what I get:
>>>
>>>>sudo gem install postgres
>>> Building native extensions.  This could take a while...
>>> ERROR:  Error installing postgres:
>>>        ERROR: Failed to build gem native extension.
>>>
>>> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
>>> extconf.rb:73: command not found: pg_config --bindir
>>>
>>>                ===========   WARNING   ===========
>>>
>>>                You are building this extension on OS X without setting the
>>>                ARCHFLAGS environment variable, and PostgreSQL does not appear
>>>                to have been built as a universal binary. If you are seeing this
>>>                message, that means that the build will probably fail.
>>>
>>>                Try setting the environment variable ARCHFLAGS
>>>                to '-arch i386' before building.
>>>
>>>                For example:
>>>                (in bash) $ export ARCHFLAGS='-arch i386'
>>>                (in tcsh) $ setenv ARCHFLAGS '-arch i386'
>>>
>>>                Then try building again.
>>>
>>>                ===================================
>>>                extconf.rb:46: command not found: pg_config --includedir
>>> extconf.rb:53: command not found: pg_config --libdir
>>> checking for main() in -lpq... no
>>> *** extconf.rb failed ***
>>> Could not create Makefile due to some reason, probably lack of
>>> necessary libraries and/or headers.  Check the mkmf.log file for more
>>> details.  You may need configuration options.
>>>
>>> Provided configuration options:
>>>        --with-opt-dir
>>>        --without-opt-dir
>>>        --with-opt-include
>>>        --without-opt-include=${opt-dir}/include
>>>        --with-opt-lib
>>>        --without-opt-lib=${opt-dir}/lib
>>>        --with-make-prog
>>>        --without-make-prog
>>>        --srcdir=.
>>>        --curdir
>>>        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
>>>        --with-pgsql-dir
>>>        --without-pgsql-dir
>>>        --with-pgsql-include
>>>        --without-pgsql-include=${pgsql-dir}/include
>>>        --with-pgsql-lib
>>>        --without-pgsql-lib=${pgsql-dir}/lib
>>>        --with-pqlib
>>>        --without-pqlib
>>> Could not find PostgreSQL build environment (libraries & headers):
>>> Makefile not created
>>>
>>>
>>> Gem files will remain installed in
>>> /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28 for inspection.
>>> Results logged to
>>> /Library/Ruby/Gems/1.8/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out
>>>
>>> I have Postgres 9.0 installed at /Library/PostgreSQL/9.0.  Any ideas?
>>>
>>> Mike
>>
>> Hi Mike,
>>
>> Well the message does advise you to specify the architecture in the
>> environment variable.
>>
>> Try:
>>
>> export ARCHFLAGS='-arch i386'
>> sudo -E gem install postgres
>>
>> -E will allow the environment variable survive the sudo call.
>>
>> --
>> Thom Brown
>> Twitter: @darkixion
>> IRC (freenode): dark_ixion
>> Registered Linux user: #516935
>>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2011-01-29 01:56:45 Re: Error trying to install Ruby postgres gems on OS/X
Previous Message Mike Christensen 2011-01-29 01:50:45 Re: Error trying to install Ruby postgres gems on OS/X