我正在用MinGW系统编译Xindy。dmake总是死于一个错误,我已经在Makefile中把它缩小到了几行。尝试在下面的命令上运行dmake:
SHELL = /bin/sh
some-target:
target=`echo info-recursive | sed s/-recursive//`;如果您使用常规的Windows CMD而不是MinGW shell,则必须更改SHELL变量的位置,使其指向类似于"C:/MinGW/msys/1.0/sh.exe“的内容。无论如何,上述操作都会失败,出现以下错误:
CreateProcess failed (2).
dmake: Error executing 'bin/sh /S /c "target=`echo info-recursive | sed s/-recursive//`;"': No such file or directory
dmake: Error code -1, while making 'some-target'安装了Sed和sh,它们工作得很好。当我尝试将给定的命令作为错误消息本身的输出运行时,得到的结果是:
$ /bin/sh /S /c "target=`echo info-recursive | sed s/-recursive//`;"
/bin/sh: /S: No such file or directory所以看起来dmake (或其他东西)在shell参数中添加了'/S /c',而bash认为它是一个文件名,然后当它找不到它时就失败了。
有没有人有这方面的经验,或者知道我如何解决这个问题?
发布于 2012-09-05 07:12:58
对dmake源代码的简要检查表明,问题在于$(SHELL)设置得太晚,并且在启动时仍然为空(macros.mk,第37行):
11 .IF $(SHELL) == $(NULL)
...
15 SHELL *:= $(COMSPEC)
...
...
35 .IF $(SHELL) == $(COMSPEC)
36 .IF $(COMSPEC:lf) == cmd.exe
37 SHELLFLAGS *:= $(SWITCHAR)S $(SWITCHAR)c您可以通过将SHELL="C:/MinGW/msys/1.0/sh.exe"添加到dmake命令行调用来解决此问题。
(我已经很多年没有用过dmake了,所以这里可能会弄错,但是如果你能得到一个看起来像是自动没收的makefile来使用dmake,我会很惊讶,IIRC有一些不同的风格。可能更容易找到GNU make或类似的产品。)
https://stackoverflow.com/questions/12270987
复制相似问题