2

Outdated Story (find the update below the next heading)

I can't find out why wdm won't install on my computer. I have tried using the Cygwin bash, Windows cmd and GIT bash.

Console output:

$ 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

mkmf.log:

"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 */

Update 1

Although I have a Cygwin environment with gcc running, the sentence “You have to install development tools first” contained the pro tip to follow. To be more precise I lacked the x86_64-w64-mingw32-gcc compiler. I downloaded the installer from SourceForge (link to the installer download is above the file list) and managed to install it on the second try (the first try failed with a download failed message; it appears to be random).

However, it still doesn't work.

Console output:

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

Also console output, but this is the content of the gem_make.out as well:

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

Further console output:

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

The line /bin/sh: /c/Ruby22-x64/bin/ruby: No such file or directory confuses me. This happens in all three shells, Cygwin, GIT Bash as well as CMD. In the GIT Bash I'm able to resolve the path /c/Ruby22-x64/bin/ruby manually. It exists and works. Also which ruby points to the right ruby as well.

1 Answer 1

0
  1. Open command prompt and run:
    ridk install 
    
  2. Select option 3 MSYS2 and MINGW development tool chain. his is needed for installing gems with native extensions. You can find additional information regarding this in the RubyInstaller Documentation.
  3. Open a new command prompt window from the start menu, so that changes to the PATH environment variable becomes effective.

Background

My case was similar. I was attempting to run bundle update but ran in to the same wdm issue.

  • Ruby version: 3.2.3
  • OS: Windows 10 Pro 22H2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .