Discussion:
process_begin: CreateProcess(NULL, "", ...) failed
Fabrice GIRARDOT
2008-03-17 13:34:06 UTC
Permalink
Hi all.

Using GNU Make 3.81 compiled for Win32, I got this error message
when I run Make with the "-n" option :

process_begin: CreateProcess(NULL, "", ...) failed

After some investigations, it is linked to a $(shell xxx)
command present in my Makefile.

Here is a small Makefile that shows the problem :

-------- Makefile ----------

SHELL := cmd.exe

MY_VAR := $(shell echo hello world)
$(info MY_VAR=$(MY_VAR))

.PHONY: all

all:
@echo Doing target $@

-------- /Makefile ---------

and the corresponding output :

C:\my_dir>gnumake
MY_VAR=hello world
Doing target all

C:\my_dir>gnumake -n
process_begin: CreateProcess(NULL, "", ...) failed.
MY_VAR=
echo Doing target all

I had a look at the archive of this list, but could not find
any related topic.


Any ideas ?


For information, my gnumake is a out-of-the-box compilation
of make using "build_w32.bat".


Regards.
--
Fabrice GIRARDOT
Eli Zaretskii
2008-03-17 20:38:27 UTC
Permalink
Date: Mon, 17 Mar 2008 14:34:06 +0100
Using GNU Make 3.81 compiled for Win32, I got this error message
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81. If you can build Make from
sources, please try the following two patches (apply them in order):

2006-05-27 Eli Zaretskii <***@gnu.org>

* function.c (func_shell) [WINDOWS32]: Reset just_print_flag
around the call to construct_command_argv, so that a temporary
batch file _is_ created when needed for $(shell).


--- function.c~0 2006-04-01 12:36:40.000000000 +0300
+++ function.c 2006-05-27 15:58:26.984375000 +0300
@@ -1589,12 +1589,25 @@ func_shell (char *o, char **argv, const
int pid;

#ifndef __MSDOS__
+#ifdef WINDOWS32
+ /* Reset just_print_flag. This is needed on Windows when batch files
+ are used to run the commands, because we normally refrain from
+ creating batch files under -n. */
+ int j_p_f = just_print_flag;
+
+ just_print_flag = 0;
+#endif
/* Construct the argument list. */
command_argv = construct_command_argv (argv[0],
(char **) NULL, (struct file *) 0,
&batch_filename);
if (command_argv == 0)
- return o;
+ {
+#ifdef WINDOWS32
+ just_print_flag = j_p_f;
+#endif
+ return o;
+ }
#endif

/* Using a target environment for `shell' loses in cases like:
@@ -1622,12 +1635,14 @@ func_shell (char *o, char **argv, const
#ifdef WINDOWS32

windows32_openpipe (pipedes, &pid, command_argv, envp);
+ /* Restore the value of just_print_flag. */
+ just_print_flag = j_p_f;

if (pipedes[0] < 0) {
/* open of the pipe failed, mark as failed execution */
shell_function_completed = -1;

- return o;
+ return o;
} else

#elif defined(__MSDOS__)



2007-07-21 Eli Zaretskii <***@gnu.org>

* function.c (func_shell): Call construct_command_argv with zero
value of FLAGS.

* job.c (construct_command_argv_internal): New argument FLAGS; all
callers changed.
[WINDOWS32]: If FLAGS has the COMMANDS_RECURSE bit set, ignore
just_print_flag.

* job.h (construct_command_argv_internal): Update prototype.

--- job.c~1 2006-08-19 09:25:07.687500000 +0300
+++ job.c 2007-07-21 16:35:37.391750000 +0300
@@ -1018,7 +1018,9 @@
#ifdef VMS
argv = p;
#else
- argv = construct_command_argv (p, &end, child->file, &child->sh_batch_file);
+ argv = construct_command_argv (p, &end, child->file,
+ child->file->cmds->lines_flags[child->command_line - 1],
+ &child->sh_batch_file);
#endif
if (end == NULL)
child->command_ptr = NULL;
@@ -2193,11 +2195,17 @@
If *RESTP is NULL, newlines will be ignored.

SHELL is the shell to use, or nil to use the default shell.
- IFS is the value of $IFS, or nil (meaning the default). */
+ IFS is the value of $IFS, or nil (meaning the default).
+
+ FLAGS is the value of lines_flags for this command line. It is
+ used in the WINDOWS32 port to check whether + or $(MAKE) were found
+ in this command line, in which case the effect of just_print_flag
+ is overridden. */

static char **
construct_command_argv_internal (char *line, char **restp, char *shell,
- char *ifs, char **batch_filename_ptr)
+ char *ifs, int flags,
+ char **batch_filename_ptr)
{
#ifdef __MSDOS__
/* MSDOS supports both the stock DOS shell and ports of Unixy shells.
@@ -2776,7 +2784,7 @@
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these
cases, run commands via a script file. */
- if (just_print_flag) {
+ if (just_print_flag && !(flags & COMMANDS_RECURSE)) {
/* Need to allocate new_argv, although it's unused, because
start_job_command will want to free it and its 0'th element. */
new_argv = (char **) xmalloc(2 * sizeof (char *));
@@ -2820,7 +2828,7 @@
if (unixy_shell)
new_argv = construct_command_argv_internal (new_line, (char **) NULL,
(char *) 0, (char *) 0,
- (char **) 0);
+ flags, (char **) 0);
#ifdef __EMX__
else if (!unixy_shell)
{
@@ -2930,7 +2938,7 @@

char **
construct_command_argv (char *line, char **restp, struct file *file,
- char **batch_filename_ptr)
+ int cmd_flags, char **batch_filename_ptr)
{
char *shell, *ifs;
char **argv;
@@ -3042,7 +3050,8 @@
warn_undefined_variables_flag = save;
}

- argv = construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr);
+ argv = construct_command_argv_internal (line, restp, shell, ifs,
+ cmd_flags, batch_filename_ptr);

free (shell);
free (ifs);
--- job.h~1 2006-08-12 15:44:06.875000000 +0300
+++ job.h 2007-07-21 16:21:39.110500000 +0300
@@ -70,7 +70,7 @@
extern void reap_children PARAMS ((int block, int err));
extern void start_waiting_jobs PARAMS ((void));

-extern char **construct_command_argv PARAMS ((char *line, char **restp, struct file *file, char** batch_file));
+extern char **construct_command_argv PARAMS ((char *line, char **restp, struct file *file, int cmd_flags, char** batch_file));
#ifdef VMS
extern int child_execute_job PARAMS ((char *argv, struct child *child));
#elif defined(__MSDOS__) || defined(__EMX__)
--- function.c~1 2006-05-27 17:37:47.453125000 +0300
+++ function.c 2007-07-21 16:22:48.126125000 +0300
@@ -1600,7 +1600,7 @@
/* Construct the argument list. */
command_argv = construct_command_argv (argv[0],
(char **) NULL, (struct file *) 0,
- &batch_filename);
+ 0, &batch_filename);
if (command_argv == 0)
{
#ifdef WINDOWS32
@@ -1799,7 +1799,7 @@

/* Construct the argument list. */
command_argv = construct_command_argv (argv[0], (char **) NULL,
- (struct file *) 0, &batch_filename);
+ (struct file *) 0, 0, &batch_filename);
if (command_argv == 0)
return o;
Fabrice GIRARDOT
2008-03-18 10:37:38 UTC
Permalink
Post by Eli Zaretskii
Post by Fabrice GIRARDOT
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81. If you can build Make from
I successfully applied these 2 patches, and the bug has gone away.
Thanks for your help.


Regards.
--
Fabrice GIRARDOT
Micha Meyer
2010-06-09 08:03:00 UTC
Permalink
Post by Fabrice GIRARDOT
Post by Eli Zaretskii
Post by Fabrice GIRARDOT
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81. If you can build Make from
I successfully applied these 2 patches, and the bug has gone away.
Thanks for your help.
Regards.
Could you provide the patched .exe (I can't build windows gmake here)?
That would be great!

Micha
ruzrulit
2015-07-13 12:53:00 UTC
Permalink
Post by Fabrice GIRARDOT
Post by Eli Zaretskii
Post by Fabrice GIRARDOT
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81. If you can build Make from
I successfully applied these 2 patches, and the bug has gone away.
Thanks for your help.
Regards.
--
Fabrice GIRARDOT
_______________________________________________
Make-w32 mailing list
http://lists.gnu.org/mailman/listinfo/make-w32
Hello dear Fabrice,

I also have the same issues and dont know how to solve them.
Could you please send me that Make that u got after patching?

With best regards,
Ruzalin



--
View this message in context: http://gnu-make.2324884.n4.nabble.com/process-begin-CreateProcess-NULL-failed-tp13819p16426.html
Sent from the Gnu - Make - W32 mailing list archive at Nabble.com.
Eli Zaretskii
2015-07-13 15:25:38 UTC
Permalink
Date: Mon, 13 Jul 2015 05:53:00 -0700 (PDT)
Post by Fabrice GIRARDOT
Post by Eli Zaretskii
Post by Fabrice GIRARDOT
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81. If you can build Make from
I successfully applied these 2 patches, and the bug has gone away.
Thanks for your help.
Regards.
--
Fabrice GIRARDOT
_______________________________________________
Make-w32 mailing list
http://lists.gnu.org/mailman/listinfo/make-w32
Hello dear Fabrice,
I also have the same issues and dont know how to solve them.
Could you please send me that Make that u got after patching?
You can find precompiled binaries of the latest release of GNU Make
for MS-Windows here:

http://sourceforge.net/projects/ezwinports/files/make-4.1-with-guile-w32-bin.zip/download
http://sourceforge.net/projects/ezwinports/files/make-4.1-without-guile-w32-bin.zip/download
ruzrulit
2015-07-13 18:56:40 UTC
Permalink
Thank you very much, i've done that with make 4.1 and it worked!
Post by Eli Zaretskii
Date: Mon, 13 Jul 2015 05:53:00 -0700 (PDT)
From: ruzrulit < [hidden email] >
Post by Fabrice GIRARDOT
Post by Fabrice GIRARDOT
process_begin: CreateProcess(NULL, "", ...) failed
Yes, this is a known bug in Make 3.81.  If you can build Make from
I successfully applied these 2 patches, and the bug has gone away.
Thanks for your help.
Regards.
--
Fabrice GIRARDOT
_______________________________________________
Make-w32 mailing list
http://lists.gnu.org/mailman/listinfo/make-w32
Hello dear Fabrice,
I also have the same issues and dont know how to solve them.
Could you please send me that Make that u got after patching?
You can find precompiled binaries of the latest release of GNU Make
  http://sourceforge.net/projects/ezwinports/files/make-4.1-with-guile-w32-bin.zip/download
  http://sourceforge.net/projects/ezwinports/files/make-4.1-without-guile-w32-bin.zip/download
_______________________________________________
Make-w32 mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/make-w32
----------------------------------------------------------------------
If you reply to this email, your message will be added to the discussion below: http://gnu-make.2324884.n4.nabble.com/process-begin-CreateProcess-NULL-failed-tp13819p16427.html
To unsubscribe from process_begin: CreateProcess(NULL, "", ...) failed, click here .
NAML
Freundliche GrÌße
Ruzalin Galiev




--
View this message in context: http://gnu-make.2324884.n4.nabble.com/process-begin-CreateProcess-NULL-failed-tp13819p16429.html
Sent from the Gnu - Make - W32 mailing list archive at Nabble.com.
Loading...