问题描述
我遇到一个关于makefile的奇怪问题.我只是想在makefile中设置一个符号链接,但是在一台机器上(Linux 2.6.18-238.12.1.el5)收到一条错误消息
I'm experiencing a strange problem with a makefile. I simply want to set a symbolic link in the makefile but get an error message on one machine (Linux 2.6.18-238.12.1.el5)
make: execvp: ln: Too many levels of symbolic links
它在我的MacBook上运行正常.如果我在shell中执行相同的命令,它也可以正常工作.可能出什么问题了?是否有任何对ln
重要的环境变量?
It works perfectly fine on my MacBook. It also works fine if I execute the same command in the shell. What could go wrong? Are there any environment variables important for ln
?
推荐答案
错误消息中的execvp
是关键.我相信这是在试图查找ln命令本身的同时,符号链接的级别太多了.
The execvp
in the error message is the key, I think. I believe it is saying there are too many levels of symbolic links while trying to locate the ln command itself.
示例:
all:
ln -nsf /tmp/foo /tmp/foo
/tmp/foo/ln x y
使用此Makefile运行"make"时出现以下错误:
Running "make" with this Makefile errors out with:
make: execvp: /tmp/foo/ln: Too many levels of symbolic links
那么,您的Makefile究竟如何调用ln
?您的PATH
等中有什么?
So, how is your Makefile invoking ln
, exactly? What is in your PATH
etc.?
[更新]
我敢打赌,Makefile弄乱了您的PATH.这是一个Makefile,可再现您的确切错误消息:
I bet the Makefile is messing up your PATH. Here is a Makefile that reproduces your exact error message:
PATH=/tmp/foo
all:
/bin/ln -nsf /tmp/foo /tmp/foo
ln x y
这篇关于Makefile和符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!