view · edit · sidebar · attach · print · history

Trying to create Ruby-p369-1.8.6-Oniguruma.exe on Windows Vista


 * Extract ruby .tar package into a clean directory (called it C:\Source-Ruby)
 * Extract onigumura somehere (call it C:\onigumura)
 * Download patch.exe and place it somewhere in the PATH
 * Inside RubyInstaller, invoke rake devkit:sh
 * rake ruby18:dependencies devkit:sh (do this in your rubyinstaller directory on your windows machine)
 * cd to /c/onigumura
 * ./configure and point to /c/Source-Ruby
 * make 186 (will copy the files but will not apply the patch)
 * exit
 * Apply the patch in normal windows Terminal
 * patch < ../oniguruma/ruby186.patch
 * rd sandbox /s/q
 * rake ruby18 dkver=mingw-32-3.4.5 local="C:\build\ruby\ruby-1.8.6-p369"  

from the discussion with Luis Lavena

configure results in

sh-3.1$ make 186
cp -p ../ruby-1.8.6-p369/regex.c    ../ruby-1.8.6-p369/regex.c.ruby_orig
cp -p ../ruby-1.8.6-p369/regex.h    ../ruby-1.8.6-p369/regex.h.ruby_orig
cp -p ../ruby-1.8.6-p369/re.h       ../ruby-1.8.6-p369/re.h.ruby_orig
cp -p ../ruby-1.8.6-p369/re.c       ../ruby-1.8.6-p369/re.c.ruby_orig
cp -p ../ruby-1.8.6-p369/gc.c       ../ruby-1.8.6-p369/gc.c.ruby_orig
cp -p ../ruby-1.8.6-p369/string.c   ../ruby-1.8.6-p369/string.c.ruby_orig
cp -p ./regex.c     ../ruby-1.8.6-p369
cp -p ./regerror.c  ../ruby-1.8.6-p369
cp -p ./regparse.c  ../ruby-1.8.6-p369
cp -p ./regcomp.c   ../ruby-1.8.6-p369
cp -p ./regexec.c   ../ruby-1.8.6-p369
cp -p ./reggnu.c    ../ruby-1.8.6-p369
cp -p ./regenc.c    ../ruby-1.8.6-p369
cp -p ./regint.h    ../ruby-1.8.6-p369
cp -p ./regparse.h  ../ruby-1.8.6-p369
cp -p ./regenc.h    ../ruby-1.8.6-p369
cp -p ./oniguruma.h ../ruby-1.8.6-p369
cp -p ./oniggnu.h   ../ruby-1.8.6-p369/regex.h
test -d ../ruby-1.8.6-p369/enc || mkdir ../ruby-1.8.6-p369/enc
cp -p ./enc/ascii.c  ../ruby-1.8.6-p369/enc/ascii.c
cp -p ./enc/utf8.c   ../ruby-1.8.6-p369/enc/utf8.c
cp -p ./enc/euc_jp.c ../ruby-1.8.6-p369/enc/euc_jp.c
cp -p ./enc/sjis.c   ../ruby-1.8.6-p369/enc/sjis.c
patch -d ../ruby-1.8.6-p369 -p0 < ./ruby186.patch

and exits with an error

 0 [main] patch 204 open_stackdumpfile: Dumping stack trace to patch.exe.stackdump
 make: *** [186] Error 5

so I am applying the patch in normals windows command terminal with the gnu-patch utility installed:

 C:\build\ruby\ruby-1.8.6-p369>patch < ../oniguruma/ruby186.patch
 patching file `gc.c'
 patching file `re.h'
 patching file `re.c'
 patching file `string.c'

that seems to work just fine and the outcome is the same as on Linux:

Steps in the Labyrinth

You will need these tools (ispack and isetup) to create the One-Click-Installer in the end

I installed


A good way to start


 git clone git://

delete the complete directory if you fooled around before

 rmdir /S rubyinstaller (this also works: rd rubyinstaller /s/q)

get your checkout settings for git correct

        editor = c:/vim/vim73/gvim.exe
        autocrlf = false
        ui = auto
        default = current 

and then do

 rake ruby18 COMPAT=1

to see if everything compiles correctly.

 Question: Is there a way of telling windows to use all my 8 CPUs?
 Answer: I have not idea. Not yet.

plain compilation still has her problems

 make[1]: Entering directory `/c/Users/zdavatz/software/rubyinstaller/sandbox/ruby18_build/ext/socket'
  gcc -I. -I../.. -I../../../ruby_1_8 -I../../../ruby_1_8/ext/socket -DHAVE_SOCKADDR_STORAGE -DHAVE_INET_NTOA -DHAVE_GETSERVBYPORT -Dsocklen_t=int -DHAVE_WSACLEANUP -DHAVE_GET
 HOSTNAME -I.   -g -O2 -DFD_SETSIZE=256   -c ../../../ruby_1_8/ext/socket/socket.c
 In file included from ../../../ruby_1_8/win32/win32.h:30:0,
                 from ../../../ruby_1_8/defines.h:183,
                 from ../../../ruby_1_8/ruby.h:37,
                 from ../../../ruby_1_8/ext/socket/socket.c:13:
 error: two or more data types in declaration
 make[1]: *** [socket.o] Error 1
 make[1]: Leaving directory `/c/Users/zdavatz/software/rubyinstaller/sandbox/ruby18_build/ext/socket'
 make: *** [all] Error 1
 rake aborted!
 Command failed with status (2): [make...]
 C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
 C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'

this seems to be related


 Ruby 1.8.6 is not compatible with our GCC 4.5.1, you need GCC 3.4.5. 

Ok, I must do

 rd sandbox /s/q 
 rake devkit DKVER=mingw-32-3.4.5 
 rake ruby18 COMPAT=1

this is what you do when the summary worked just fine: It should compile your patched ruby Version with the mingw compiler that comes with the RubyInstaller (after git clone) after running the rake command rake devkit DKVER=mingw-32-3.4.5 - that put the mingw compiler in your sandbox directory.

 rake ruby18 dkver=mingw-32-3.4.5 local="C:\build\ruby\ruby-1.8.6-p369"

the patching commands for Linux-Oniguruma are (just for reference to understand the process better)

Permission Denied Errors while compiling on Windows come from your Anti-Virus-Software

 installing command scripts
 installing library scripts
 installing headers
 installing manpages
 installing extension objects
 installing extension scripts
 cd - 
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/gdbm/bin/dbm3.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/gdbm/bin/gdbm3.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/iconv/bin/libiconv2.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/openssl/bin/libeay32-0.9.8-msvcrt.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/openssl/bin/ssleay32-0.9.8-msvcrt.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/pdcurses/bin/pdcurses.dll sandbox/ruby18_mingw/bin
 cp C:/Users/zdavatz/software/rubyinstaller/sandbox/zlib/bin/zlib1.dll sandbox/ruby18_mingw/bin
 cp sandbox/ruby_1_8/bin/erb sandbox/ruby18_mingw/bin
 cp sandbox/ruby_1_8/bin/irb sandbox/ruby18_mingw/bin
 cp sandbox/ruby_1_8/bin/rdoc sandbox/ruby18_mingw/bin
 cp sandbox/ruby_1_8/bin/ri sandbox/ruby18_mingw/bin
 cp sandbox/ruby_1_8/bin/testrb sandbox/ruby18_mingw/bin
 "C:/Users/zdavatz/software/rubyinstaller/sandbox/extract_utils/basic-bsdtar.exe" -xf "C:/Users/zdavatz/softwar/rubyinstaller/downloads/rubygems-1.3.7.tgz" > NUL 2>&1
 rake aborted!
 Permission denied - sandbox/rubygems/rubygems-1.3.7/test or sandbox/rubygems/test
 (See full trace by running task with --trace)

Permission denied errors

 Permission issues happen when you have antivirus software running or a
 Windows explorer monitoring that folder (or any open editor or program
 that might be locking the tree)

Install wget for windows to pull the patch directly into the directory

The oniguruma Patch we use for Linux is here

The patch may need some help with his line endings

The plain patch for Linux is (but if you look at the Makefile there are more files that are copied, that is why you need to run ./configure first - see these steps for Linux


the history of the patch

Recipes RubyInstaller

If you want to fool with the recipes of RubyInstaller - I do not yet understand them.


has two rake files. One can patch the other can't

 ruby18.rake does not have patch arguments
 ruby19.rake has patch arguments

Ok, from line 72 I added this:

 patches = Dir.glob("#{package.patches}/*.patch").sort
 patches.each do |patch|
   sh "git apply --directory #{} #{patch}"



Simple Ruby 1.8.6 install with gcc 3.4.5

 rd sandbox /s/q 
 rake devkit DKVER=mingw-32-3.4.5 
 rake ruby18 COMPAT=1

Steps that resulted in the above summary

Jon recommends to try this

Jon's steps seem to have worked but I applied and empty patch ;) so actually they only half-worked ;/

 cd C:\build\ruby\ruby-1.8.6-p369 
 patch < ../oniguruma/ruby186.patch (the same patch-file I use for Linux) 

I did not get any output, but I assume the patch was applied, as I also did not get any errors. Should I get any output from patch on Windows if I apply a patch as above?

 cd C:\Users\zdavatz\software\rubyinstaller
 rake ruby18 dkver=mingw-32-3.4.5 local="C:\build\ruby\ruby-1.8.6-p369" 


Luis Lavena recommends to try this

but that did not seem to work

How to patch on Linux

External Help

I am also asking the Ruby-Dev people for some help:
view · edit · sidebar · attach · print · history
Page last modified on January 10, 2011, at 09:03 AM