Compiling C++ on Remote Linux Machine - "Clock Skew Detected" Warning

Compiling C++ on remote Linux machine - clock skew detected warning

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.

However, if you are building from scratch (not doing an incremental build) you can likely ignore this warning without consequence.

How to solve error: Clock skew detected?

I am going to answer my own question.

I added the following lines of code to my Makefile and it fixed the "clock skew" problem:

clean:  
find . -type f | xargs touch
rm -rf $(OBJS)

Compiling C++ on remote Linux machine - clock skew detected warning

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.

However, if you are building from scratch (not doing an incremental build) you can likely ignore this warning without consequence.

makefile C , gcc

The make program uses the modification time stamps to check if a file is older than its dependencies. If a file has a timestamp that lies in the future, make issues the warning you observe.

The solution to this problem is to make sure that the clock in your virtual machine stays equal to the clock on the host machine. Consider using NTP to synchronize both clocks with an external reference clock.

To alleviate this problem for one build, touch all source files so their time stamps are reset to now:

touch *.c *.h

QT UTC linux Clock skew detected. Your build may be incomplete

I think this error happens when your file times are newer than your system clock. make warns you that it may not be building everything correctly because of this. touching all your files should sort out the problem.

One of the causes is an SCM system that preserves file times and is ahead of your system clock.

Suppress make clock skew warning when using NFS and NTP is unavailable

I have not used it by myself, but have you checked http://nfstimesync.sourceforge.net/ project?



Related Topics



Leave a reply



Submit