开发者

How to install EventMachine on Mac OSX Snow Leopard

开发者 https://www.devze.com 2023-03-11 13:10 出处:网络
I searched for this issue and kept finding resources related to a PC. Every time I try to installEventMachine I get this error:

I searched for this issue and kept finding resources related to a PC.

Every time I try to install EventMachine I get this error:

Building native extensions.  This
could take a while... ERROR:  Error
installing eventmachine:  ERROR:
Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for rb_trap_immediate in
ruby.h,rubysig.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  --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=/usr/local/bin/ruby
/usr/local/lib/ruby/1.9.1/mkmf.rb:368:in
`try_do': The complier failed to
generate an executable file.
(RuntimeError) You have to install
development tools first.  from
/usr/local/lib/ruby/1.9.1/mkmf开发者_如何学编程.rb:446:in
`try_compile'     from
/usr/local/lib/ruby/1.9.1/mkmf.rb:568:in
`try_var'     from
/usr/local/lib/ruby/1.9.1/mkmf.rb:816:in
`block in have_var'   from
/usr/local/lib/ruby/1.9.1/mkmf.rb:693:in
`block in checking_for'   from
/usr/local/lib/ruby/1.9.1/mkmf.rb:280:in
`block (2 levels) in postpone'    from
/usr/local/lib/ruby/1.9.1/mkmf.rb:254:in
`open'    from
/usr/local/lib/ruby/1.9.1/mkmf.rb:280:in
`block in postpone'   from
/usr/local/lib/ruby/1.9.1/mkmf.rb:254:in
`open'    from
/usr/local/lib/ruby/1.9.1/mkmf.rb:276:in
`postpone'    from
/usr/local/lib/ruby/1.9.1/mkmf.rb:692:in
`checking_for'    from
/usr/local/lib/ruby/1.9.1/mkmf.rb:815:in
`have_var'    from extconf.rb:16:in
`<main>'


Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10
for inspection. Results logged to
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out

It seems to break while building C extensions. I've tried various solutions like "Mac OS X Leopard installing the ruby gem eventmachine" but had no luck.


You will need to have XCode 3.2 or 4 installed in order for extensions like this to compile. The XCode package is an optional install and comes on either the main install DVD for a retail package of the OS or as a supplemental disc with a new system.

You can download it from the App Store for 10.7 or later.


Your problem might be because you haven't installed the Developer Tools for Xcode 4.2/4.3.

With Xcode 4.2.x and 4.3.x, you need to install the command-line tools separately by:

  1. Launching Xcode, then opening the "Preferences" menu from the "Xcode" menu on the menu bar.
  2. Select the "Downloads" tab (icon).
  3. Click the "Install" button for "Command Line Tools".

If correctly installed, then running cc --version should output:

% cc --version

    Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
    Target: x86_64-apple-darwin11.3.0
    Thread model: posix

Or if you are using Ruby 1.9.3, there are known issues with EventMachine. See http://isitruby19.com/eventmachine. I suggest you downgrade to 1.9.2 for projects needing EventMachine using RVM or rbenv.


The solution here worked for me. I just had to install command line tools from https://developer.apple.com/downloads/index.action

See "getting eventmachine gem to compile on OSX Lion 10.8.2 with xcode 4.5.1" for more information.


I had the same problem. Opening up the mkmf.log file and running the command narrowed down the problem to the gmp library. The gmp library was in a different directory and LD_LIBRARY_PATH was not set.

I set LD_LIBRARY_PATH to the location gmp was in and then it installed properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消