2013-02-19 124 views
1

当我运行包时,或者当我尝试单独安装时,无法安装pg gem。我得到的错误是:“无法创建Makefile。”我正在运行Mountain Lion,安装了Xcode并安装了命令行工具。我也通过自制软件安装了Postregsql。由于某种原因无法创建Makefile

我相信这个错误是因为我无法创建makefile,这已经浮现为阻止我做其他事情的错误。

我得到的完整错误如下。

此错误发生在捆绑过程中。其他宝石安装罚款,或者被标记为使用,那么这个错误而终止installing pg (0.14.1) with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for pg_config... yes 
Using config values from /usr/bin/pg_config 
checking for libpq-fe.h... yes 
checking for libpq/libpq-fs.h... yes 
checking for pg_config_manual.h... yes 
checking for PQconnectdb() in -lpq... no 
checking for PQconnectdb() in -llibpq... no 
checking for PQconnectdb() in -lms/libpq... no 
Can't find the PostgreSQL client library (libpq) 
*** 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/1.8/usr/bin/ruby 
--with-pg 
--without-pg 
--with-pg-dir 
--without-pg-dir 
--with-pg-include 
--without-pg-include=${pg-dir}/include 
--with-pg-lib 
--without-pg-lib=${pg-dir}/lib 
--with-pg-config 
--without-pg-config 
--with-pg_config 
--without-pg_config 
--with-pqlib 
--without-pqlib 
--with-libpqlib 
--without-libpqlib 
--with-ms/libpqlib 
--without-ms/libpqlib 


Gem files will remain installed in /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1 for inspection. 
Results logged to /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1/ext/gem_make.out 
An error occurred while installing pg (0.14.1), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling. 

我真的在为这里做什么损失的包。我一直在为此工作两天。

编辑:

所以试图找到执行解决方案的路径当基督教拉普建议我发现了这个建议:sudo env ARCHFLAGS="-arch x86_64" gem install pg其合作,安装了皮克。不幸的是,当我尝试运行rails srake db:create:allrake db:migrate时,我遇到了错误。我将创建一个单独的问题追查这些问题了下来...

+0

可能重复的[安装红宝石时无法创建Makefile](http://stackoverflow.com/questions/14950787/could-not-create-makefile-when-installing-ruby-gems) – 2013-02-21 23:13:06

回答

2

我没有在MacOS上使用自制软件,但它在哪里安装libpq? MacPorts使用/ opt并且您的配置脚本不知道任何关于此的信息。该错误信息是相当有价值的信息只是提供一些路径类似

创业板安装PG - --with-libpqlib = /选择/ ...

可能是你必须使用另一个标志提供必要的信息

+0

对不起,你能更清楚些吗?所以我运行bundle --with-libpqlib =/opt /? – Arel 2013-02-19 18:22:33

+0

我编辑了我的答案,但首先你必须找出自制软件将你安装的软件包放在哪里。这是你必须提供的路径 – 2013-02-19 18:30:00

+0

好的,谢谢你的帮助!我会回来的,我的结果! – Arel 2013-02-19 18:30:48

2

的错误是这样的:

找不到PostgreSQL客户端库(libpq的)

你需要安装PostreSQL(我推荐使用Homebrew,但可能还有其他可用下载)并尝试再次安装该gem。

+0

我已经安装了postregsql用自制软件并得到了同样的错误。我能够看到安装了自制软件,但无法启动它,因为我没有安装gem,所以无法创建数据库。 – Arel 2013-02-19 18:20:52

1

“无法找到PostgreSQL客户端库(libpq的)”

这是你的makefile不能创建的原因。您的路径中找不到您的Postgres库,特别是libpq。我看到你安装了Homebrew。我不使用自制软件,所以我不知道它是否为你设定了路径。

+0

你能告诉我如何解决这个问题吗?我对命令行非常陌生,所以我不知道如何使它成为可以在我的路径上找到的libpq? – Arel 2013-02-19 18:26:01

相关问题