Makefile : Clock skew detected

橙三吉。 提交于 2019-12-29 04:48:09

问题


My problem is whenever I try to compile using Makefile I get the following :

make: Warning: File `Board.c' has modification time 1.3e+03 s in the future
gcc -Wall -c -Wvla -lm Board.c -o Board.o
gcc -Wall -c -Wvla -lm PlayBoard.c -o PlayBoard.o
gcc -lm ErrorHandle.o Board.o PlayBoard.o -g -o PlayBoard
make: warning:  Clock skew detected.  Your build may be incomplete.

My Makefile is :

CC = gcc
FLAGS = -Wall -c -Wvla

PlayBoard: ErrorHandle.o Board.o PlayBoard.o
    $(CC) -lm ErrorHandle.o Board.o PlayBoard.o -g -o $@

PlayBoard.o: PlayBoard.c Board.o
    $(CC) $(FLAGS) -lm PlayBoard.c -o $@

Board.o : ErrorHandle.o Board.c Board.h
    $(CC) $(FLAGS) -lm Board.c -o $@

.PHONY : clean

clean:
    rm -f Board.o PlayBoard.o PlayBoard

all : PlayBoard

Thank you for your help.


回答1:


A possible solution is to touch every file in the source tree in order to update time-stamps:

Go to the root of the sub-tree an do:

find . -exec touch {} \; 

Then make clean and retry compilation.




回答2:


As denoted in a comment by stijn the message "Clock skew detected" is most commonly given if compiling sources located on an NFS mount and the NFS server's clock runs ahead the client's clock doing the compilation.




回答3:


I saw this in Eclipse a couple of times as well when doing some work on one of the University computers here. My data drive was a network drive and the clock difference between the network drive and the local machine was off.

Switching my workspace to a location on the local machine (C drive) fixed the problem




回答4:


type the following command

find -exec touch \{\} \;



回答5:


That message is usually an indication that some of your files have modification times later than the current system time. Since make decides which files to compile when performing an incremental build by checking if a source files has been modified more recently than its object file, this situation can cause unnecessary files to be built, or worse, necessary files to not be built.



来源:https://stackoverflow.com/questions/13745645/makefile-clock-skew-detected

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