Makefile and symbolic links

一曲冷凌霜 提交于 2019-12-10 15:58:39

问题


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

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?


回答1:


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.

Example:

all:
    ln -nsf /tmp/foo /tmp/foo
    /tmp/foo/ln x y

Running "make" with this Makefile errors out with:

make: execvp: /tmp/foo/ln: Too many levels of symbolic links

So, how is your Makefile invoking ln, exactly? What is in your PATH etc.?

[update]

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


来源:https://stackoverflow.com/questions/7027740/makefile-and-symbolic-links

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!