简体   繁体   English

为什么从make文件中查找命令失败

[英]Why find command failing from make file

I am working on modifying a windows make file. 我正在修改Windows Make文件。 The file, which is part of legacy build code has the following lines -- 该文件是旧版构建代码的一部分,具有以下几行内容-

    WROOT := "MyBuild/win/Program Files/Windows Kits/10" 


   ROOT_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path $(WROOT_WIN10_SDK)/Include/[0-9.]* )

The SHELL variable is mapped to bin/sh but when I print the variable ROOT_SDK_Version, it is empty. SHELL变量映射到bin / sh,但是当我打印变量ROOT_SDK_Version时,它为空。 However, when I manually invoke the find command with the same arguments, it is giving the expected out. 但是,当我使用相同的参数手动调用find命令时,它给出了预期的结果。

To debug this issue, I modified above line in make file as below 为了调试此问题,我修改了make文件中的以下行,如下所示

ROOT_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path $(WROOT_WIN10_SDK)/Include/[0-9.]* 2> output.txt )

And I see the contents of the file output.txt after running make - 我在运行make后看到文件output.txt的内容-

find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

So why is the find command failing when running from make file but is successful when I run it manually using the same arguments? 那么,为什么从make文件运行时find命令失败,但是当我使用相同的参数手动运行它时却成功了? Any pointers appreciated. 任何指针表示赞赏。

Providing more context- 提供更多背景信息-

WROOT_WIN10_SDK := "$(GOBUILD_CAYMAN_MSVC_DESKTOP_ROOT)/win/Program Files/Windows Kits/10" WROOT_WIN10_SDK:=“ $(GOBUILD_CAYMAN_MSVC_DESKTOP_ROOT)/ win / Program Files / Windows Kits / 10”

The variable GOBUID...is== E:/Myscpetre20/depot/sim/sim-20fq1/build/gobuild/compcache/cayman_msvc_desktop/ob-11144741/windows2016-clean 变量GOBUID ... is == E:/ Myscpetre20 / depot / sim / sim-20fq1 / build / gobuild / compcache / cayman_msvc_desktop / ob-11144741 / windows2016-clean

So WROOT_WIN10_SDK is == "E:/Myscpetre20/depot/sim/sim-20fq1/build/gobuild/compcache/cayman_msvc_desktop/ob-11144741/windows2016-clean/win/Program Files/Windows Kits/10" 因此WROOT_WIN10_SDK = =“ E:/ Myscpetre20 / depot / sim / sim-20fq1 / build / gobuild / compcache / cayman_msvc_desktop / ob-11144741 / windows2016-clean / win / Program Files / Windows Kits / 10”

I think the argument to the -path option needs to be quoted -- otherwise the glob * will be expanded by the shell rather than being passed to find . 我认为-path选项的参数需要用引号引起来-否则glob *将由shell扩展,而不是传递给find So... 所以...

   ROOT_SDK_Version := $(shell find $(WROOT_WIN10_SDK)/Include -maxdepth 1 -type d -path '$(WROOT_WIN10_SDK)/Include/[0-9.]*' )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 批处理文件如何使用findstr命令查找文本并将其设置为变量? - Batch file how to use findstr command to find a text and make it a variable? lua.vm.js 构建失败(make (e=2): 系统找不到指定的文件。) - lua.vm.js is failing to build (make (e=2): The system cannot find the file specified.) 为什么REG DELETE命令在此批处理脚本中失败? - Why is the REG DELETE command failing in this batch script? 为什么python virtualenv命令在Windows 10上失败? - Why is the python virtualenv command failing on Windows 10? 为什么FormatMessage()无法找到有关WinINet错误的消息? - Why is FormatMessage() failing to find a message for WinINet errors? 如何找到MSI文件并从命令行启动安装? - How to find an MSI file and launch installation from command line? 如何在失败的Windows批处理命令中使jenkins失败? - How to make jenkins fail at a failing windows batch command? 为什么我不能从命令提示符运行这个 exe 文件? - why can't I run this exe file from the command prompt? 为什么Perl系统调用无法调用内部Windows命令? - Why is Perl system call failing to invoke internal Windows command? 为什么AWS-ConfigureWindowsUpdate SSM运行命令失败? - Why is AWS-ConfigureWindowsUpdate SSM Run Command Failing?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM