Makefile error make (e=2): The system cannot find the file specified

Colonel Beauvel picture Colonel Beauvel · Nov 12, 2015 · Viewed 66.7k times · Source

I am using a makefile in windows to push some files on a Unix server (here a text file "blob.txt" in the same folder of my makefile). My makefile script is:

setup:
        pscp blob.txt username@hostname:/folder/

I start a command prompt, go in the folder where blob.txt and the makefile are present and type:

make setup

Which results in:

pscp blob.txt username@hostname:/folder/
process_begin: CreateProcess(NULL, pscp blob.txt username@hostname:/folder/, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [setup] Error 2

In a #fail ... whereas if I enter directly the command in the command prompt:

pscp blob.txt username@hostname:/folder/

It works ... I really wonder why.

Answer

Etan Reisner picture Etan Reisner · Nov 12, 2015

The error

process_begin: CreateProcess(NULL, pscp blob.txt username@hostname:/folder/, ...) failed.
make (e=2): The system cannot find the file specified.

is almost certainly complaining that Windows cannot find pscp.

This is almost certainly because the value of %PATH% (or whatever) is different when make spawns a shell/console then when you have it open manually.

Compare the values to confirm that. Then either use the full path to pscp in the makefile recipe or ensure that the value of PATH is set correctly for make's usage.