我正在尝试使用rvm和 ruby 2.0-p195在 MacOSX Mountain Lion (10.8) 上安装 ruby 的msgpack 。
这是错误:
~ » gem install msgpack atma@greyjewel
Building native extensions. This could take a while...
ERROR: Error installing msgpack:
ERROR: Failed to build gem native extension.
/Users/atma/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
checking for ruby/st.h... *** 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/atma/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
/Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:562:in `try_cpp'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:1041:in `block in have_header'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:892:in `block in checking_for'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels) in postpone'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpone'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:307:in `open'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
from /Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:1040:in `have_header'
from extconf.rb:3:in `<main>'
Gem files will remain installed in /Users/atma/.rvm/gems/ruby-2.0.0-p195/gems/msgpack-0.5.5 for inspection.
Results logged to /Users/atma/.rvm/gems/ruby-2.0.0-p195/gems/msgpack-0.5.5/ext/msgpack/gem_make.out
~ »
我尝试指定ARCHFLAGS=-arch x86_64
使用env
变量,但现在没有任何效果。我暂时没有想法。
此致,
谢谢
附言。这是mkfm.log
:
"/opt/local/bin/gcc-apple-4.2 -o conftest -I/Users/atma/.rvm/rubies/ruby-2.0.0-p195/include/ruby-2.0.0/x86_64-darwin12.3.0 -I/Users/atma/.rvm/rubies/ruby-2.0.0-p195/include/ruby-2.0.0/ruby/backward -I/Users/atma/.rvm/rubies/ruby-2.0.0-p195/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/atma/.rvm/rubies/ruby-2.0.0-p195/lib -L/opt/local/lib -L. -fstack-protector -L/usr/local/lib -L/opt/local/lib -lruby.2.0.0 -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 */