make-w32
[Top][All Lists]
Advanced

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

Incorrect use of CreateProcess() call in make?


From: Jani
Subject: Incorrect use of CreateProcess() call in make?
Date: Fri, 9 Jan 2004 18:00:28 +0200 (GTB Standard Time)

I've had some strange compilation problems which I think can be traced to
CreateProcess() call in make (3.79.1 mingw version). I haven't debugged
nor looked into the sources of make, but the symptoms point in that
direction.

YOu'd expect make to use the tools that can be found in PATH, and those
only. I found out that make uses java.exe from my Windows system32
directory, whether or not a different java.exe can be found in PATH, even
if the system32 directory is not in PATH at all.

The problem is, if CreateProcess() is given a file name without directory
path, according to MS developer network, the system searches for the
executable in the directory where make executable was found, in the
current directory, both Windows system directories and the Windows
directory BEFORE looking at the PATH. So, very easily, a wrong version of
a compiler or any tool could be used.

Whenever make uses a shell to execute commands, no problems arise.
Apparently cmd.exe respects the PATH setting.

Clearly this problem could be worked around using either full paths to the
tools or using a separate batch file to call the tools or forcing the use
of a shell (i.e. cmd /c), but this isn't very neat.

If my interpretation of what's going on is correct, I'd say this is a bug
in the Windows port. I'd appreciate any comments or other workarounds. Is
there an option in make to force the use of a shell for command execution?


Jani.


>8------
An example:
 - java.exe can be found in both c:\jdk1.3\bin and c:\winnt\system32
 - c:\winnt\system32 is not in PATH
 - which looks at PATH only

Makefile:

all:
        which java.exe
        java -version

Make:

% make -d all
[a lot of garbage removed here and there]
which java.exe
c:\jdk1.3\bin\java.exe
java -version
CreateProcess(C:\WINNT\system32\java.exe,java -version,...)
[etc]
------>8





reply via email to

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