在Mac上安装dm-postgres-adapter

时间:2013-12-11 16:29:24

标签: ruby postgresql sinatra ruby-datamapper

我已经为此奋斗了两天,是时候问StackOverflow了。

我准备了一个简单的Ruby应用程序(noob alert!),以这种语言开始。我使用过Sinatra和DataMapper。

使用MySql时一切都很顺利。我已经安装了dm-mysql-adapter,然后安装了rake migrate自动创建的表。 我试图通过postgres更改mysql(在Heroku上发布应用程序),现在是问题。

启动此命令:

sudo gem install dm-postgres-adapter

会给:

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

我尝试卸载并重新安装Postgres(通过自制程序),并且还将一些参数传递给gem安装,例如:

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/

对此有何帮助?

0 个答案:

没有答案