Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在64位Snow Leopard上安装带有rvm、postgres 9.0、ruby 1.9.2-p136的pg gem时出现问题_Ruby_Postgresql_Gem_Rvm_Pg - Fatal编程技术网

在64位Snow Leopard上安装带有rvm、postgres 9.0、ruby 1.9.2-p136的pg gem时出现问题

在64位Snow Leopard上安装带有rvm、postgres 9.0、ruby 1.9.2-p136的pg gem时出现问题,ruby,postgresql,gem,rvm,pg,Ruby,Postgresql,Gem,Rvm,Pg,我想为Heroku构建一个Rails 3应用程序。 他们使用Postgres作为数据库,所以我通过MacPorts安装了Postgres 9.0。 现在我需要一个博士后创业板,大家一致认为这是出于表现原因 你想要pg宝石。然而,我完全被我所犯的错误所迷惑 当我尝试在rvm下通过gem安装pg时 我已经非常明确地指定了所有postgres目录的位置 无法找到,但仍无法完成安装: $ env ARCHFLAGS='-arch x86_64' gem install pg -- \ --with

我想为Heroku构建一个Rails 3应用程序。 他们使用Postgres作为数据库,所以我通过MacPorts安装了Postgres 9.0。 现在我需要一个博士后创业板,大家一致认为这是出于表现原因 你想要pg宝石。然而,我完全被我所犯的错误所迷惑 当我尝试在rvm下通过gem安装pg时

我已经非常明确地指定了所有postgres目录的位置 无法找到,但仍无法完成安装:

$ 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>'
$env ARCHFLAGS='-arch x86_64'gem安装页面--\
--使用pg config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf\
--带pg include=/opt/local/include/postgresql90/\
--使用pg lib=/opt/local/lib/postgresql90/
使用/opt/local/var/db/postgresql90/defaultdb/postgresql.conf中的配置值
***extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。查看mkmf.log文件了解更多信息
细节。您可能需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/Users/guy/.rvm/ruby-1.9.2-p136/bin/ruby
--与pg
--无pg
--与pg dir
--没有pg dir
--带pg include=${pg dir}/include
--带pg lib=${pg dir}/lib
--使用pg配置
extconf.rb:24:in``:Exec格式错误-/opt/local/var/db/postgresql90/defaultdb/postgresql.conf--includedir(Errno::ENOEXEC)
来自extconf.rb:24:in`'
有人有什么想法吗? 我很困惑。
盖伊

我想你的问题就在这里:

--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf
--with pg config
开关可能想知道
pg_config
脚本在哪里,而不是在
postgresql.conf
中。您应该在
/opt/local/bin
下的某个地方有一个
pg_config
脚本(可能),它应该会产生一大堆这样的东西:

BINDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/bin
DOCDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/share/doc
HTMLDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/share/doc
INCLUDEDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/include
PKGINCLUDEDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/include
INCLUDEDIR-SERVER = /Users/mu/Developer/Cellar/postgresql/9.0.1/include/server
LIBDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/lib
PKGLIBDIR = /Users/mu/Developer/Cellar/postgresql/9.0.1/lib
...
当你运行它的时候。
pg_config
脚本告诉您(或任何询问的人)各种头文件和库的位置以及需要哪些编译器标志


“Exec format error”错误消息是泄露的消息。这听起来像是你在尝试执行一些操作系统不知道如何执行的东西,我也不希望OSX知道如何执行一些任意的配置文件。

我使用的最简单的修复方法:将/opt/local/lib/postgresql90/bin/添加到$PATH

假设您使用bashshell,然后在~/.bashrc中使用

PATH=/opt/local/lib/postgresql90/bin:$PATH

现在,在Gemfile中有一个简单的行:

宝石“pg”


就行了。

谢谢,这确实是问题所在。