Makefile : Clock skew detected [duplicate]
Asked Answered
D

3

13

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.

Dupont answered 6/12, 2012 at 14:25 Comment(4)
Check the modification time of Board.c, it appears that you may have copied this from another source when in the time of creation is ahead of your machin. One solution could be run touch Board.c to set the modification time to current timeKebab
are the sources stored on a network location perhaps?Foreland
This isn't related to C in any way. This is a warning issued by make.Claribelclarice
@alk: I can't see any tacit evidence that would warrant this question to be protected. There aren't a lot of answers from low-rep members and there doesn't seem to be any immediate danger of this question being suddenly very popular and getting a lot of attention, either.Scagliola
M
39

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.

Mai answered 25/9, 2013 at 22:44 Comment(1)
Doing so let's you then always and ever compile all an everything, not just only the source files which had been touched due to code changes. At least for a large code base this probably is not what you want,.Claribelclarice
C
27

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.

Claribelclarice answered 6/12, 2012 at 15:5 Comment(2)
Is there a solution to this? My source files are on an nfs server that appears to be slightly ahead. My dev machine and the nfs server are VM's on seperate domains so I may never get clocks exactSpectroradiometer
@Telium : You might want to run an N(erwork)T(ime)P(rotocol) client on both machines on a regular base?Claribelclarice
S
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

Sumer answered 16/7, 2013 at 20:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.