Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 602
Colonel Beauvel Avatar asked Nov 12 '15 15:11

Colonel Beauvel


People also ask

How do you fix the system Cannot find the file specified error?

Use SFC to fix system cannot finds the file specified error. In Command Prompt, type the following command: “sfc /scannow”. Now press Enter. After scanning and correcting errors, restart the computer and check if the “system cannot find the file specified” error is fixed.

How do I clean my MakeFile?

The Cleanup Rule clean: rm *.o prog3 This is an optional rule. It allows you to type 'make clean' at the command line to get rid of your object and executable files. Sometimes the compiler will link or compile files incorrectly and the only way to get a fresh start is to remove all the object and executable files.

What is a MakeFile target?

A simple makefile consists of "rules" with the following shape: target ... : dependencies ... command ... ... A target is usually the name of a file that is generated by a program; examples of targets are executable or object files.


1 Answers

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.

like image 170
Etan Reisner Avatar answered Sep 18 '22 21:09

Etan Reisner