0

I've been fighting on this for two days, time to ask to StackOverflow.

I've prepared a simple Ruby app (noob alert!) to start with this language. I've used Sinatra and DataMapper.

When using MySql everything went fine. I've installed the dm-mysql-adapter and then with a rake migrate the tables where automagically created. I tried to change mysql over postgres (to publish the app on Heroku) and now the problem.

Launching this command:

sudo gem install dm-postgres-adapter

will give:

Building native extensions.  This could take a while...
ERROR:  Error installing dm-postgres-adapter:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for postgres.h... yes
checking for mb/pg_wchar.h... 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/2.0/usr/bin/ruby
    --with-pgsql-server-dir
    --without-pgsql-server-dir
    --with-pgsql-server-include
    --without-pgsql-server-include=${pgsql-server-dir}/include
    --with-pgsql-server-lib
    --without-pgsql-server-lib=${pgsql-server-dir}/
    --with-pgsql-client-dir
    --without-pgsql-client-dir
    --with-pgsql-client-include
    --without-pgsql-client-include=${pgsql-client-dir}/include
    --with-pgsql-client-lib
    --without-pgsql-client-lib=${pgsql-client-dir}/
    --with-pqlib
    --without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created

I've tried to uninstall and reinstall Postgres (through homebrew) and also passing to the gem install some of those parameters, for example:

sudo gem install dm-postgres-adapter -- --with-pgsql-server-dir=/usr/local/Cellar/postgresql/9.3.2/
sudo gem install dm-postgres-adapter -- --with-pgsql-server-dir=/usr/local/Cellar/postgresql/9.3.2/include/server/
sudo gem install dm-postgres-adapter -- --with-pgsql-server-include=/usr/local/Cellar/postgresql/9.3.2/include/

Any help on this?

Enrichman
  • 11,157
  • 11
  • 67
  • 101
  • @RahulJiresal nope.. in the end I switched to MySQL if I remember well.. : / – Enrichman Feb 26 '14 at 10:04
  • Thanks! I ended up switching to SQLite. In the project I am working with, the seeds.rb file is way out of date, so I wanted to clone the production Postgres DB. Turned out I couldn't clone it to SQLite. So I wrote a script to dump the whole DB into a seeds.rb file — http://www.rahuljiresal.com/2014/02/database-to-seeds-rb-with-sinatra-and-datamapper/ – Rahul Jiresal Feb 26 '14 at 16:05
  • It's not that pg_wchar.h doesn't exist, it's that the test code that is being used to check for it doesn't compile. The problem is apparently related to recent versions of the Xcode LLVM C compiler. I currently don't have any solutions for working past it. – cvkline Dec 02 '14 at 21:49

0 Answers0