Best tools for compiling Ruby (Windows)?


#1

Hi

I’d like to figure out how I can download and compile the latest version
of
Ruby on Windows. I know I can get Curt’s one-click installer, but I’d
quite
like the ability to compile it for myself.

Question is, which is the best (free) compiler for the job? Visual C++
or
Borland? Or another?

I have tried to use the MS VC++ Toolkit 2003, with NMAKE 1.5 - both
freely
downloadable from MS but as soon as I issue a win32\configure
i686-mswin32
(from memory), NMAKE falls over immediately. Can’t remember the error
off-hand but if it’s important I can run it again.

Am I using the right version of tools? Should I really be using
Borland?
(their CPP5.5 is also freely downloadable).

All the best
Glenn
Aylesbury, UK


#2

Hello,
This should help get you started.
http://www.rubygarden.org/ruby?HowToBuildOnWindows


#3

On 3/3/06, Glenn S. removed_email_address@domain.invalid wrote:

downloadable from MS but as soon as I issue a win32\configure i686-mswin32
(from memory), NMAKE falls over immediately. Can’t remember the error
off-hand but if it’s important I can run it again.

Am I using the right version of tools? Should I really be using Borland?
(their CPP5.5 is also freely downloadable).

Don’t use VC++ 2003. Austin Zeigler, and experienced Rubyist, has been
struggling to get Ruby to compile with VC++ 2003 and, as far as I
know, he has not yet succeeded.

You should have no problem with either VC++ 6.0 SP5, or VC++ 7.1 (aka
VS.NET 2001).

Curt


#4

Thanks Gents - good info as ever.
G

On 04/03/06, Curt H. removed_email_address@domain.invalid wrote:

Question is, which is the best (free) compiler for the job? Visual C++
Am I using the right version of tools? Should I really be using
Curt

All the best
Glenn
Aylesbury, UK


#5

On 3/3/06, Glenn S. removed_email_address@domain.invalid wrote:

downloadable from MS but as soon as I issue a win32\configure i686-mswin32
(from memory), NMAKE falls over immediately. Can’t remember the error
off-hand but if it’s important I can run it again.

Am I using the right version of tools? Should I really be using Borland?
(their CPP5.5 is also freely downloadable).

VC++ 2003 works fine, it’s 2005 that’s a big change, and difficult to
make function properly.
If you install these three things, you should be able to compile
anything you want on Win32.

  1. Visual C++ Toolkit 2003 (free)
  2. MS Platform SDK 2003 (free, and you only need to install the
    basics. Leave most things unchecked.)
  3. MS .NET SDK 1.1 (not! 2.0)

That will give you a new version of NMAKE (don’t use 1.5), along with
the compiler and the various headers and libraries you need.

Once you’ve downloaded and installed these, you’ll need to configure
your environment variables. Here’s what my vcvars32.bat file looks
like:
@echo off

Set PATH=C:\Program Files\Microsoft Visual C++ Toolkit
2003\bin;C:\Program Files\Microsoft Platform SDK\Bin;%PATH%
Set INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit
2003\include;C:\Program Files\Microsoft Platform
SDK\Include;C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Visual C++ Toolkit
2003\lib;C:\Program Files\Microsoft Platform SDK\Lib;C:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%

echo Setting Visual C++ environment variables.
echo You lose 1d6 sanity points.
echo.


#6

I forgot to mention that I was able to compile Ruby 1.8.2
One-click-installer using MS VC++ 2003 last year–sometime between
1.8.2-14 and 1.8.2-15.

These are the exact tools I used to compile:

MS VC++ 2003 Toolkit 1.01
http://msdn.microsoft.com/visualc/vctoolkit2003/

MS PSDK Feb 2003 (a newer version is available but I used this version)
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm


#7

Curt H. wrote:

Don’t use VC++ 2003. Austin Zeigler, and experienced Rubyist, has been
struggling to get Ruby to compile with VC++ 2003 and, as far as I
know, he has not yet succeeded.

You should have no problem with either VC++ 6.0 SP5, or VC++ 7.1 (aka
VS.NET 2001).

Curt

I think there is some confusion regarding VC++ versions and hope this
table is helpful:

VC++ 6.0 = IMHO, not very standards-compliant with C++ language
VC++ 2002 (7.0) = IMHO, buggy & beta-quality release
VC++ 2003 (7.1) = IMHO, very nice! freely downloadable as VC++ 2003
Toolkit 1.01
VC++ 2005 (8.0) = IMHO, bloated with new proprietary features

IMHO, VC++ 2003 is the best C++ compiler from Microsoft because it is
very standards-compliant and reliable compared to prior versions.

Microsoft VC++ Toolkit 2003 1.01 is freely downloadable and is the same
optimizing compiler as MS VC++ 2003 PROFESSIONAL. The compiler version
displayed by cl.exe is 13.10.3077. However, the lack of debug libraries
make it useful only for creating release builds (which is the same
quality as the very expensive optimizing compiler).

Is Austin running into problems compiling Ruby for debug build or
release build?

If Ruby builds with VC++ 6.0 but doesn’t build with VC++ 2003 for
release build, then the Ruby code should be investigated.

But if Austin is building for debug, then he needs to obtain the debug
libraries which are not included with VC++ 2003 Toolkit. Note that VC++
2003 Standard has those missing debug libraries.


#8

My mistake – Wilson is correct, it VC++ 2005 that you should avoid.

Sorry for any confusion,
Curt


#9

I have happily compiled it on my laptop using Visual Studio Enterprise
Edition (SP6). Unfortunately the RUDL package which I use for the odd
game
I’ve written no longer works. Might try recompiling that from source
too.

Also, I finally managed to get a good working Linux distro (Zenwalk)
installed (had all sorts of problems with many distros for some reason).
First thing I downloaded and compiled was… well, you know :o)

On 04/03/06, Rich A. removed_email_address@domain.invalid wrote:

MS PSDK Feb 2003 (a newer version is available but I used this version)
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm


Posted via http://www.ruby-forum.com/.

All the best
Glenn
Aylesbury, UK


#10

Hello Glenn,

Question is, which is the best (free) compiler for the job? Visual
C++ or Borland? Or another?
I won’t say mine’s best, however all RMagick binary releases are
compiled
using mingw and msys. I think they integrate posix/unix stuff nicely
with
windows while guaranteeing binary compatibility with other windows
builds.

Just thought I’d complete the thread with what works for me.

best regards,
kaspar


#11

After following the simple:
http://www.rubygarden.org/ruby?HowToBuildOnWindows

I compiled ruby (latest stable snapshot) fine on Windows2000.
If I do ruby -v I get “ruby 1.8.4 (2006-03-27) [i386-mingw32]”, but if I
try and run a ruby script I get:

“no such file found – urby gems (LoadError)”

I’ve tried relative and absolute paths.


#12

I dont have an enviroment var called RUBYOPT, only the usual PATH and
TMP.

Can I check this enviroment var from the command line somehow or set it
to off?

Many thanks!

Wilson B. wrote:

On 3/28/06, Peter P. removed_email_address@domain.invalid wrote:

Check your “RUBYOPT” environment variable, and clear it out if it has
something in it.


#13

On 3/28/06, Peter P. removed_email_address@domain.invalid wrote:

Check your “RUBYOPT” environment variable, and clear it out if it has
something in it.


#14

Even so, doing RUBYOPT= on the command line cured the problem.

Peter P. wrote:

I dont have an enviroment var called RUBYOPT, only the usual PATH and
TMP.

Can I check this enviroment var from the command line somehow or set it
to off?

Many thanks!

Wilson B. wrote:

On 3/28/06, Peter P. removed_email_address@domain.invalid wrote:

Check your “RUBYOPT” environment variable, and clear it out if it has
something in it.


#15

On 3/4/06, Curt H. removed_email_address@domain.invalid wrote:

I have tried to use the MS VC++ Toolkit 2003, with NMAKE 1.5 - both freely
downloadable from MS but as soon as I issue a win32\configure i686-mswin32
(from memory), NMAKE falls over immediately. Can’t remember the error
off-hand but if it’s important I can run it again.

Am I using the right version of tools? Should I really be using Borland?
(their CPP5.5 is also freely downloadable).

Don’t use VC++ 2003. Austin Zeigler, and experienced Rubyist, has been
struggling to get Ruby to compile with VC++ 2003 and, as far as I
know, he has not yet succeeded.

Actually, VC++ 8, not VC++ 2003. VS.NET 2003 is VC++ 7.1.

I have succeeded, but not in everything, and my free time over the
last three months has been approximately nil.

-austin


#16

Austin Z. wrote:

Note that mingw/msys builds are NOT compatible with VC++2003 or
VC++2005 builds because of a different runtime environment. At a
minimum, there is a mismatch between where errno is defined (somehow).

If you are using the One-Click Installer for 1.8.2, you will need to
compile extensions with VC++2003 (using MSVCR71.DLL); if you are using
the One-Click Installer for 1.8.4, you will be able to compile
extensions with VC6 or msys/mingw. You MUST NOT mix the versions or
bad things may happen to your Ruby programs.

I’ve done a little work with an extension compiled with VC++2003 and
ruby-1.8.4, One-Click. Am I just lucky that it works? Or is that known
to be OK?


#17

On 3/18/06, Kaspar S. removed_email_address@domain.invalid wrote:

Hello Glenn,

Question is, which is the best (free) compiler for the job? Visual
C++ or Borland? Or another?
I won’t say mine’s best, however all RMagick binary releases are compiled
using mingw and msys. I think they integrate posix/unix stuff nicely with
windows while guaranteeing binary compatibility with other windows builds.

Just thought I’d complete the thread with what works for me.

Note that mingw/msys builds are NOT compatible with VC++2003 or
VC++2005 builds because of a different runtime environment. At a
minimum, there is a mismatch between where errno is defined (somehow).

If you are using the One-Click Installer for 1.8.2, you will need to
compile extensions with VC++2003 (using MSVCR71.DLL); if you are using
the One-Click Installer for 1.8.4, you will be able to compile
extensions with VC6 or msys/mingw. You MUST NOT mix the versions or
bad things may happen to your Ruby programs.

-austin


#18

Curt H. wrote:

I’ve done a little work with an extension compiled with VC++2003 and
checks the value of ERRNO, they will be using different memory
locations, with unpredictable results.

Hm, any plans to migrate the One-Click Installer to VC++2003?


#19

On 3/31/06, Joel VanderWerf removed_email_address@domain.invalid wrote:

Hm, any plans to migrate the One-Click Installer to VC++2003?

The O.-Click Installer for 1.8.2 was on VC++2003. However, because
the most common free compiler (mingw/msys) was not compatible with it
and any number of other reasons, 1.8.4 is now based on the Ruby 1.8.4
build built in Japan (I’m sorry; my mind is blanking on the name of
the site and the person behind it) which is built with VC6 – and is
NO LONGER AVAILABLE to users.

That’s one reason I’m working on 1.8.4 with VC++ 2005 in my
(completely nonexistent) free time so that people can get VC++ 2005
and build things on Windows quickly and easily.

At least once I’ve figured out how to do it. It’s not as easy as it
might first appear, and the official version of zlib is never
compiled against anything but MSVCR6.DLL (e.g., VC6) so to have a
compatible zlib, you have to compile it yourself. It’s a pain in the
ass.

-austin


#20

On 3/31/06, Austin Z. removed_email_address@domain.invalid wrote:

NO LONGER AVAILABLE to users.

That’s one reason I’m working on 1.8.4 with VC++ 2005 in my
(completely nonexistent) free time so that people can get VC++ 2005
and build things on Windows quickly and easily.

At least once I’ve figured out how to do it. It’s not as easy as it
might first appear, and the official version of zlib is never
compiled against anything but MSVCR6.DLL (e.g., VC6) so to have a
compatible zlib, you have to compile it yourself. It’s a pain in the
ass.

Yeah, Austin got it right.The official Japanese build of ruby for
windows (ruby-mswin32) uses vc++6, and almost all available binaries
for various extensions are also built with vc++6.

When I moved to vc++7 for 1.8.2 it cause a lot of subtle problems.
Starting with 1.8.4 I’m actually using the ruby-mswin32 build as a
based and adding more extensions on top of it. The have got a number
of things right that I always had problems with (Tk/Tcl support,
iconv, readline, etc.). So it was also a relief to start with a base
where those pieces were already problem included.

Curt