Thoughts and tutorials on programming

Wednesday, May 27, 2009

how to setup a complete mingw msys build environment for ruby (including dependencies)

Here's how: use Luis Lavena's pre built scripts to set it up for you (in this case to set it up for building a complete version of ruby), then tie in to the msys and mgit that it created for you.

steps:

download rubyinstaller's source, git clone git://github.com/oneclick/rubyinstaller.git

then build a version, "any version" of ruby with it, a la

cd rubyinstaller

rake # wait about 30 minutes :)

now set your path to "use" its newly downloaded, loaded with dependencies, versions of mingw and msys, a la build_env.bat contents (in my case):

set PATH=D:\dev\downloads\rubyinstaller\sandbox\mingw\bin;D:\dev\downloads\rubyinstaller\sandbox\msys\bin;D:\dev\downloads\rubyinstaller\sandbox\msys\usr\local\bin;%PATH%

now you can go anywhere and build anything (other versions of ruby, whatever),
example of building ruby trunk:

D:\dev\downloads\ruby_trunk>build_env
D:\dev\downloads\ruby_trunk>sh

Melissa@BLACKY /d/dev/downloads/ruby_trunk
$ autoconf && ./configure && make && make install

much thanks to luis for setting this up, and the mingw/msys team.

4 comments:

MySchizoBuddy said...

the readme only mentions 1.8.6 and 1.9.1, 1.9.2 but no 1.8.7

Roger Pack said...

yeah there's no automated build for 1.8.7 currently. You could hack and crack the code at

http://github.com/oneclick/rubyinstaller/tree/master

for it to do so, but basically windows one click guys are "trying to ignore" 1.8.7
Cheers!
-=r

MySchizoBuddy said...

thanks roger
Can you also check win32-api gem. It isn't installing

$ gem install win32-api
ERROR: Error installing win32-api:
ERROR: Failed to build gem native extension.

c:/Ruby/bin/ruby.exe extconf.rb
checking for strncpy_s()... no
creating Makefile

make
gcc -I. -I. -Ic:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -c win32/api.c
win32/api.c: In function `CallbackFunction':
win32/api.c:566: warning: cast to pointer from integer of different size
win32/api.c: At top level:
win32/api.c:702: error: conflicting types for 'CallbackTable'
win32/api.c:151: error: previous declaration of 'CallbackTable' was here
make: *** [api.o] Error 1

Roger Pack said...

that one looks like a bug in api.c
line 151 should be [][] not just []

To fix:
gem fetch win32-api # edit api.c
cd win32-api\etc
ruby extconf.rb
make
make install
GL.
-=r

Contributors

Followers