Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

windows - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...