3

我已经通过安装程序安装了 Ruby200-x64,并通过自提取器安装了 DevKit,并且ruby dk.rb install

C:\Ruby200-x64\devkit>ruby dk.rb init
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

然后我添加- C:\Ruby200-x64config.yml

C:\Ruby200-x64\devkit>type config.yml
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- C:\Ruby200-x64

C:\Ruby200-x64\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby200-x64'
[INFO] Installing 'C:/Ruby200-x64/lib/ruby/site_ruby/devkit.rb'

然后我安装了捆绑器:

C:\Ruby200-x64\devkit>gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
Parsing documentation for bundler-1.3.5
Installing ri documentation for bundler-1.3.5
1 gem installed

然后我bundle install用这个 Gemfile 尝试了一些应用程序:

if RUBY_PLATFORM.downcase.include?("mswin") || RUBY_PLATFORM.downcase.include?("mingw")
  gem "win32console"
end

gem "eventmachine", "1.0.3"
gem "thin"
gem "sinatra", "1.4.2"
gem "rack", "1.5.2"
gem "em-websocket", "~> 0.3.6"
gem "jsmin", "~> 1.0.1"
gem "ansi"
gem "term-ansicolor", :require => "term/ansicolor"
gem "dm-core"
gem "json"
gem "data_objects"
gem "dm-sqlite-adapter"
gem "parseconfig"
gem "erubis"
gem "dm-migrations"
gem "msfrpc-client"

# notifications
gem "twitter"
source "http://rubygems.org"

没有任何错误,但没有eventmachine

G:\Distrs\someapp>bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Installing addressable (2.3.5)
Installing ansi (1.4.3)
Installing daemons (1.1.9)
Installing data_objects (0.10.13)
Installing dm-core (1.2.1)
Installing dm-do-adapter (1.2.0)
Installing dm-migrations (1.2.0)
Installing dm-sqlite-adapter (1.2.0)
Installing em-websocket (0.3.8)
Installing erubis (2.7.0)
Installing multipart-post (1.2.0)
Installing faraday (0.8.8)
Installing jsmin (1.0.1)
Installing json (1.8.1)
Installing librex (0.0.68)
Installing msgpack (0.5.6)
Installing msfrpc-client (1.0.1)
Installing multi_json (1.8.2)
Installing parseconfig (1.0.2)
Installing rack (1.5.2)
Installing rack-protection (1.5.1)
Installing simple_oauth (0.2.0)
Installing tilt (1.4.1)
Installing sinatra (1.4.2)
Installing tins (0.13.1)
Installing term-ansicolor (1.2.2)
Installing thin (1.6.1)
Installing twitter (4.8.1)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    addressable (2.3.5)
    ansi (1.4.3)
    daemons (1.1.9)
    data_objects (0.10.13)
      addressable (~> 2.1)
    dm-core (1.2.1)
      addressable (~> 2.3)
    dm-do-adapter (1.2.0)
      data_objects (~> 0.10.6)
      dm-core (~> 1.2.0)
    dm-migrations (1.2.0)
      dm-core (~> 1.2.0)
    dm-sqlite-adapter (1.2.0)
      dm-do-adapter (~> 1.2.0)
      do_sqlite3 (~> 0.10.6)
    do_sqlite3 (0.10.13-x86-mingw32)
      data_objects (= 0.10.13)
    em-websocket (0.3.8)
      addressable (>= 2.1.1)
      eventmachine (>= 0.12.9)
    erubis (2.7.0)
    eventmachine (1.0.3-x86-mingw32)
    faraday (0.8.8)
      multipart-post (~> 1.2.0)
    jsmin (1.0.1)
    json (1.8.1)
    librex (0.0.68)
    msfrpc-client (1.0.1)
      librex (>= 0.0.32)
      msgpack (>= 0.4.5)
    msgpack (0.5.6)
    multi_json (1.8.2)
    multipart-post (1.2.0)
    parseconfig (1.0.2)
    rack (1.5.2)
    rack-protection (1.5.1)
      rack
    simple_oauth (0.2.0)
    sinatra (1.4.2)
      rack (~> 1.5, >= 1.5.2)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    term-ansicolor (1.2.2)
      tins (~> 0.8)
    thin (1.6.1)
      daemons (>= 1.0.9)
      eventmachine (>= 1.0.0)
      rack (>= 1.0.0)
    tilt (1.4.1)
    tins (0.13.1)
    twitter (4.8.1)
      faraday (~> 0.8, < 0.10)
      multi_json (~> 1.0)
      simple_oauth (~> 0.2)
    win32console (1.3.2-x86-mingw32)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  ansi
  data_objects
  dm-core
  dm-migrations
  dm-sqlite-adapter
  em-websocket (~> 0.3.6)
  erubis
  eventmachine (= 1.0.3)
  jsmin (~> 1.0.1)
  json
  msfrpc-client
  parseconfig
  rack (= 1.5.2)
  sinatra (= 1.4.2)
  term-ansicolor
  thin
  twitter
  win32console

没有安装事件机器:

G:\Distrs\someapp>gem list

*** LOCAL GEMS ***

addressable (2.3.5)
ansi (1.4.3)
bigdecimal (1.2.0)
bundler (1.3.5)
daemons (1.1.9)
data_objects (0.10.13)
dm-core (1.2.1)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-sqlite-adapter (1.2.0)
em-websocket (0.3.8)
erubis (2.7.0)
faraday (0.8.8)
io-console (0.4.2)
jsmin (1.0.1)
json (1.8.1, 1.7.7)
librex (0.0.68)
minitest (4.3.2)
msfrpc-client (1.0.1)
msgpack (0.5.6)
multi_json (1.8.2)
multipart-post (1.2.0)
parseconfig (1.0.2)
psych (2.0.0)
rack (1.5.2)
rack-protection (1.5.1)
rake (0.9.6)
rdoc (4.0.0)
simple_oauth (0.2.0)
sinatra (1.4.2)
term-ansicolor (1.2.2)
test-unit (2.0.0.0)
thin (1.6.1)
tilt (1.4.1)
tins (0.13.1)
twitter (4.8.1)

尝试运行一些应用程序:

G:\Distrs\someapp>ruby someapp
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thin-1.6.1/lib/thin.rb:7:in `require': cannot load such file -- eventmachine (LoadError)
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thin-1.6.1/lib/thin.rb:7:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
        from G:/Distrs/someapp/core/loader.rb:10:in `<top (required)>'

        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from someapp:32:in `<main>'

好的,尝试通过以下方式安装 eventmachine gem install eventmachine

G:\Distrs\someapp>gem install eventmachine
Fetching: eventmachine-1.0.3.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
        ERROR: Failed to build gem native extension.

    C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -lssl... no
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
creating Makefile

make "DESTDIR="
generating rubyeventmachine-x64-mingw32.def
compiling binder.cpp
In file included from c:\ruby200-x64\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/process.h:12:0,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/win32.h:60,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/defines.h:153,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/ruby.h:70,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby.h:33,
                 from em.h:24,
                 from project.h:150,
                 from binder.cpp:20:
c:\ruby200-x64\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/sys/types.h:68:16: error: conflicting declaration 'typedef _pid_t pid_t'
In file included from binder.cpp:20:0:project.h:97:13: error: 'pid_t' has a previous declaration as 'typedef int pid_t'
In file included from project.h:151:0,
                 from binder.cpp:20:
ed.h: In member function 'void EventableDescriptor::SetSocketInvalid()':
ed.h:43:40: warning: overflow in implicit constant conversion [-Woverflow]
make: *** [binder.o] Error 1


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/ext/gem_make.out

好的,Eventmachine gem install 的以下安装过程失败(安装开始时注释 97 行//typedef int pid_t;):

G:\Distrs\someapp>gem install eventmachine
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.0.3
Parsing documentation for eventmachine-1.0.3
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/fastfilereaderext.so,
skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/rubyeventmachine.so, s
kipping
Installing ri documentation for eventmachine-1.0.3
1 gem installed

现在测试它是否已安装

G:\Distrs\someapp>gem list

*** LOCAL GEMS ***

addressable (2.3.5)
ansi (1.4.3)
bigdecimal (1.2.0)
bundler (1.3.5)
daemons (1.1.9)
data_objects (0.10.13)
dm-core (1.2.1)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-sqlite-adapter (1.2.0)
em-websocket (0.3.8)
erubis (2.7.0)
eventmachine (1.0.3)
faraday (0.8.8)
io-console (0.4.2)
jsmin (1.0.1)
json (1.8.1, 1.7.7)
librex (0.0.68)
minitest (4.3.2)
msfrpc-client (1.0.1)
msgpack (0.5.6)
multi_json (1.8.2)
multipart-post (1.2.0)
parseconfig (1.0.2)
psych (2.0.0)
rack (1.5.2)
rack-protection (1.5.1)
rake (0.9.6)
rdoc (4.0.0)
simple_oauth (0.2.0)
sinatra (1.4.2)
term-ansicolor (1.2.2)
test-unit (2.0.0.0)
thin (1.6.1)
tilt (1.4.1)
tins (0.13.1)
twitter (4.8.1)

不好了!不会再来了!

G:\Distrs\someapp>ruby someapp
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thin-1.6.1/lib/thin.rb:7:in `require': c
annot load such file -- eventmachine (LoadError)
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thin-1.6.1/lib/thin.rb:7:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
        from G:/Distrs/someapp/core/loader.rb:10:in `<top (required)>'

        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from someapp:32:in `<main>'

任何帮助请:(

4

1 回答 1

0

请尝试安装最新的预发布版本 ( gem install --pre bundler),如果这能解决您的问题,请告诉我们。对 master 的支持x64-mingw32已添加到 master 但不在 1.3.5 中。

https://github.com/bundler/bundler/pull/2590

于 2013-11-12T20:51:37.403 回答