Compiling stuff under Windows: list of problems

I don’t want my tortuous experience of trying to get things working under this
decidedly inferior development environment to be wasted, so here’s a summary of
(my) difficulties for the record:

  1. If you compile Ruby using compiler X, you need to compile any extensions
    you use under compiler X.

    a. If you use the Pragmatic Programmers’ Ruby/Windows distro, that X is
    MSVC. This strikes me as not being very pragmatic, as it is not
    freely available.

  2. The choices of compiler are:

    • MSVC (commercial; Windows target)
    • Borland (free download; Windows target)
    • MingGW (free; Unix-like, but Windows target)
    • Cygwin (free Unix environment, Unix-like target)

    These all have problems:

    a. MSVC is not freely available, but it’s the only choice if you use
    ProgProgDistro. If you have it, I’m sure it’s fine.

    b. Borland: difficult to compile Ruby, as

    • you can’t run ‘configure’
    • there’s no pregenerated Makefile

    c. MinGW: can’t remember the problem here; I might give it another try :wink:

    d. Cygwin: can create Ruby no prob (I prefer it to Windows native Ruby
    because of the beautiful GNU toolset), but extensions are a problem
    as you need to get DLLs (e.g. the Oracle OCI DLL - you have no
    choice, it IS a DLL) to combine with the Ruby SOs.

SUMMARY

···

Perhaps MinGW is the best bet for Ruby under Windows. I’ll give it another try
and report to the group.

I’ve read a lot of discussions on Wiki and -talk about the decisions that
needed to be taken to leave Cygwin behind (hey, I love Command Prompt as much
as anyone), but I’ve never seen anything like what I’ve written above.
Hopefully it will be of some help to somebody hopelessly trawling the archives
in the future. Even more hopefully, someone will do something about the
lame-arse operating environment that is Windows.

If any of the information above is known to be wrong, please correct ASAP.


Gavin Sinclair Software Engineer
Sydney, Australia Soyabean Software Pty Ltd

Hi,

  1. If you compile Ruby using compiler X, you need to compile any extensions
    you use under compiler X.

    a. If you use the Pragmatic Programmers’ Ruby/Windows distro, that X is
    MSVC. This strikes me as not being very pragmatic, as it is not
    freely available.

  2. The choices of compiler are:

    • MSVC (commercial; Windows target)
    • Borland (free download; Windows target)
    • MingGW (free; Unix-like, but Windows target)
    • Cygwin (free Unix environment, Unix-like target)

Note that mingw32 and mswin32(msvc) are runtime-compatible in
1.7 now.

b. Borland: difficult to compile Ruby, as
- you can’t run ‘configure’
- there’s no pregenerated Makefile

Experimental support in 1.7.

SUMMARY

Perhaps MinGW is the best bet for Ruby under Windows. I’ll give it another try
and report to the group.

Agree, but still it has some problems.

···

At Wed, 2 Oct 2002 23:38:56 +0900, Gavin Sinclair wrote:


Nobu Nakada

Well, If you are doing this enough to justify spending the bucks, you
can get a Mac, Moto’s Codewarrior compiler, a garage sale PC and cross
compile. You can even tell Codewarrior to be link compatible with MSVCC
on the PC side.

The advantage is that you can work on multiple targets at once.

···

On Wednesday, October 2, 2002, at 07:38 AM, Gavin Sinclair wrote:

I don’t want my tortuous experience of trying to get things working
under this
decidedly inferior development environment to be wasted, so here’s a
summary of
(my) difficulties for the record:


Conversation, n. A flair for the display of the minor mental
commodities, each exhibitor being too intent upon the arrangement of
his own wares to observe those of his neighbor. -Ambrose Bierce

a. If you use the Pragmatic Programmers’ Ruby/Windows distro, that X is
MSVC. This strikes me as not being very pragmatic, as it is not
freely available.

This is indeed pragmatic as opposed to dogmatic.
But MSVC 7.0 is freely available as a compiler without GUI development and
without optimizations. It’s part of the freely available Dot Net development
framework - correct me if I’m wrong as I’ve never had the need to go along
this path.

d. Cygwin: can create Ruby no prob (I prefer it to Windows native Ruby
because of the beautiful GNU toolset), but extensions are a problem
as you need to get DLLs (e.g. the Oracle OCI DLL - you have no
choice, it IS a DLL) to combine with the Ruby SOs.

Cygwin is bad because it is difficult to reliably have two different
applications on Windows that both use Cygwin, because the inevitably will be
using different incompatible versions of Cygwin. Hence Cygwin may be nice to
toy with, but not a realistic choice for deployment of a Ruby solution, and
as such prohibitive for Ruby’s spread on Windows. If you are big on Cygwin,
you might as well get hold of a Linux box.

Beside that, there is a lot of unfair critique of the Windows platform - it
may do something less than optimal, but in many respects it just does things
differently - programmers really should abstract out platform specific
issues so it wouldn’t be necessary to use Cygwin. Ruby does that, and it is
not necessary to use Cygwin.

As a free compiler, mingw seems great - I haven’t used it a lot but I do use
it occanasionally to verify code is running on gcc as well as on MSVC.

Mikkel

a. If you use the Pragmatic Programmers’ Ruby/Windows distro, that X is
MSVC. This strikes me as not being very pragmatic, as it is not
freely available.

This is indeed pragmatic as opposed to dogmatic.

And the reason would be? Everything else about Ruby is free. I’m not
dogmatic, by the way. I have no opposition to non-free software; but I fail to
see any benefit MSVC provides over the more accessible alternatives.

But MSVC 7.0 is freely available as a compiler without GUI development and
without optimizations. It’s part of the freely available Dot Net development
framework - correct me if I’m wrong as I’ve never had the need to go along
this path.

It would be nice to try this. Thanks for the tip. (Giving away a
non-optimising compiler is still a bit niggardly, though.)

d. Cygwin: can create Ruby no prob (I prefer it to Windows native Ruby
because of the beautiful GNU toolset), but extensions are a problem
as you need to get DLLs (e.g. the Oracle OCI DLL - you have no
choice, it IS a DLL) to combine with the Ruby SOs.

Cygwin is bad because it is difficult to reliably have two different
applications on Windows that both use Cygwin, because the inevitably will be
using different incompatible versions of Cygwin. Hence Cygwin may be nice to
toy with, but not a realistic choice for deployment of a Ruby solution, and
as such prohibitive for Ruby’s spread on Windows. If you are big on Cygwin,
you might as well get hold of a Linux box.

This is for work, so sadly I don’t have the choice. The ultimate target is
(probably) AIX, and I compiled for that with exactly zero problems. However it
would benefit me to deploy on the Windows boxes around as well.

Beside that, there is a lot of unfair critique of the Windows platform - it
may do something less than optimal, but in many respects it just does things
differently - programmers really should abstract out platform specific
issues so it wouldn’t be necessary to use Cygwin. Ruby does that, and it is
not necessary to use Cygwin.

I never unfairly criticise Windows, not having within me the nature of a
zealot. But when every single method of compilation on Windows seems to be a
square peg solution, and I found /no/ documents giving a roadmap, there is a
problem with the platform.

As a free compiler, mingw seems great - I haven’t used it a lot but I do use
it occanasionally to verify code is running on gcc as well as on MSVC.

Mikkel

Gavin

···

From: “MikkelFJ” mikkelfj-anti-spam@bigfoot.com

Thanks for the reply, Nakada.

  1. The choices of compiler are:
    • MSVC (commercial; Windows target)
    • Borland (free download; Windows target)
    • MingGW (free; Unix-like, but Windows target)
    • Cygwin (free Unix environment, Unix-like target)

Note that mingw32 and mswin32(msvc) are runtime-compatible in
1.7 now.

That’s good. What does it mean? And what does 1.7 have to do with it?

Using ‘extconf’ to generate a Makefile will still be incompatible if I use an
out-of-the-box Ruby compiles by MSVC but want to compile an extension with
mingw.

b. Borland: difficult to compile Ruby, as
- you can’t run ‘configure’
- there’s no pregenerated Makefile

Experimental support in 1.7.

I just downloaded a “stable snapshot” and saw no difference from 1.6 as far as
Borland is concerned.

SUMMARY

Perhaps MinGW is the best bet for Ruby under Windows. I’ll give it another
try
and report to the group.

Agree, but still it has some problems.

True. I can’t see a way to generate a Makefile for mingw either. … However,
I just looked at the www.mingw.org again and there is available an MSYS
package, including bash and sundry other things so that “configure” can be run.


Nobu Nakada

Gavin

···

From: nobu.nokada@softhome.net

I don’t want my tortuous experience of trying to get things working
under this
decidedly inferior development environment to be wasted, so here’s a
summary of
(my) difficulties for the record:

Well, If you are doing this enough to justify spending the bucks, you
can get a Mac, Moto’s Codewarrior compiler, a garage sale PC and cross
compile. You can even tell Codewarrior to be link compatible with MSVCC
on the PC side.

The advantage is that you can work on multiple targets at once.

Interesting thought. In fact, if I needed a desktop computer now (I just use
my laptop for everything) I would definitely get an iMac so I could have great
command-line/GUI interoperability.

Gavin

···

From: “Chris Gehlker” canyonrat@mac.com

On Wednesday, October 2, 2002, at 07:38 AM, Gavin Sinclair wrote:

OK, I’ve tried it with snapshot.tar.gz and Borland 5.5.

There are millions of compiler warnings! And then it trips over because it
can’t find ‘byacc’. The Borland README includes the following:

Note: building ruby requires following commands. * make * bcc * tlib * ilink

Perhaps it should read
Note: building ruby requires following commands.
* make
* bcc32
* tlib
* ilink32
* byacc

Guess I’ll use Cygwin’s byacc.

Gavin

···

----- Original Message -----
From: nobu.nokada@softhome.net

b. Borland: difficult to compile Ruby, as
- you can’t run ‘configure’
- there’s no pregenerated Makefile

Experimental support in 1.7.


Nobu Nakada

But MSVC 7.0 is freely available as a compiler without GUI development and
without optimizations. It’s part of the freely available Dot Net
development
framework - correct me if I’m wrong as I’ve never had the need to go along
this path.

It would be nice to try this. Thanks for the tip. (Giving away a
non-optimising compiler is still a bit niggardly, though.)

It’s a 131MB download.

/me smiles and nods and walks slowly towards the door

Gavin

···

From: “Gavin Sinclair” gsinclair@soyabean.com.au

Hi,

Note that mingw32 and mswin32(msvc) are runtime-compatible in
1.7 now.

That’s good. What does it mean? And what does 1.7 have to do with it?

One extension library is usable from mingw and mswin.

Using ‘extconf’ to generate a Makefile will still be incompatible if I use an
out-of-the-box Ruby compiles by MSVC but want to compile an extension with
mingw.

Hmmm, perhaps you need rbconfig.rb for mingw and to edit TOPDIR
line in it. But if you use mignw compiler, it’s best and
easiest to compile ruby itself with the compiler.

b. Borland: difficult to compile Ruby, as
- you can’t run ‘configure’
- there’s no pregenerated Makefile

Experimental support in 1.7.

I just downloaded a “stable snapshot” and saw no difference from 1.6 as far as
Borland is concerned.

It’s 1.6 snapshot. 1.7 is “snapshot.tar.gz” without “stable-”.

SUMMARY

Perhaps MinGW is the best bet for Ruby under Windows. I’ll give it another try
and report to the group.

Agree, but still it has some problems.

True. I can’t see a way to generate a Makefile for mingw either. … However,
I just looked at the www.mingw.org again and there is available an MSYS
package, including bash and sundry other things so that “configure” can be run.

It’s certainly a problem, however, I didn’t know it. Instead,
the main subject in my mind was select & thread-switching
issue.

···

At Thu, 3 Oct 2002 10:33:49 +0900, Gavin Sinclair wrote:


Nobu Nakada

OK, I’ve tried it with snapshot.tar.gz and Borland 5.5.

There are millions of compiler warnings! And then it trips over because it
can’t find ‘byacc’. The Borland README includes the following:

[…]

Guess I’ll use Cygwin’s byacc.

Gavin

Using Cygwin’s ‘byacc’ (within Cygwin) to generate parse.c worked nicely,
allowing Borland’s ‘make’ to continue.

make test and make install both worked fine.

Gavin

···

From: “Gavin Sinclair” gsinclair@soyabean.com.au

Hi,

···

At Thu, 3 Oct 2002 14:31:08 +0900, Gavin Sinclair wrote:

There are millions of compiler warnings! And then it trips over because it
can’t find ‘byacc’. The Borland README includes the following:

I add -w- option to CFLAGS to compile. Borland tools are too
noisy.

byacc is avaiable at GnuWin32 site.


Nobu Nakada

Using ‘extconf’ to generate a Makefile will still be incompatible if I use
an
out-of-the-box Ruby compiles by MSVC but want to compile an extension with
mingw.

Hmmm, perhaps you need rbconfig.rb for mingw and to edit TOPDIR
line in it. But if you use mignw compiler, it’s best and
easiest to compile ruby itself with the compiler.

Agreed, which I’ve succeeded in doing, but have not been able to “make install”
just yet (probably a minor issue).

b. Borland: difficult to compile Ruby, as
- you can’t run ‘configure’
- there’s no pregenerated Makefile

Experimental support in 1.7.

I just downloaded a “stable snapshot” and saw no difference from 1.6 as far
as
Borland is concerned.

It’s 1.6 snapshot. 1.7 is “snapshot.tar.gz” without “stable-”.

::grimaces in embarassment; hits forehead with palm, and says between clenched
teeth “Thanks for pointing that out.”::

Nobu Nakada

Thanks again for the help.

Gavin

···

From: nobu.nokada@softhome.net