I want to build a Rails 3 app for Heroku.
They use Postgres as their db so I installed postgres 9.0 via MacPorts.
Now I need a postgres gem and the consensus is that for performance reasons
you want the pg gem. However I’m completely baffled by the errors I’m getting
when I try and install pg via gem install under rvm.
I have been very explicit by specifying where all the postgres directories
are to be found but still am unable to complete the install:
$ env ARCHFLAGS='-arch x86_64' gem install pg -- \
--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf \
--with-pg-include=/opt/local/include/postgresql90/ \
--with-pg-lib=/opt/local/lib/postgresql90/
Using config values from /opt/local/var/db/postgresql90/defaultdb/postgresql.conf
*** 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/guy/.rvm/ruby-1.9.2-p136/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include=${pg-dir}/include
--with-pg-lib=${pg-dir}/lib
--with-pg-config
extconf.rb:24:in ``': Exec format error - /opt/local/var/db/postgresql90/defaultdb/postgresql.conf --includedir (Errno::ENOEXEC)
from extconf.rb:24:in `<main>'
Anyone got any ideas?
I’m baffled.
Guy
I think your problem is right here:
The
--with-pg-configswitch probably wants to know where thepg_configscript is rather than werepostgresql.confis. You should have apg_configscript somewhere under/opt/local/bin(probably), it should produce a big pile of stuff like this:when you run it. The
pg_configscript tells you (or whoever is asking) where the various header files and libraries are and which compiler flags are needed.The “Exec format error” error message is the give away. That sounds like you’re trying to execute something that the OS doesn’t know how to execute and I wouldn’t expect OSX to know how to execute some arbitrary configuration file.