Ruby on Windows

It’s been a long time since I did anything on Windows… I’m now
trying to help a friend who is having problems.

Who are the current Ruby/Windows gurus, and can someone
possibly assist?

See details below… incl. mkmf.log

Thanks,
Hal F.

D:\Intent\bin>bundle install
Fetching gem metadata from http://rubygems.org/
Using rake (0.9.2.2)
Using bundler (1.1.3)
Using diff-lcs (1.1.3)
Installing ffi (1.0.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension
.

    "C:/Program Files/Ruby192/bin/ruby.exe" extconf.rb

checking for ffi.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=C:/Program Files/Ruby192/bin/ruby
–with-ffi_c-dir
–without-ffi_c-dir
–with-ffi_c-include
–without-ffi_c-include=${ffi_c-dir}/include
–with-ffi_c-lib
–without-ffi_c-lib=${ffi_c-dir}/lib
–with-libffi-config
–without-libffi-config
–with-pkg-config
–without-pkg-config
C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in try_do': The complier fa iled to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in try_cpp’
from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in
block in ha ve_header' from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in block in ch
ecking_for’
from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in
block (2 le vels) in postpone' from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in open’
from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in
block in po stpone' from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in open’
from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in
postpone' from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in checking_fo
r’
from C:/Program Files/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in
have_header ' from extconf.rb:9:in

Gem files will remain installed in C:/Program
Files/Ruby192/lib/ruby/gems/1.9.1/
gems/ffi-1.0.11 for inspection.
Results logged to C:/Program
Files/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/e
xt/ffi_c/gem_make.out
An error occured while installing ffi (1.0.11), and Bundler cannot
continue.
Make sure that gem install ffi -v '1.0.11' succeeds before bundling.

D:\Intent\bin>

================================= mkmf.log
package configuration for libffi is not found
“gcc -o conftest -IC:/Program
Files/Ruby192/include/ruby-1.9.1/i386-mingw32 -I"C:/Program
Files/Ruby192/include/ruby-1.9.1”/ruby/backward -I"C:/Program
Files/Ruby192/include/ruby-1.9.1" -I. -O3 -g -Wextra
-Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings
-Wno-missing-field-initializers -Wno-long-long conftest.c -L.
-LC:/Program Files/Ruby192/lib -L.
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\tk\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\tcl\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\libyaml\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\pdcurses\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\openssl\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\zlib\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\iconv\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\gdbm\lib
-LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\libffi\lib
-lmsvcrt-ruby191-static -lshell32 -lws2_32 "
In file included from C:/Program
Files/Ruby192/include/ruby-1.9.1/ruby.h:32:0,
from conftest.c:1:
C:/Program Files/Ruby192/include/ruby-1.9.1/ruby/ruby.h:25:25: fatal
error: ruby/config.h: No such file or directory
compilation terminated.
gcc: Files/Ruby192/include/ruby-1.9.1/i386-mingw32: No such file or
directory
gcc: Files/Ruby192/lib: No such file or directory
checked program was:
/* begin /
1: #include “ruby.h”
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/
end */

Did you install with RubyInstaller? Do you have DevKit installed?

C:/Program Files/Ruby192/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.

The very first thing you should do is reinstall both Ruby and the DevKit
to a directory without spaces, say c:\Ruby192 and c:\DevKit. Don’t
forget to configure the Devkit and run it’s dk.rb install script.

I’m guessing you’ve already read our wiki pages, but if not, start with
these:

If none of this works, create a detailed gist with more system specifics
and drop a note of what you’re trying to bundler install over at
http://groups.google.com/group/rubyinstaller

Jon

On Wed, Apr 4, 2012 at 7:58 AM, Jon F. [email protected] wrote:

C:/Program Files/Ruby192/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.

The very first thing you should do is reinstall both Ruby and the DevKit
to a directory without spaces, say c:\Ruby192 and c:\DevKit. Don’t
forget to configure the Devkit and run it’s dk.rb install script.

Thanks. He got it working. I think it was the space in the dir name.

Merci,
Hal

Hal F. wrote in post #1055034:

On Wed, Apr 4, 2012 at 7:58 AM, Jon F. [email protected] wrote:

C:/Program Files/Ruby192/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.

The very first thing you should do is reinstall both Ruby and the DevKit
to a directory without spaces, say c:\Ruby192 and c:\DevKit. Don’t
forget to configure the Devkit and run it’s dk.rb install script.

Thanks. He got it working. I think it was the space in the dir name.

Excellent. The MSYS/MinGW based DevKit doesn’t like spacey dirs.

I highly recommend he look into 1.9.3p125. In addition to other
goodies, 1.9.3p125 contains an important fix for a long-standing Windows
1.9 performance regression that affected Windows usability.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/42686

If he feels adventurous, have him check out

http://groups.google.com/group/thecodeshop/browse_thread/thread/f017c5a53fdc8c2f

for 1.9.3 edge builds containing both Windows-specific and
multi-platform experimental performance enhancements.

Jon