4

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?

hanno
  • 6,401
  • 8
  • 48
  • 80
  • Are you sure that what you do on the command line is what your rule tries to do? Could you show us the rule? – Beta Aug 11 '11 at 14:59

1 Answers1

4

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
Nemo
  • 70,042
  • 10
  • 116
  • 153
  • I think you're right. When I call /bin/ln it works. Now I just need to figure out where it's messing up the paths. Thanks! – hanno Aug 13 '11 at 20:02