[Rubyinstaller-devel] musings

Joao Pedrosa joaopedrosa at gmail.com
Mon Jan 26 15:40:01 EST 2009


Hi,

> A question:
>
> with 187p72 build I get
> 01/21/2009  04:41 PM        17,290,874 libmsvcrt-ruby18-static.a
> which is a rather large file--I'd guess that's expected? [and with 1.9
> it's something like 30MB].
> ?

I just spent the last few days fiddling with Ruby compilation on Windows,
and these are the latest numbers I get with compiling the latest versions
of Ruby found in the SVN repositories:

A) Built with MinGW and GCC 4, including openssl, iconv, zlib, readline:

C:\>dir C:\opt\mingw_ruby-1.8.6\lib\libmsvcrt-ruby18-static.a
25/01/2009  23:59         2.594.308 libmsvcrt-ruby18-static.a

C:\>dir C:\opt\mingw_ruby-1.8.7\lib\libmsvcrt-ruby18-static.a
26/01/2009  00:20         2.735.214 libmsvcrt-ruby18-static.a

C:\>dir C:\opt\mingw_ruby-1.9.1\lib\libmsvcrt-ruby191-static.a
26/01/2009  00:33         5.097.338 libmsvcrt-ruby191-static.a

C:\>dir C:\opt\mingw_ruby-1.9.2\lib\libmsvcrt-ruby191-static.a
26/01/2009  01:00         5.131.112 libmsvcrt-ruby191-static.a

B) Built with VS C++ 2008, including openssl, iconv, zlib (no readline):

C:\>dir C:\opt\ruby-1.8.6\lib\msvcr90-ruby18-static.lib
26/01/2009  16:20         2.155.482 msvcr90-ruby18-static.lib

C:\>dir C:\opt\ruby-1.8.7\lib\msvcr90-ruby18-static.lib
26/01/2009  16:47         2.155.482 msvcr90-ruby18-static.lib


That's just for comparison purposes, I'd guess. :-)

To install my MinGW environment I followed the instructions found at
http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite

I use MSYS which has a HOWTO tutorial linked to from the MinGW one.

Plus, I downloaded any missing binaries from http://gnuwin32.sourceforge.net/

The files I installed include:

C:\>dir safe_or_not\programming\mingw

29/11/2008  04:29         8.944.043 binutils-2.19-mingw32-rc1-bin.tar.gz
29/11/2008  04:32        54.186.135 gcc-4.3.0-20080502-mingw32-alpha-bin.7z
29/11/2008  04:22         6.677.497
gcc-part-c++-4.3.0-20080502-2-mingw32-alpha-bin.tar.gz
29/11/2008  04:22         8.077.458
gcc-part-core-4.3.0-20080502-2-mingw32-alpha-bin.tar.gz
29/11/2008  04:28           560.294 mingwrt-3.15.1-mingw32.tar.gz
29/11/2008  04:30         1.643.172 w32api-3.12-mingw32-dev.tar.gz

C:\>dir safe_or_not\programming\mingw\msys

29/11/2008  06:50         1.195.259 autoconf-2.63.tar.bz2
29/11/2008  06:50           936.322 automake-1.10.2.tar.bz2
29/11/2008  06:09           543.655 bash-3.1-MSYS-1.0.11-1.tar.bz2
29/11/2008  06:12           832.147 coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
29/11/2008  06:51        13.137.920 libtool-2.2.6a.tar.gz
29/11/2008  06:13            89.315 lzma-4.43-MSYS-1.0.11-1-bin.tar.gz
29/11/2008  06:56           134.927 m4-1.4.7-MSYS.tar.bz2
29/11/2008  05:24         2.808.061 MSYS-1.0.10.exe
29/11/2008  05:44         1.935.914 msysCORE-1.0.11-2007.01.19-1.tar.bz2
29/11/2008  05:38        10.299.560 msysDTK-1.0.1.exe

C:\>dir safe_or_not\programming\mingw\gnuwin32

30/11/2008  00:20           585.372 bison-2.1-bin.zip
30/11/2008  01:26           708.206 bison-2.1-dep.zip
01/12/2008  02:47            49.414 byacc-1.9-1-bin.zip
30/11/2008  02:24           262.813 sed-4.1.5-bin.zip
30/11/2008  02:24           708.206 sed-4.1.5-dep.zip

C:\>dir safe_or_not\pogramming\mingw\gnuwin32\libs

25/01/2009  13:56            25.917 crypt-2.2.5-bin.zip
25/01/2009  01:48            19.846 crypt-2.2.5-lib.zip
25/01/2009  21:51           828.380 libiconv-1.9.2-1-bin.zip
25/01/2009  21:50            50.981 libiconv-1.9.2-1-dep.zip
25/01/2009  21:51           731.496 libiconv-1.9.2-1-lib.zip
14/01/2009  12:03         5.906.403 openssl-0.9.8h-1-bin.zip
14/01/2009  12:02         1.287.741 openssl-0.9.8h-1-lib.zip
14/01/2009  12:00           443.791 readline-5.0-1-bin.zip
14/01/2009  12:01           233.419 readline-5.0-1-lib.zip
25/01/2009  13:34            99.777 zlib-1.2.3-bin.zip
25/01/2009  01:20            71.569 zlib-1.2.3-lib.zip


Some of the library files I share between VS C++ 2008 and MinGW,
but the MinGW ones I tend to copy to the c:\mingw directory, in
order for libs, headers to be easily found. MSYS includes the
"sed" command already so skip installing it for MinGW, otherwise
it can result in an error of conflict.

But "sed" might be needed for VS C++ 2008 compilation, alongside
Bison or YACC depending on the Ruby version (1.8, 1.9). You might
need to copy yacc to byacc to make the Ruby building routines to
find it. For compiling with VS C++ 2008 you don't need "autoconf" tools.

The problem with VS C++ is getting the "readline" extension built, because
I don't think it's supported. If anyone knows what to do to get it built, I am
all ears. :-)

At times you might need to rename a library file like libiconv.lib to iconv.lib
for the extension setup to detect it, when using VS C++.

I got my openssl for VS C++ from
http://www.slproweb.com/products/Win32OpenSSL.html

And had to edit one of its files to make a conflicting error with VS
C++ to go away:
http://rt.openssl.org/Ticket/Display.html?id=1700&user=guest&pass=guest

Finally, for the openssl, zlib, iconv, readline libraries to work, you
might need
to copy them to Ruby's bin dir:

C:\>dir \opt\ruby-1.8.6\bin\*.dll

07/01/2009  18:27         1.016.832 libeay32.dll
14/10/2004  00:08           978.432 libiconv2.dll
09/10/2004  18:25           101.888 libintl3.dll
03/09/2008  22:49           232.960 libssl32.dll
26/01/2009  16:23           707.072 msvcr90-ruby18.dll
07/01/2009  18:27           200.192 ssleay32.dll
20/07/2005  18:05            75.264 zlib1.dll

I am not 100% sure about which of those DLL files
I could safely remove from the Ruby bin dir, though. :-) There
might be some excess there, I mean.

To test which libraries are loading after building a Ruby version,
I use the simple:

PS C:\> C:\opt\ruby-1.8.6\bin\ruby.exe -v -rzlib -riconv -ropenssl -e "p 5"
ruby 1.8.6 (2009-01-26 patchlevel 310) [i386-mswin32_90]
5

So no apparent errors there, huh?

Why am I doing this? I figure this could help with motivating other folks
when they get stuck building Ruby on Windows. :-)

I wish I could make all of that more automatic, but it's tough business.

Cheers,
Joao


More information about the Rubyinstaller-devel mailing list