Incorrect path and shell script error

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Incorrect path and shell script error

Loch Brandon
Hello,
I am having the following issue while trying to run make.exe


I am using version 3.78.1.

It was working a few months ago until I created a new Windows profile. The path that is used in the error doesn't exist.

Could this be an issue with my PATH?
Do you know of any fix or work around for this?

Thanks,
Brandon
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect path and shell script error

Paul Smith-20
On Wed, 2020-05-06 at 21:06 +0000, Loch Brandon wrote:
> Hello,
> I am having the following issue while trying to run make.exe

Please cut and paste text into emails rather than insert screenshots...
we can't quote, search, etc. a screenshot.

> I am using version 3.78.1.

I don't know if you're aware but GNU make 3.78.1 was released over 20
years ago, in Sep 1999...

> It was working a few months ago until I created a new Windows
> profile. The path that is used in the error doesn't exist.

That error refers to a temporary file that make created to write the
recipe commands that it wanted to run, then it ran the temporary file
(which printed that error), then it deleted the temporary file.

The error is in that temporary file, which means that the error is in
the makefile recipe.

If you can find the recipe in your makefile for the "dirs" target,
which is the one that failed, and show that to us (again, please copy
and paste text, do not insert screenshots) we may be able to see the
problem.

Also, if you remove the "@" prefix characters from the recipe for the
"dirs" target then run make, make will print out what it's going to put
into that temporary file and probably you will be able to see that
something is wrong there.

> Could this be an issue with my PATH?
> Do you know of any fix or work around for this?

Without more info that's about all we can say.


Reply | Threaded
Open this post in threaded view
|

Re: Incorrect path and shell script error

Loch Brandon
dirs:
@$(ECHO) ------------------------------------------------------------------------------
@$(ECHO) Verifying and building application directory structure...
@if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)
@if not exist $(OUTPUTDIR)\$(notdir $(OBJDIR)) $(MKDIR) $(OUTPUTDIR)\$(notdir $(OBJDIR))
@if not exist $(OUTPUTDIR)\$(notdir $(DEPDIR)) $(MKDIR) $(OUTPUTDIR)\$(notdir $(DEPDIR))
@if not exist "$(CONTROL_PROGRAM)" $(ECHO) !!! Warning: Compiler not found, searching at (CONTROL_PROGRAM): $(CONTROL_PROGRAM) !!!
@if not exist "$(CONTROL_PROGRAM)" EXIT 1
@$(ECHO) ------------------------------------------------------------------------------


When running without the '@' this is the result:
echo Verifying and building application directory structure...
Verifying and building application directory structure...
if not exist output mkdir output

Then it hits the error.

Thanks,
Brandon


From: Paul Smith <[hidden email]>
Sent: Wednesday, May 6, 2020 6:34 PM
To: Loch Brandon <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Incorrect path and shell script error
 
On Wed, 2020-05-06 at 21:06 +0000, Loch Brandon wrote:
> Hello,
> I am having the following issue while trying to run make.exe

Please cut and paste text into emails rather than insert screenshots...
we can't quote, search, etc. a screenshot.

> I am using version 3.78.1.

I don't know if you're aware but GNU make 3.78.1 was released over 20
years ago, in Sep 1999...

> It was working a few months ago until I created a new Windows
> profile. The path that is used in the error doesn't exist.

That error refers to a temporary file that make created to write the
recipe commands that it wanted to run, then it ran the temporary file
(which printed that error), then it deleted the temporary file.

The error is in that temporary file, which means that the error is in
the makefile recipe.

If you can find the recipe in your makefile for the "dirs" target,
which is the one that failed, and show that to us (again, please copy
and paste text, do not insert screenshots) we may be able to see the
problem.

Also, if you remove the "@" prefix characters from the recipe for the
"dirs" target then run make, make will print out what it's going to put
into that temporary file and probably you will be able to see that
something is wrong there.

> Could this be an issue with my PATH?
> Do you know of any fix or work around for this?

Without more info that's about all we can say.

Reply | Threaded
Open this post in threaded view
|

Windows shell discovery (was: Re: Incorrect path and shell script error)

Paul Smith-20
On Thu, 2020-05-07 at 18:41 +0000, Loch Brandon wrote:

> dirs:
> @$(ECHO) ------------------------------------------------------------
> @$(ECHO) Verifying and building application directory structure...
> @if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)
> @if not exist $(OUTPUTDIR)\$(notdir $(OBJDIR)) $(MKDIR)
> $(OUTPUTDIR)\$(notdir $(OBJDIR))
> @if not exist $(OUTPUTDIR)\$(notdir $(DEPDIR)) $(MKDIR)
> $(OUTPUTDIR)\$(notdir $(DEPDIR))
> @if not exist "$(CONTROL_PROGRAM)" $(ECHO) !!! Warning: Compiler not
> found, searching at (CONTROL_PROGRAM): $(CONTROL_PROGRAM) !!!
> @if not exist "$(CONTROL_PROGRAM)" EXIT 1
> @$(ECHO) ------------------------------------------------------------

The above scripting is all written in Windows command.com batch file
syntax.

> When running without the '@' this is the result:
> echo Verifying and building application directory structure...
> Verifying and building application directory structure...
> if not exist output mkdir output
>
> Then it hits the error.

The error you see implies that make is trying to invoke a POSIX shell
rather than Windows command.com.  The above syntax is not legal POSIX
shell syntax.

I am not really familiar with how make on Windows determines which type
of shell to run, especially such an old version ad 3.78.1.  However,
something on your system changed which is causing this.  Maybe you
installed some new software such as Git for Windows, and make can now
find a POSIX shell where it didn't used to be able to find one.

Maybe some setting of the make SHELL variable in your makefile can
convence make to use command.com, but I'm not sure.

Maybe someone with more experience on Windows than I can comment.


Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Eli Zaretskii
> From: Paul Smith <[hidden email]>
> Date: Thu, 07 May 2020 15:20:39 -0400
>
> Maybe some setting of the make SHELL variable in your makefile can
> convence make to use command.com, but I'm not sure.
>
> Maybe someone with more experience on Windows than I can comment.

Yes, "SHELL = cmd.exe" in the Makefile should be a good first step.

Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Loch Brandon
Alright so I added the path to the cmd.exe and I now see a different error. This is the output while running make.

C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
echo ------------------------------------------------------------------------------
A subdirectory or file C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh already exists.
Error occurred while processing: C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh.
make: *** [dirs] Error 1

From: Eli Zaretskii <[hidden email]>
Sent: Thursday, May 7, 2020 2:26 PM
To: [hidden email] <[hidden email]>
Cc: Loch Brandon <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
> From: Paul Smith <[hidden email]>
> Date: Thu, 07 May 2020 15:20:39 -0400
>
> Maybe some setting of the make SHELL variable in your makefile can
> convence make to use command.com, but I'm not sure.
>
> Maybe someone with more experience on Windows than I can comment.

Yes, "SHELL = cmd.exe" in the Makefile should be a good first step.
Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Eli Zaretskii
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>
> Date: Thu, 7 May 2020 19:47:58 +0000
>
> Alright so I added the path to the cmd.exe and I now see a different error.

I didn't say to add the path to cmd.exe.  I meant to write exactly
this line in the beginning of the Makefile:

  SHELL = cmd.exe

> This is the output while running make.
>
> C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
> echo ------------------------------------------------------------------------------
> A subdirectory or file C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh already exists.
> Error occurred while processing: C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh.
> make: *** [dirs] Error 1

This probably means your old version of Make doesn't support
"SHELL = cmd.exe".  I guess I've misremembered when this was added.
The bottom line is that your Make is too old to handle the situation
with PATH and Unix shell availability on your system.

So my suggestion is to do either of the following:

  . find out what changed on your system that this Makefile started
    failing (Paul's hypothesis about Git for Windows making sh.exe
    appear on PATH sounds in the right direction), and fix it

  . rewrite your Makefile to invoke cmd.exe explicitly.  For example,
    instead of

      @if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)

    write something like

      @cmd.exe /c if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)

  . upgrade to a newer version of Make, where SHELL = cmd.exe should
    fix the problem.

In general, as Paul said, your problems happen because the Makefile
commands are supposed to be run by cmd.exe, but for some reason Make
invokes sh.exe to run them.  If none of the above advice helps,
finding out why Make calls sh.exe now where it didn't before should
provide a clue for how to fix the problem.

Reply | Threaded
Open this post in threaded view
|

Re: Incorrect path and shell script error

Edward Welbourne-3
In reply to this post by Loch Brandon
Loch Brandon (7 May 2020 20:41) wrote:
> @if not exist $(OUTPUTDIR)\$(notdir $(OBJDIR)) $(MKDIR) $(OUTPUTDIR)\$(notdir $(OBJDIR))

> When running without the '@' this is the result:
> echo Verifying and building application directory structure...
> Verifying and building application directory structure...
> if not exist output mkdir output
>
> Then it hits the error.

Quoting the error message as text would be a kindness to the reader.

Not sure what's going wrong, but one thing that crosses my mind is that
\ is an escape character in make-files, so may be escaping the
$-expansion you were hoping for with $(notdir ...) - I believe the MS
command shell understands / as path separators also, so try replacing
each \ with a / in your commands and see if that helps.

        Eddy.

Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Loch Brandon
In reply to this post by Eli Zaretskii
Sorry I wasn't clear. I added the following command
SHELL := C:\Windows\System32\cmd.exe (which is what i meant by adding the path to cmd.exe)

I don't believe that it would be an issue with the escape characters because there are other developers that use this same makefile and have no issues with getting it to work. My windows profile was recreated which I believe lead to this issue. I'm not quite sure I know the impact that this had to my computer and other programs, since I have nothing to compare it to. 

The error I sent in the last email is what I get when adding the SHELL variable into the makefile.

Thanks,
Brandon

From: Eli Zaretskii <[hidden email]>
Sent: Friday, May 8, 2020 1:22 AM
To: Loch Brandon <[hidden email]>
Cc: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>
> Date: Thu, 7 May 2020 19:47:58 +0000
>
> Alright so I added the path to the cmd.exe and I now see a different error.

I didn't say to add the path to cmd.exe.  I meant to write exactly
this line in the beginning of the Makefile:

  SHELL = cmd.exe

> This is the output while running make.
>
> C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
> echo ------------------------------------------------------------------------------
> A subdirectory or file C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh already exists.
> Error occurred while processing: C:\Users\BL6896~1.JDN\AppData\Local\Temp\make75042.sh.
> make: *** [dirs] Error 1

This probably means your old version of Make doesn't support
"SHELL = cmd.exe".  I guess I've misremembered when this was added.
The bottom line is that your Make is too old to handle the situation
with PATH and Unix shell availability on your system.

So my suggestion is to do either of the following:

  . find out what changed on your system that this Makefile started
    failing (Paul's hypothesis about Git for Windows making sh.exe
    appear on PATH sounds in the right direction), and fix it

  . rewrite your Makefile to invoke cmd.exe explicitly.  For example,
    instead of

      @if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)

    write something like

      @cmd.exe /c if not exist $(OUTPUTDIR) $(MKDIR) $(OUTPUTDIR)

  . upgrade to a newer version of Make, where SHELL = cmd.exe should
    fix the problem.

In general, as Paul said, your problems happen because the Makefile
commands are supposed to be run by cmd.exe, but for some reason Make
invokes sh.exe to run them.  If none of the above advice helps,
finding out why Make calls sh.exe now where it didn't before should
provide a clue for how to fix the problem.
Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Eli Zaretskii
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Fri, 8 May 2020 14:42:31 +0000
>
> Sorry I wasn't clear. I added the following command
> SHELL := C:\Windows\System32\cmd.exe (which is what i meant by adding the path to cmd.exe)
>
> I don't believe that it would be an issue with the escape characters because there are other developers that
> use this same makefile and have no issues with getting it to work. My windows profile was recreated which I
> believe lead to this issue. I'm not quite sure I know the impact that this had to my computer and other
> programs, since I have nothing to compare it to.
>
> The error I sent in the last email is what I get when adding the SHELL variable into the makefile.

Do you have sh.exe on PATH?  If so, what happens if you remove its
directory from PATH, or temporarily rename sh.exe to something like
s.e? does the problem go away then?

Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Loch Brandon
Yes I did have sh.exe in my path. I removed it and this is what the following output was.

C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
------------------------------------------------------------------------------
Verifying and building application directory structure...
------------------------------------------------------------------------------ was unexpected at this time.
make: *** [dirs] Error 255

From: Eli Zaretskii <[hidden email]>
Sent: Friday, May 8, 2020 9:46 AM
To: Loch Brandon <[hidden email]>
Cc: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Fri, 8 May 2020 14:42:31 +0000
>
> Sorry I wasn't clear. I added the following command
> SHELL := C:\Windows\System32\cmd.exe (which is what i meant by adding the path to cmd.exe)
>
> I don't believe that it would be an issue with the escape characters because there are other developers that
> use this same makefile and have no issues with getting it to work. My windows profile was recreated which I
> believe lead to this issue. I'm not quite sure I know the impact that this had to my computer and other
> programs, since I have nothing to compare it to.
>
> The error I sent in the last email is what I get when adding the SHELL variable into the makefile.

Do you have sh.exe on PATH?  If so, what happens if you remove its
directory from PATH, or temporarily rename sh.exe to something like
s.e? does the problem go away then?
Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Loch Brandon
Nevermind I fixed this error and everything seems to be working perfectly. Thanks for the support. Looks like have sh.exe in my PATH was the issue.

Thanks,
Brandon

From: Loch Brandon <[hidden email]>
Sent: Friday, May 8, 2020 10:13 AM
To: Eli Zaretskii <[hidden email]>
Cc: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
Yes I did have sh.exe in my path. I removed it and this is what the following output was.

C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
------------------------------------------------------------------------------
Verifying and building application directory structure...
------------------------------------------------------------------------------ was unexpected at this time.
make: *** [dirs] Error 255

From: Eli Zaretskii <[hidden email]>
Sent: Friday, May 8, 2020 9:46 AM
To: Loch Brandon <[hidden email]>
Cc: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Fri, 8 May 2020 14:42:31 +0000
>
> Sorry I wasn't clear. I added the following command
> SHELL := C:\Windows\System32\cmd.exe (which is what i meant by adding the path to cmd.exe)
>
> I don't believe that it would be an issue with the escape characters because there are other developers that
> use this same makefile and have no issues with getting it to work. My windows profile was recreated which I
> believe lead to this issue. I'm not quite sure I know the impact that this had to my computer and other
> programs, since I have nothing to compare it to.
>
> The error I sent in the last email is what I get when adding the SHELL variable into the makefile.

Do you have sh.exe on PATH?  If so, what happens if you remove its
directory from PATH, or temporarily rename sh.exe to something like
s.e? does the problem go away then?
Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Eli Zaretskii
In reply to this post by Loch Brandon
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Fri, 8 May 2020 15:13:23 +0000
>
> Yes I did have sh.exe in my path. I removed it and this is what the following output was.
>
> C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
> ------------------------------------------------------------------------------
> Verifying and building application directory structure...
> ------------------------------------------------------------------------------ was unexpected at this time.
> make: *** [dirs] Error 255

Does it mean $(ECHO) was not defined at that point?

Did the rest of the commands execute correctly and did what they were
supposed to?

Reply | Threaded
Open this post in threaded view
|

Re: Windows shell discovery (was: Re: Incorrect path and shell script error)

Loch Brandon
Yes it was just a typo. i didn't have the '$' in the command. Everything else worked as expected.

Thanks for the support,
Brandon

From: Eli Zaretskii <[hidden email]>
Sent: Friday, May 8, 2020 11:04 AM
To: Loch Brandon <[hidden email]>
Cc: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Windows shell discovery (was: Re: Incorrect path and shell script error)
 
> From: Loch Brandon <[hidden email]>
> CC: "[hidden email]" <[hidden email]>, "[hidden email]" <[hidden email]>
> Date: Fri, 8 May 2020 15:13:23 +0000
>
> Yes I did have sh.exe in my path. I removed it and this is what the following output was.
>
> C:\Users\bl68969.JDNET\Projects\HHP2\Code\M2_501\ProgramSpecific\MakeFileBuild>make
> ------------------------------------------------------------------------------
> Verifying and building application directory structure...
> ------------------------------------------------------------------------------ was unexpected at this time.
> make: *** [dirs] Error 255

Does it mean $(ECHO) was not defined at that point?

Did the rest of the commands execute correctly and did what they were
supposed to?