Cygwin make 找不到 cygwin 命令
在尝试安装构建服务器时,我遇到了一个有趣的问题,所有 cygwin 命令都可以从 DOS 框运行,但有时从 make 调用时不起作用。更奇怪的是,有些 make 目标,如“clean”,工作,而其他目标,如“all”,则没有。
这是一个代表性的 makefile 摘录。引用已经确定了格式,但选项卡位于应有的位置,请相信我:
.PHONY: all
all: update_autoconstants
/usr/bin/rm -f $(OBJ_DIR)/myfile1.txt
rm -f $(OBJ_DIR)/myfile2.txt
.PHONY: clean
clean:
rm -f $(OBJ_DIR)/*.*
请注意,在“所有”中,一个 rm 调用具有完整路径,而一个则没有路径。另请注意 clean 的 rm 调用没有路径。
对此,对“make -C makefile all”的响应是:
/usr/bin/rm -f ../../obj/myfile1.txt
rm -f ../../obj/myfile2.txt
make: rm: Command not found
make: *** [all] Error 127
即。完整路径有效,无路径无效。然后让我头晕的是 make 中没有路径的“干净”目标工作正常。不仅仅是cygwin命令,make也找不到编译器。看起来很清楚,路径已经在某个地方被隐藏了,尽管设置了环境变量 PATH,但仅在 make 中 - 这在 DOS 提示符下工作得很好。
C:\>cygpath --unix c:\programme\cygwin\bin\rm
/usr/bin/rm
该机器在 VMWare ESX 上的虚拟机中运行 Windows Server 2003 德语,昨天完成了 cygwin 安装,安装在 c:\programme\cygwin\ 中,其他一切都是干净的普通 Windows 安装。
有什么想法吗?提前致谢。
While trying to install a build server I've run into a funny problem where all cygwin commands can be run from a DOS box but sometimes do not work when called from make. What's even more weird is some make targets, like 'clean', work and others, like 'all', do not.
Here's a representative makefile extract. The quoting has hosed the formatting but tabs are where they should be, trust me:
.PHONY: all
all: update_autoconstants
/usr/bin/rm -f $(OBJ_DIR)/myfile1.txt
rm -f $(OBJ_DIR)/myfile2.txt
.PHONY: clean
clean:
rm -f $(OBJ_DIR)/*.*
Notice that in 'all' one rm call has a full path and one has no path. Also notice that clean's rm call has no path.
To this the response to a 'make -C makefile all' is:
/usr/bin/rm -f ../../obj/myfile1.txt
rm -f ../../obj/myfile2.txt
make: rm: Command not found
make: *** [all] Error 127
ie. the full path works, the no-path does not. What then starts my head spinning is the 'clean' target in make with no path works fine. it's not just cygwin commands, make can't find the compiler either. It seems pretty clear that somewhere the path has been hosed, although the environment variable PATH is set, but only in make - this works fine from a DOS prompt.
C:\>cygpath --unix c:\programme\cygwin\bin\rm
/usr/bin/rm
The machine is running Windows Server 2003 German language in a virtual machine on VMWare ESX, the cygwin install was done yesterday, installed in c:\programme\cygwin\ and everything else is clean vanilla Windows installation.
Any ideas? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与其说是解决方案,不如说是解决方法——我们让所有 makefile 使用它们所需的 exe 文件的绝对路径,这在任何情况下都比搜索路径并获取找到的内容要好一些。
也许为了拯救某人,最好调用 cygwin 的 bin 目录中的一些谷歌搜索命令:
以及程序文件目录中的类似文件,如下所示:
希望有所帮助。
Not really so much of a solution as a workaround - we made all the makefiles use absolute paths to the exe files they need which is in any case a bit nicer than searching a path and taking what you find.
To perhaps save someone some Googling commands in cygwin's bin directory can best be called:
And similarly files in the program files directory like this:
Hope that helps.
我也遇到过同样的事情。
make 在 makefile 中未找到 rm。
我的解决方法是从 bash 中运行 makefile。以前我只是从 Windows cmd 框运行 make。这为我解决了问题,但又带来了新的问题。在 make 期间创建的某些文件的权限设置了非常奇怪的权限。
I've had the exact same thing.
rm not being found by make from within a makefile.
My workaround was to run the makefile from within bash. Previously I was just running make from a windows cmd box. This cured the problem for me, but created new issues. The permissions of some files that were created during the make had very odd permissions being set.