我试图在我的系统上安装pg gem(macbook pro运行10.10,Postgresql 9.3.5_1,Ruby 1.9.3p547,Xcode v6.1(6A1052c)):在OSX 10.10上安装pg gem时遇到的麻烦
ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
返回此:
Building native extensions with: '--with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
Using config values from /usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
*** 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
--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/thomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-pg
--without-pg
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from extconf.rb:39:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/thomas/.rvm/gems/ruby-1.9.3-p547/gems/pg-0.17.1 for inspection.
Results logged to /Users/thomas/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/pg-0.17.1/gem_make.out
什么?
我敢肯定,我已经安装了开发工具:
xcode-select --print-path
返回:
/Applications/Xcode.app/Contents/Developer
我mkmf.log文件包含此:
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/x86_64-darwin13.4.0 -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/ruby/backward -I/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1 -I. -I/usr/local/Cellar/postgresql/9.3.5_1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/lib -L/usr/local/Cellar/postgresql/9.3.5_1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
隐而不宣人有关于这里发生了什么的线索?任何帮助将不胜感激!
您的'xcode-select -print-path'命令显示Xcode已安装,但未必安装最新的命令行工具,它们分别安装在不同的软件包中。 'xcode-select --install'可以用来安装它们。如果失败 - “无法安装软件,因为它目前不能从软件更新服务器获得”,那么您必须从Apple开发人员网站手动下载它们。 – 2014-10-20 17:15:12
@SomeDeveloper我已经完成了这个任务(分别安装了10.10命令行工具),但我仍然得到上面的错误: -/ – thomax 2014-10-20 20:08:08
您的mkmf.log文件显示'/ usr/local/opt/gcc46/bin/gcc-4.6' ,它看起来像一个brew或ports安装的编译器。不应该是'/ usr/bin/gcc'吗?可能只是一个路径问题? – 2014-10-20 22:46:10