过时的故事(在下一个标题下找到更新)

过时的故事(在下一个标题下找到更新)

过时的故事(在下一个标题下找到更新)

我找不到为什么wdm无法在我的计算机上安装。我尝试使用 Cygwin bash、Windows cmd 和 GIT bash。

控制台输出:

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

    c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20151202-6644-1ws9slg.rb extconf.rb
checking for main() in -lkernel32... *** 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=c:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
        --with-kernel32lib
        --without-kernel32lib
c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to gen
erate an executable file. (RuntimeError)
You have to install development tools first.
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library'

        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'

        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in po
stpone'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
        from c:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:961:in `have_library'
        from extconf.rb:19:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wdm-0.
1.1 for inspection.
Results logged to c:/Ruby22-x6

日志

"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby22-x64/include/ruby-2.2.0/x64-mingw32 -Ic:/Ruby22-x64/include/ruby-2.2.0/ruby/backward -Ic:/Ruby22-x64/include/ruby-2.2.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat conftest.c  -L. -Lc:/Ruby22-x64/lib -L.      -lx64-msvcrt-ruby220  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

更新 1

虽然我有一个赛格威环境海湾合作委员会运行时,包含“您必须先安装开发工具”这句话遵循专业提示。更准确地说,我缺少x86_64-w64-mingw32-gcc编译器。我下载了SourceForge 的安装程序(安装程序下载链接位于文件列表上方)并成功在第二次尝试时安装它(第一次尝试失败,下载失败消息;它似乎是随机的)。

但是,它仍然不起作用。

控制台输出:

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

还有控制台输出,但这也是的内容gem_make.out

c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20151204-42084-zsi0td.rb extconf.rb
checking for main() in -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
checking for rb_thread_call_without_gvl()... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating wdm_ext-x64-mingw32.def
/bin/sh: /c/Ruby22-x64/bin/ruby: No such file or directory
Makefile:260: recipe for target 'wdm_ext-x64-mingw32.def' failed
make: *** [wdm_ext-x64-mingw32.def] Error 127

make failed, exit code 2

进一步的控制台输出:

Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/wdm-0.
1.1 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/wdm-0.1.1/gem_make.out

这句话/bin/sh: /c/Ruby22-x64/bin/ruby: No such file or directory让我很困惑。这三种 shell 都出现了这种情况,赛格威GIT 狂欢命令。 在里面GIT 狂欢我可以/c/Ruby22-x64/bin/ruby手动解析路径。它存在并且有效。并且也which ruby指向右侧ruby

答案1

  1. 打开命令提示符并运行:
    ridk install 
    
  2. 选择选项 3 MSYS2 and MINGW development tool chain。这是安装带有原生扩展的 gem 所必需的。您可以在RubyInstaller 文档
  3. 从开始菜单打开一个新的命令提示符窗口,以便对PATH环境变量的更改生效。

背景

我的情况类似。我试图运行bundle update,但遇到了同样的wdm问题。

  • Ruby 版本:3.2.3
  • 操作系统:Windows 10 Pro 22H2

相关内容