Visual C++ controversy

Pardon me for this somewhat off-topic issue.

Because of the controversy of using the commercial Visual C++ compiler in
the Windows distribution of Ruby, the following information could prove
useful.
Disclaimer: I’m not trying to push the product - I’m just saying that for
people that do not have access to Visual C++, but want to develop Ruby
extensions on Windows, there may be an opening:

Microsoft Visual C++ .Net Standard Edition is being sold at a recommended
retail price at 109$, seen at Amazon UK priced at £86.
This version is for the hobby programmer and includes a non-optimizing
compiler with a really good debugger / IDE.
I’ve only worked with the professional edition, but I reckon the debugger /
IDE works the same.

I believe you can download the non-optimizing compiler with the .NET SDK,
but then you do not get the debugger (AFAIK), and the download is 100MB+.

If the generated code is too slow, you could always try using the gcc
compiler with mingw, this will also help ensure portability between Windows
/ *nix.

I’d like to know more about how well mingw integrates with the Visual C++
Ruby distribution. My guess is the only significant problem is the
extconf.rb setup, thus it would be nice to be able to choose a compiler
through a switch.
In any case, it is very useful to have the Visual C++ debugger.

Mikkel

I believe you can download the non-optimizing compiler with the .NET SDK,
but then you do not get the debugger (AFAIK), and the download is 100MB+.

A warning: This SDK will not run on Win 95/98/ME.

I’d like to know more about how well mingw integrates with the Visual C++
Ruby distribution. My guess is the only significant problem is the
extconf.rb setup, thus it would be nice to be able to choose a compiler
through a switch.

It would be useful, yes. How would you gather the compiler settings for
the respective other compiler?

In any case, it is very useful to have the Visual C++ debugger.
gdb is also nice…

Tobias

···

On Fri, 25 Oct 2002, MikkelFJ wrote:

If you choose the VC++£¬you must choose the windows 2000 or XP.The price of
Windows 2K must be calculated.
Choose ruby, you can program under linux. And the program programming under
linux can work well under windows without modificated.
I like ruby working with TK.It is a good thing that is rather playing than
working.

MikkelFJ wrote:

I’d like to know more about how well mingw integrates with the Visual C++
Ruby distribution.

It is my understanding that one can use either MinGW or Visual C++ to
compile extension modules for the Visual C++ build of Ruby. If that’s
true, and if someone can put together some crystal-clear instructions
about what’s required to pull this off, it should do a lot to quell
people’s fears.

For what it’s worth, while I’ve had to rebuild the .lib files, I’ve
had few problems getting existing C-based extensions compiled with
the free Digital Mars compiler (www.digitalmars.com). It includes a
cl → sc converter, but the cl command line is extremely limited in
size. With some work – and I fear that I’ve misplaced this work,
but I might not have – I was able to come up with the appropriate
sc command-line. This is one reason that I want to see mkmf improved
a bit (I don’t yet have time to work on it) and not necessarily
assume that the builder’s environment is the same as the user’s
environment.

Until I upgraded to the latest version of the 1.7 installer, I was
using rd2 which requires racc. I had compiled racc with the dm
compiler. Unfortunately – and I won’t do this again – I deleted
the racc sources so I lost at least part of my makefile changes.

-austin
– Austin Ziegler, austin@halostatue.ca on 2002.10.25 at 12.21.36

···

On Fri, 25 Oct 2002 20:44:38 +0900, MikkelFJ wrote:

Because of the controversy of using the commercial Visual C++
compiler in the Windows distribution of Ruby, the following
information could prove useful. Disclaimer: I’m not trying to push
the product - I’m just saying that for people that do not have
access to Visual C++, but want to develop Ruby extensions on
Windows, there may be an opening:

From what I understand you can do this. The extensions used to require
different DLLs, but no longer. The new win32 dll is “msvcrt-ruby17.dll”
and is the same for MinGW and VC++. You would have to update the
rbconfig.rb with your compiler/linker settings if you build/deploy ruby
with one compiler and want to use another one. If someone could post a
diff between the mingw generated rbconfig and the vc++ one, that’s all I
think would be necessary.

-rich

···

-----Original Message-----
From: Lyle Johnson [mailto:lyle@users.sourceforge.net]
Sent: Friday, October 25, 2002 9:25 AM
To: ruby-talk ML
Subject: Re: Visual C++ controversy

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MikkelFJ wrote:

I’d like to know more about how well mingw integrates with
the Visual
C++ Ruby distribution.

It is my understanding that one can use either MinGW or
Visual C++ to compile extension modules for the Visual C++
build of Ruby. If that’s true, and if someone can put
together some crystal-clear instructions about what’s
required to pull this off, it should do a lot to quell
people’s fears. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9uURSRy8FwLkdsRcRAmKtAKCtWvIX0wmgpPTxQqjTakGmpu9t0QCglMTp
i4q0dYyVF0P5H5KAMnPf/yU=
=QdYr
-----END PGP SIGNATURE-----

“Tobias Peters” tpeters@invalid.uni-oldenburg.de wrote in message
news:Pine.LNX.4.44.0210251337360.28108-100000@localhost.localdomain…

It would be useful, yes. How would you gather the compiler settings for
the respective other compiler?

Don’t know enough about how these configurations work - but I guess you
could at least make a mixed VisualC++ / ming distribution such that the
install would already know everything except possible a path to the
compilers. Or you could make a plugin mycompilerconfig.rb such that you
could add Borland or Watcom plugins to the extend they are compatile. Cygwin
would be different because it’s not binary compatible.

In any case, it is very useful to have the Visual C++ debugger.
gdb is also nice…

On Windows?
Without Cygwin?

I’ve heard about the DDD debugger, but I’ve never tried it.

Mikkel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MikkelFJ wrote:

I’d like to know more about how well mingw integrates with the Visual C++
Ruby distribution.

It is my understanding that one can use either MinGW or Visual C++ to
compile extension modules for the Visual C++ build of Ruby. If that’s
true, and if someone can put together some crystal-clear instructions
about what’s required to pull this off, it should do a lot to quell
people’s fears.

This is allegedly the case in Ruby 1.7, not 1.6.

Gavin

···

From: “Lyle Johnson” lyle@users.sourceforge.net

In any case, it is very useful to have the Visual C++ debugger.
gdb is also nice…

On Windows?
Without Cygwin?

Yes!

It ships with the mingw distribution. It even has a click-o-matic
interface (although the first thing I usually do in gdb is to have the gdb
command line displayed).

I’ve heard about the DDD debugger, but I’ve never tried it.

ddd is not a debugger, but a GUI for gdb and I think some other debugger.
I don’t know if it works on windows.

Tobias

···

On Fri, 25 Oct 2002, MikkelFJ wrote:

MikkelFJ wrote:

On Windows?
Without Cygwin?

Yes, gdb is available for MinGW (without Cygwin).

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

From: “Lyle Johnson” lyle@users.sourceforge.net

MikkelFJ wrote:

I’d like to know more about how well mingw integrates with the
Visual C++ Ruby distribution.

It is my understanding that one can use either MinGW or Visual C++
to compile extension modules for the Visual C++ build of Ruby. If
that’s true, and if someone can put together some crystal-clear
instructions about what’s required to pull this off, it should do a
lot to quell people’s fears.

This is allegedly the case in Ruby 1.7, not 1.6.

Doesn’t appear to work, in my case. I have extensions that work
fine when compiled and installed on 1.7.2 mswin or when compiled
and installed under 1.7.3 mingw. It core dumps (that’s the message)
if I used the mingw produced Lib.so shared library with the mswin
distribution.

Perhaps it is the dot release. More likely it is the config file/dll
setup that Rich mentioned.

-mark.

From what I understand you can do this. The extensions used to require
different DLLs, but no longer. The new win32 dll is “msvcrt-ruby17.dll”
and is the same for MinGW and VC++.

I see you are refering to ruby-1.7. This is not true for ruby-1.6.7:
I just built ruby-1.6.7 with both compilers. the dll created by msvc6
is named “mswin32-ruby16.dll”. Mingw creates a statically linked
“ruby.exe”, and the ruby library it creates is called
“libmingw32-ruby16.a”.

You would have to update the
rbconfig.rb with your compiler/linker settings if you build/deploy ruby
with one compiler and want to use another one. If someone could post a
diff between the mingw generated rbconfig and the vc++ one, that’s all I
think would be necessary.

If it helps anyone, here are the two rbconfig.rb files for ruby-1.6.7.

MinGW-2.0.0-3 / MSYS-1.0.8-2002.09.07-1:

···

========================================

module Config

RUBY_VERSION == “1.6.7” or
raise “ruby lib version (1.6.7) doesn’t match executable version (#{RUBY_VERSION})”

This file was created by configrb when ruby was built. Any changes

made to this file will be lost the next time ruby is built.

DESTDIR = ‘’ if not defined? DESTDIR
CONFIG = {}
TOPDIR = File.dirname(FILE).sub!(%r’/lib/ruby/1.6/i686-mingw32\Z’, ‘’)
CONFIG[“srcdir”] = “c:/ruby-builds/mingw/ruby-1.6.7”
CONFIG[“prefix”] = (TOPDIR || DESTDIR + “C:/PROGRA~1/Ruby”)
CONFIG[“ruby_install_name”] = “ruby”
CONFIG[“EXEEXT”] = “.exe”
CONFIG[“SHELL”] = “/bin/sh”
CONFIG[“CFLAGS”] = “-DNT -D__MSVCRT__ -g -O2”
CONFIG[“CPPFLAGS”] = “”
CONFIG[“CXXFLAGS”] = “”
CONFIG[“FFLAGS”] = “”
CONFIG[“LDFLAGS”] = “”
CONFIG[“LIBS”] = “-lwsock32 -lmsvcrt”
CONFIG[“exec_prefix”] = “$(prefix)”
CONFIG[“bindir”] = “$(exec_prefix)/bin”
CONFIG[“sbindir”] = “$(exec_prefix)/sbin”
CONFIG[“libexecdir”] = “$(exec_prefix)/libexec”
CONFIG[“datadir”] = “$(prefix)/share”
CONFIG[“sysconfdir”] = “$(prefix)/etc”
CONFIG[“sharedstatedir”] = “$(prefix)/com”
CONFIG[“localstatedir”] = “$(prefix)/var”
CONFIG[“libdir”] = “$(exec_prefix)/lib”
CONFIG[“includedir”] = “$(prefix)/include”
CONFIG[“oldincludedir”] = “/usr/include”
CONFIG[“infodir”] = “$(prefix)/info”
CONFIG[“mandir”] = “$(prefix)/man”
CONFIG[“MAJOR”] = “1”
CONFIG[“MINOR”] = “6”
CONFIG[“TEENY”] = “7”
CONFIG[“host”] = “i686-pc-mingw32”
CONFIG[“host_alias”] = “i686-pc-mingw32”
CONFIG[“host_cpu”] = “i686”
CONFIG[“host_vendor”] = “pc”
CONFIG[“host_os”] = “mingw32”
CONFIG[“target”] = “i686-pc-mingw32”
CONFIG[“target_alias”] = “i686-pc-mingw32”
CONFIG[“target_cpu”] = “i686”
CONFIG[“target_vendor”] = “pc”
CONFIG[“target_os”] = “mingw32”
CONFIG[“build”] = “i686-pc-mingw32”
CONFIG[“build_alias”] = “i686-pc-mingw32”
CONFIG[“build_cpu”] = “i686”
CONFIG[“build_vendor”] = “pc”
CONFIG[“build_os”] = “mingw32”
CONFIG[“CC”] = “gcc”
CONFIG[“CPP”] = “gcc -E”
CONFIG[“YACC”] = “yacc”
CONFIG[“RANLIB”] = “ranlib”
CONFIG[“AR”] = “ar”
CONFIG[“NM”] = “nm”
CONFIG[“DLLWRAP”] = “dllwrap”
CONFIG[“AS”] = “as”
CONFIG[“DLLTOOL”] = “dlltool”
CONFIG[“WINDRES”] = “windres”
CONFIG[“LN_S”] = “ln”
CONFIG[“SET_MAKE”] = “”
CONFIG[“OBJEXT”] = “o”
CONFIG[“LIBOBJS”] = “crypt.o flock.o isinf.o win32.o”
CONFIG[“ALLOCA”] = “”
CONFIG[“XLDFLAGS”] = “”
CONFIG[“DLDFLAGS”] = “”
CONFIG[“STATIC”] = “”
CONFIG[“CCDLFLAGS”] = “-DIMPORT”
CONFIG[“LDSHARED”] = “dllwrap --target=mingw32 --as=as --dlltool-name=dlltool --driver-name=gcc --export-all -s”
CONFIG[“DLEXT”] = “so”
CONFIG[“DLEXT2”] = “dll”
CONFIG[“STRIP”] = “strip”
CONFIG[“EXTSTATIC”] = “”
CONFIG[“setup”] = “Setup”
CONFIG[“MINIRUBY”] = “./miniruby$(EXEEXT)”
CONFIG[“PREP”] = “”
CONFIG[“LIBRUBY_LDSHARED”] = “dllwrap --target=mingw32 --as=as --dlltool-name=dlltool --driver-name=gcc --export-all -s”
CONFIG[“LIBRUBY_DLDFLAGS”] = “–output-exp=$(RUBY_INSTALL_NAME).exp --dllname=$(RUBY_INSTALL_NAME)$(EXEEXT) --output-lib=$(LIBRUBY) --add-stdcall-alias --def=$(RUBYDEF)”
CONFIG[“RUBY_INSTALL_NAME”] = “ruby”
CONFIG[“RUBY_SO_NAME”] = “mingw32-$(RUBY_INSTALL_NAME)16”
CONFIG[“LIBRUBY_A”] = “lib$(RUBY_INSTALL_NAME)s.a”
CONFIG[“LIBRUBY_SO”] = “dummy”
CONFIG[“LIBRUBY_ALIASES”] = “”
CONFIG[“LIBRUBY”] = “lib$(RUBY_SO_NAME).a”
CONFIG[“LIBRUBYARG”] = “-L. -l$(RUBY_SO_NAME)”
CONFIG[“SOLIBS”] = “$(LIBS)”
CONFIG[“DLDLIBS”] = “”
CONFIG[“ENABLE_SHARED”] = “no”
CONFIG[“MAINLIBS”] = “”
CONFIG[“arch”] = “i686-mingw32”
CONFIG[“sitedir”] = “$(prefix)/lib/ruby/site_ruby”
CONFIG[“configure_args”] = “‘–prefix=C:/PROGRA~1/Ruby’”
CONFIG[“ruby_version”] = “$(MAJOR).$(MINOR)”
CONFIG[“rubylibdir”] = “$(libdir)/ruby/$(ruby_version)”
CONFIG[“archdir”] = “$(rubylibdir)/$(arch)”
CONFIG[“sitelibdir”] = “$(sitedir)/$(ruby_version)”
CONFIG[“sitearchdir”] = “$(sitelibdir)/$(arch)”
CONFIG[“compile_dir”] = “c:/ruby-builds/mingw/ruby-1.6.7”
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
def Config::expand(val)
val.gsub!(/$(([^()]+))/) do |var|
key = $1
if CONFIG.key? key
Config::expand(CONFIG[key])
else
var
end
end
val
end
CONFIG.each_value do |val|
Config::expand(val)
end
end

MS Visual C++ 6:

module Config

RUBY_VERSION == “1.6.7” or
raise “ruby lib version (1.6.7) doesn’t match executable version (#{RUBY_VERSION})”

This file was created by configrb when ruby was built. Any changes

made to this file will be lost the next time ruby is built.

DESTDIR = ‘’ if not defined? DESTDIR
CONFIG = {}
CONFIG[“MAJOR”] = “1”
CONFIG[“MINOR”] = “6”
CONFIG[“TEENY”] = “7”
TOPDIR = File.dirname(FILE).sub!(%r’/lib/ruby/1.6/i586-mswin32\Z’, ‘’)
CONFIG[“prefix”] = (TOPDIR || DESTDIR + “”)
CONFIG[“EXEEXT”] = “.exe”
CONFIG[“srcdir”] = “C:/ruby-builds/msvc6/ruby-1.6.7”
CONFIG[“ruby_install_name”] = “ruby”
CONFIG[“RUBY_INSTALL_NAME”] = “ruby”
CONFIG[“RUBY_SO_NAME”] = “mswin32-ruby16”
CONFIG[“SHELL”] = “”
CONFIG[“CFLAGS”] = “-nologo -DNT=1 -Zi -MD -O2b2xg- -G5”
CONFIG[“CPPFLAGS”] = “”
CONFIG[“CXXFLAGS”] = “”
CONFIG[“FFLAGS”] = “”
CONFIG[“LDFLAGS”] = “-nologo”
CONFIG[“LIBS”] = “user32.lib advapi32.lib wsock32.lib”
CONFIG[“exec_prefix”] = “$(prefix)”
CONFIG[“bindir”] = “$(exec_prefix)/bin”
CONFIG[“sbindir”] = “$(exec_prefix)/sbin”
CONFIG[“libexecdir”] = “$(exec_prefix)/libexec”
CONFIG[“datadir”] = “$(prefix)/share”
CONFIG[“sysconfdir”] = “$(prefix)/etc”
CONFIG[“sharedstatedir”] = “$(prefix)/com”
CONFIG[“localstatedir”] = “$(prefix)/var”
CONFIG[“libdir”] = “$(exec_prefix)/lib”
CONFIG[“includedir”] = “$(prefix)/include”
CONFIG[“oldincludedir”] = “/usr/include”
CONFIG[“infodir”] = “$(prefix)/info”
CONFIG[“mandir”] = “$(prefix)/man”
CONFIG[“host”] = “i586-pc-mswin32”
CONFIG[“host_alias”] = “i586-mswin32”
CONFIG[“host_cpu”] = “i586”
CONFIG[“host_vendor”] = “pc”
CONFIG[“host_os”] = “mswin32”
CONFIG[“CC”] = “cl”
CONFIG[“CPP”] = “cl -E”
CONFIG[“YACC”] = “byacc”
CONFIG[“RANLIB”] = “rem”
CONFIG[“AR”] = “lib -nologo”
CONFIG[“LN_S”] = “”
CONFIG[“SET_MAKE”] = “”
CONFIG[“LIBOBJS”] = “crypt.obj win32.obj isinf.obj isnan.obj”
CONFIG[“ALLOCA”] = “”
CONFIG[“DEFAULT_KCODE”] = “”
CONFIG[“OBJEXT”] = “obj”
CONFIG[“XLDFLAGS”] = “”
CONFIG[“DLDFLAGS”] = “$(CFLAGS)”
CONFIG[“STATIC”] = “”
CONFIG[“CCDLFLAGS”] = “-DIMPORT”
CONFIG[“LDSHARED”] = “cl -LD”
CONFIG[“DLEXT”] = “so”
CONFIG[“DLEXT2”] = “dll”
CONFIG[“STRIP”] = “”
CONFIG[“EXTSTATIC”] = “”
CONFIG[“setup”] = “Setup”
CONFIG[“LIBRUBY_LDSHARED”] = “”
CONFIG[“LIBRUBY_DLDFLAGS”] = “”
CONFIG[“LIBRUBY_A”] = “lib$(RUBY_INSTALL_NAME).lib”
CONFIG[“LIBRUBY_SO”] = “$(RUBY_SO_NAME).dll”
CONFIG[“LIBRUBY_ALIASES”] = “”
CONFIG[“LIBRUBY”] = “$(RUBY_SO_NAME).lib”
CONFIG[“LIBRUBYARG”] = “$(RUBY_SO_NAME).lib”
CONFIG[“SOLIBS”] = “”
CONFIG[“DLDLIBS”] = “”
CONFIG[“ENABLE_SHARED”] = “yes”
CONFIG[“arch”] = “i586-mswin32”
CONFIG[“sitedir”] = “$(prefix)/lib/ruby/site_ruby”
CONFIG[“configure_args”] = “–with-make-prog=nmake --enable-shared”
CONFIG[“ruby_version”] = “$(MAJOR).$(MINOR)”
CONFIG[“rubylibdir”] = “$(libdir)/ruby/$(ruby_version)”
CONFIG[“archdir”] = “$(rubylibdir)/$(arch)”
CONFIG[“sitelibdir”] = “$(sitedir)/$(ruby_version)”
CONFIG[“sitearchdir”] = “$(sitelibdir)/$(arch)”
CONFIG[“compile_dir”] = “C:/ruby-builds/msvc6/ruby-1.6.7”
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
def Config::expand(val)
val.gsub!(/$(([^()]+))/) do |var|
key = $1
if CONFIG.key? key
Config::expand(CONFIG[key])
else
var
end
end
val
end
CONFIG.each_value do |val|
Config::expand(val)
end
end