On Wed, 19 Jul 2006, Curt H. wrote:
Below, Ara argues that a VC2005 version of Ruby would be unable
to compile/use extensions built with the command sequence:
not unable - but with a significant amount of work.
If I’m wrong here, please let me know.
let’s take two common examples, sqlite and gsl. in both cases you are
to first need to compile the project itself, and then the ruby extension
written against it.
- get on google and search for how to build sqlite from source on
it doesn’t come setup to do this. here are some example
now, perhaps these are relevant and perhaps they're not. in
note that the build is for a static library, meaning every ruby
web server) process using sqlite will have the entire library in
note also that the build require gnu make (like everything else
planet). most people will unlikely make it past this step.
- get the ruby-sqlite bindings. run ruby extconf.rb. type make.
you installed ruby into a slightly different place than the
build the one-click, who also used nmake. see, extconf.rb will
a makefile using all the environment settings used at the time
built, which will be one of the one-click installer maintainers’
machines , not the end user. so, in order for extconf.rb to
workable makefile the entire environment used to build ruby
exist on the end users platform. this may or may not be a hard
get right. of course, for something simple like sqlite the end
be able hack things up - then again maybe not…
- alternatively we can require that windows users get pre-built
sqlite and ruby-sqlite. this places the burden of maintaintance
very people who are already writing the free code! in addition,
that easy to provide binaries that will be compatible for all
all versions of windows. also, we cut out tens of thousands of
might contribute patches to these projects since they get nothing
box of bits.
- get on google and learn how to compile gsl for windows. note
first four google hits have titles like ‘ha ha ha’ and ‘nearly
to compile GSL for >> windows’. note that the fifth link is a
company selling a vc++ compiled gsl for $395.
now, if one downloads mingw one gets a compile, make, and bunches of
good stuff all at once. both sqlite and gsl can be compiled in minutes
./configure --prefix=/c/usr/local && make && make install
same goes for ruby - compiles without a hitch. next we can download the
sqlite and gsl bindings and simply do
ruby extconf.rb && make && make install
the crux of the issue isn’t that vc++ is a bad compiler - it’s obviously
it’s that many, many good ruby extensions are actually just hooks into
parth software which, itself, requires a ‘minimal system’ to compile:
ar, gcc, etc. and that it’s precisely this ‘minimal system’, not only
compiler, which is ‘remembered’ by ruby during compile time and used to
rbconfig.rb, which is the foundation of mkmf.rb and extconf.rb. it’s
interesting to run this command on a machine where ruby is installed:
ruby -r yaml -r rbconfig -e’ y Config::CONFIG ’
do so and you’ll see all sorts of stuff ruby considers important for
and installing things like
MAKEDIRS: mkdir -p
LN_S: ln -s
LDSHARED: gcc -shared
YACC: bison -y
STRIP: strip -S -x
INSTALL_PROGRAM: /usr/bin/install -c
and this is only the tip of the iceberg - none of which include the
itself. ruby considers these programs essential for building itself and
totally legit for any extension to make use of these values during
configure/build time and, in fact, many do. these programs may or may
have to exist on end users machines in the same location (or at least in
and the one-click builder’s machine for them to be used. so, this is an
example ‘minimal system’ ruby might use and, by coincidence, is very
the the environment provided by mingw.
now, that’s the for. here’s the against: i can’t swear that mingw is as
‘compatible’ with microsoft as a microsoft produced compiler - common
says it will not be. on the other hand, microsoft seems to have
issues even between it’s own compilers so maybe this gut feeling is
any case i’m not expert here and would defer to illumination from one.
one last thing - thanks so much for doing this work curt, community is
better for it.