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

From: Thom Brown <thom(at)linux(dot)com>
To: Mike Christensen <mike(at)kitchenpc(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:46:33
Message-ID: AANLkTiksYFpWpezfgkMfXOz1GCypamrdHygxN65wPhMi@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2011-01-29 01:48:58 Re: resizing a varchar column on 8.3.8
Previous Message Mike Christensen 2011-01-29 01:37:23 Error trying to install Ruby postgres gems on OS/X