views:

21

answers:

2

At my wits end with this!

My current set up is: - Ruby 1.9.2 - Rails 3.0.1 - pg (0.9.0)

My $PATH right now looks like this:

/Users/fjones/.rvm/gems/ruby-1.9.2-p0/bin:/Users/fjones/.rvm/gems/ruby-1.9.2-p0@global/bin:/Users/fjones/.rvm/rubies/ruby-1.9.2-p0/bin:/Users/fjones/.rvm/bin:ARCHFLAGS=-arch x86_64:/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql84/bin:/Library/Glassfish/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Anytime I attempt to do a "bundle install" from Netbeans 6.9.1 I get the following exception.

Installing pg (0.9.0) with native extensions /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/Users/fjones/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb checking for pg_config... no

=========== WARNING =========== You are building this extension on OS X without setting the
ARCHFLAGS environment variable, and pg_config wasn't found in your PATH. If you are seeing this message, that means that the build will probably fail.

If it does, you can correct this by either including the path to 'pg_config' in your PATH or setting the environment variable ARCHFLAGS to '-arch ' before building.

For example: (in bash) $ export PATH=/opt/local/lib/postgresql84/bin:$PATH
$ export ARCHFLAGS='-arch x86_64' (in tcsh) % set path = ( /opt/local/lib/postgresql84/bin $PATH ) % setenv ARCHFLAGS '-arch x86_64'

Then try building again.

=================================== MacOS X build: fixing architecture flags: checking for libpq-fe.h... no Can't find the 'libpq-fe.h header * 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=/Users/fjones/.rvm/rubies/ruby-1.9.2-p0/bin/ruby --with-pg --without-pg --with-pg-config --without-pg-config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --enable-static-build --disable-static-build

Gem files will remain installed in /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/pg-0.9.0 for inspection. Results logged to /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/pg-0.9.0/ext/gem_make.out from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:486:in block in build_extensions' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:446:in each' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:446:in build_extensions' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:198:in install' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/source.rb:100:in install' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:55:in block in run' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in block in each' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in each' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in each' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:44:in run' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:8:in install' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/cli.rb:221:in install' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/task.rb:22:in run' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/invocation.rb:118:in invoke_task' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor.rb:246:in dispatch' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/base.rb:389:in start' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/bin/bundle:13:in <top (required)>' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/bin/bundle:19:in load' from /Users/fjones/.rvm/rubies/ruby-1.9.2-p0/bin/bundle:19:in `'

A: 

Seems like you need to install the development version of libpq (headers and libraries). Unfortunately I have no idea what exactly should be done on OS X.

Milen A. Radev
Funny thing is that I can "sometimes" run "bundle install" from terminal ...buy I consistently get this problem in netbeans. Maybe it's time to switch back to textmate.
wgpubs
A: 

ANSWER:

So this is really a problem with Netbeans 6.9.1 not assigning the correct path info for Ruby 1.9.2 gems. The solution:

  1. Go to Tools > Ruby Platforms
  2. Select Ruby 1.9.2-p0 in the Platforms listbox
  3. Update "Gem Home" and "Gem Path" based on what those paths should be (run "gem env" from Terminal to get that info)

This will actually fix a number of things in addition to being able to run "bundle install" with the pg gem. In addition you'll be able to install the fast debugger for 1.9.2 and manage your other gems from within netbeans.

wgpubs