-3

I'm having problems with makefile. I'm not sure why really.

My modules are distributed like this:

main.c:

#include "LL.h"

LL.c:

#include "LL.h"

LL.h:----

Makefile:

#makefile

a.out: main.o LL.o
    gcc main.o LL.o

main.o: main.c LL.h
    gcc -g -c main.c

LL.o: LL.c LL.h
    gcc -g -c LL.c

I'm using virtual machine with ubuntu, and indeed the clock gets lapsed comparing to windows clock.

I get this message on stdout:

make: Warning: File `a.out' has modification time 3.8e+03 s in the future

make: `a.out' is up to date.

make: warning: Clock skew detected. Your build may be incomplete.

and sometimes will keep trying to link/compile certain lines of make.

Looking for an enlightening Thanks ;)

Jaime38130
  • 167
  • 1
  • 1
  • 14
  • Voted for close, as possible duplicates are: [Compiling C++ on remote Linux machine - “clock skew detected” warning](http://stackoverflow.com/questions/3824500/compiling-c-on-remote-linux-machine-clock-skew-detected-warning) and [Makefile : Clock skew detected](http://stackoverflow.com/questions/13745645/makefile-clock-skew-detected) and others. – Matthias W. Feb 01 '16 at 13:26

1 Answers1

1

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
fuz
  • 88,405
  • 25
  • 200
  • 352