gthiesfeld at gmail.com
Sat Apr 19 10:51:10 EDT 2008
On Fri, Apr 18, 2008 at 8:15 PM, Luis Lavena <luislavena at gmail.com> wrote:
> 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
> msys tools.
> 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
> batch files.
> try creating a make.bat that just echo something and do:
> ruby -e "system('make --version')"
which: no make.exe in
>> `make --version`
=> "GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.\nBuilt for
i686-pc-msys\nCopyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 2000\n\tFree Software Foundation, Inc.\nThis is free software;
see the source for
copying conditions.\nThere is NO warranty; not even for
MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE.\n\nReport bugs
to <bug-make at gnu.org>.\n\n"
OK, I've seen this problem before too, with Rakefiles that shell out
to use 'gem' and things like that, and I've always made the same
assumption that Ruby didn't process bat or cmd file. But what was
bugging me after I read your email was that my make.cmd worked, and
there is no other make in the path. First of all, it does seem to run
bat and cmd files, but they have to be in the path not in the same
folder you're in. This may be a 'feature' ;-), similar to the way
*nix won't let you run shell commands in your current folder without
adding ./ in front of them. Make a simple batch file, like this:
Stick it in ruby\bin, or somewhere else in the path and then try to
run it. It works for me.
The problem with the gem command and commands created by RubyGems, is
that Ruby will find the ruby file at the command first and try to
execute it, and the shell doesn't know how to run it (Windows doesn't
do shebang lines). So, if you move the ruby file with no extension out
of the bin folder, and adjust the batch file to point to it, it will
work. At least it works on my machine ;-).
> 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 =
> X_OK (io.h)
Maybe Ruby's not totally broken here, just undocumented? Take a look
and let me know what you think.
More information about the Rubyinstaller-devel