No rule to make foo.cpp needed by foo.o ???

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Mon Dec 21 07:05:38 UTC 2009

Deepak Mathews said the following on 12/21/09 16:52:
> Are you sure about the path to foo.cpp in the makefile is correctly set 
> during compilation.

Yes paths are fine.

> It also can be a timestamp issue, but only if the updated file has a 
> modification time might be trivial... but the if system time 
> is behind it can cause this issue.. 

I discovered that simply re-issuing the build command also fixes it. 
Just seems to take two goes to get it right.

And the build machine time is slightly behind the fileserver on which 
the source files reside, so I think it is a timestamp issue.


> On Mon, Dec 21, 2009 at 8:46 AM, David Holmes - Sun Microsystems 
> <David.Holmes at <mailto:David.Holmes at>> wrote:
>     I'm doing a build and get a compilation error in foo.cpp, so I fix
>     the problem that caused the error and make then aborts with
>     "No rule to make target 'foo.cpp' needed by 'foo.o'. Stop"
>     I have to do a clean and then re-build to get past this.
>     This is building hotspot on linux and the make version is 3.81
>     This is driving me nuts and wasting a lot of time!
>     Anyone got any idea why make is doing this? It is as-if it can't
>     find the updated cpp file. Could it be a timestamp issue?
>     Thanks,
>     David Holmes

More information about the build-dev mailing list