luislavena at gmail.com
Fri Apr 18 21:15:00 EDT 2008
On Fri, Apr 18, 2008 at 12:57 PM, Gordon Thiesfeld <gthiesfeld at gmail.com> wrote:
> So, I was looking at the way msysGit wraps the git command in a batch
> file, and I thought we could do the same thing for compiling
> extensions in gems.
> Something like this in \path_to_ruby\bin:
> REM make.cmd
> @echo off
> set path=%path%;c:\ruby\repo\oci\sandbox\mingw
> C:\ruby\repo\oci\sandbox\msys\bin\bash.exe --login -i -c "make %*"
> exit /B %ErrorLevel%
> This way we wouldn't need to worry about adding mingw to the path,
> except when it's needed (ie. when make is called). We may need to add
> msys to the path as well, I'm not sure. I can use this method to `gem
> install mongrel`. It compiles native extensions and all that. Of
> course when I try to run mongrel it fails ;), but I think that's a
> separate issue.
There is no need to add mingw or msys to the path, since when bash
start it parses profile and setup $PATH to include both, mingw and
Anyway, we will need wrap 'gcc' too, since is something extconf uses
to try definitions that create the makefile.
The only problem is that ruby doesn't like it, and I had problems in
the past due that, and was ruby exec code.
Let me explain:
When you issue 'make' in the command line, the cmd interpreter
(cmd.exe) will try to find an executable of make, based on 'make' +
one of the extensions in PATHEXT environment variable, in the order
they are listed:
make.com, make.exe, make.bat, make.cmd, etc.
The problem is ruby exec doesn't work like that. if you supply a
command without the extension, it will look for executables (com and
exe), but you must explicitly indicate .bat or .cmd when executing
try creating a make.bat that just echo something and do:
ruby -e "system('make --version')"
Without mingw/msys in the path, that will fail until you supply
.bat/.cmd to the system command.
So, that will require us patch rubygems and replace conditions for
RUBY_PLATFORM and issue 'make.bat/cmd' instead of plain 'make'. Take
in consideration that right now there are conditions for mswin (nmake)
and others platforms, plain make.
> What do you think? Am I oversimplifying the problem again?
I like the idea and you aren't oversimplifying it, I think Ruby is
broken in that aspect.
Maybe we can fix that damn thing in ruby C code and workaround that?
win32/win32.c:989 (CreateChild function), call dln_find_exe
dlc.c:1671 (dln_find_exe function), call dln_find_1
dlc.c:1796 (dln_find_1 function), call eaccess
file.c:897 (eaccess function), call access API with 'path' and mode =
Or maybe I ended tracing it to the wrong place :-P
Thanks to you for your interest.
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
More information about the Rubyinstaller-devel