[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with $(shell xxx) using uWin

From: Eli Zaretskii
Subject: Re: Problems with $(shell xxx) using uWin
Date: Sat, 03 Jun 2006 13:42:42 +0300

> Date: Fri, 02 Jun 2006 22:47:02 +0200
> From: James Kanze <address@hidden>
>     currentDir = $(shell pwd)
>     componentName = $(notdir $(currentDir))
>     target = $(componentName).exe
>     all : $(target)
> (There's a lot more in the actual makefile, but this is enough
> to provoke the crash).  If I invoke make -d on this makefile,
> the output is:
>     GNU Make 3.81
>     Copyright (C) 2006  Free Software Foundation, Inc.
>     This is free software; see the source for copying conditions.
>     There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
>     This program built for Windows32
>     find_and_set_shell path search set default_shell = C:/UWIN/usr/bin/sh.exe
>     Reading makefiles...
>     Reading makefile `GNUmakefile'...
>     CreateProcess(NULL,sh C:\UWIN\usr\bin\pwd,...)
>     /C/UWIN\usr\bin\pwd: line 4: uwin\usr\bin\pwd: not found                  

I don't have UWIN installed, so I need more help from you to try to
find out what could go wrong.

My crystal ball says that you have a file C:/UWIN/usr/bin/pwd on your
system.  If that is true, please tell what kind of file is that.  Is
it a shell script (in which case please show its contents) or a binary
program?  If it's a binary program, does it help to rename it to

The story behind this is that $(shell) is not supposed to work with
shell builtins that are not listed in sh_cmds[] (see
job.c:construct_command_argv_internal).  I tried your example makefile
on a GNU/Linux box, and as soon as I remove /bin/pwd from PATH,
$(shell pwd) returns an empty string, which is a clear sign that it
fails to run the command.

(Paul, did I get this right? does the last paragraph correctly
describes the expected behavior?)

So you should either have an external program named pwd, or the OS
itself should be able to somehow find the command and run it (which in
this case cannot work, since there's no such intrinsic command on

That said, there are some tricky details in how the Windows port of
Make searches for external commands, and my questions above are meant
to figure out what did the code do on your system (alternatively, step
with a debugger into the function process_begin, defined on
w32/subproc/sub_proc.c, and see what it does in your case).

On my system, there's pwd.exe (from GNU Coreutils) on PATH, and with
it the makefile works correctly.  If I rename pwd.exe, $(shell pwd)
fails to run, and its return value is empty, as I'd expect.

> I then get a Windows pop-up saying that make.exe has encountered
> a problem, and asking if I want to send a bug report to
> Microsoft.

This certainly does NOT happen on my system!  Maybe when I understand
what kind of file is C:/UWIN/usr/bin/pwd, I will be able to figure out
what kind of trouble can it cause.  Again, if you can run Make under a
debugger, perhaps you yourself could identify the reason for the crash.

> (Using an external command, instead of the shell built-in pwd,
> in the first example, doesn't change anything.)

Shell's built-in is not supposed to work here, but an external command
_should_ work, as explained above.  Please describe what exactly did
you do to use an external command, and how it failed.  I'd like to see
the output of "make -d" when there's an external pwd.exe somewhere on
your PATH.

> (Another wierd problem: when I redirect the output of make to a
> file, i.e. "make >make.log 2>&1", everything works, the colors
> for new text in the window change.

Do you type this command from the cmd.exe prompt, or from the UWIN
shell's prompt?  If the latter, it could be some problem with UWIN's
shell (possibly caused by the crash in Make); please try from cmd.exe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]