Ruby Can';t安装dm postgres适配器
按照Heroku网站上的说明,我安装了Ruby Can';t安装dm postgres适配器,ruby,postgresql,sinatra,Ruby,Postgresql,Sinatra,按照Heroku网站上的说明,我安装了Postgress.app,安装了pggem,安装了data\u mapper,一切都很顺利。最后,尝试安装dm sqlite适配器并获得以下结果: sudo gem install dm-postgres-adapter Fetching: data_objects-0.10.14.gem (100%) Successfully installed data_objects-0.10.14 Fetching: do_postgres-0.10.14.gem
Postgress.app
,安装了pg
gem,安装了data\u mapper
,一切都很顺利。最后,尝试安装dm sqlite适配器并获得以下结果:
sudo gem install dm-postgres-adapter
Fetching: data_objects-0.10.14.gem (100%)
Successfully installed data_objects-0.10.14
Fetching: do_postgres-0.10.14.gem (100%)
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
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/do_postgres-0.10.14 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/do_postgres-0.10.14/ext/do_postgres/gem_make.out
我也试过了
sudo ARCHFLAGS="-arch x86_64" gem install dm-postgres-adapter
但结果是一样的
我查看了gem_make.out,最后发现以下内容:
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
有什么建议吗?以下是我能想到的 错误消息(如找不到某些头或库)具有误导性。所有这些东西都被成功地找到了,但是,正如mkmf.log所示,有许多解析错误。这意味着工具链中的某个地方出现了问题。我在Mac电脑上,所以这可能是Xcode工具、Ruby版本或某些gems的问题,或者这些工具中的任何一个由于某种原因无法协同工作。。。谁知道呢。我在Stackoverflow的某个地方看到一个有类似问题的人通过重新安装整个工具链解决了这个问题 我决定选择一条不同的道路。我在Nitrous.io上创建了一个Ruby box,到目前为止一切都正常——我能够安装PostgreSQL和可怕的dm postgres适配器,以及我需要的所有其他gems。经验上的巨大差异
它仍然不能解决运行Postgres.app并在我的本地机器上从Sinatra使用它的问题,但我现在可以接受。也许有一天我会非常生气,炸掉整个小车工具链,然后重新安装,但还没有,还没有…万岁!我做到了。解决方案非常简单:安装Ruby 2.1.1。然后安装dm postgres适配器就没有任何问题了 我安装了Postgres.app。这是在Mac上安装PostgreSQL的一种方法。深入到安装的子文件夹中,我可以找到报告丢失的文件,因此我尝试使用各种选项,如
sudo ARCHFLAGS=“-arch x86_64”gem install dm postgres adapter--with pgsql server include=/Applications/postgres.app/Contents/Versions/9.3/include/postgresl/server
,但到目前为止还没有成功。我在想在哪里找到它。嗯,我找到了。。。但这并没有真正的帮助。它显示所有的头实际上都被成功地找到了,但是有一系列解析错误,比如:/Applications/Postgres.app/Contents/Versions/9.3/include/postgresql/server/mb/pg_wchar.h:542:28:error:function无法返回函数类型“bool”(又名“int(int*)”)extern bool pg_utf8_islegal(const unsigned char*source,int-length);^2个警告和15个错误生成。