编译resin时出现error: newly created file is older than distributed files!

# ./configure --prefix=/usr/local/resin --with-java=/usr/local/src/jdk1.8.0_65/
checking build system type... i686-redhat-linux-gnu
checking host system type... i686-redhat-linux-gnu
checking target system type... i686-redhat-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... configure: error: newly created file is older than distributed files!
Check your system clock


在网上搜索了一下,很多都通过更新系统时间去解决,但是都没有解释问题产生的原因。

其实是因为我的resin目录下的文件修改时间ctime晚于 我的linux系统时间。

生产的原因是我的linux都是用VMware的虚拟机挂起功能,每次挂起后再开启,系统的时间就会是之前的挂起时间。

我现在虚拟机的时间2015年 12月 01日 星期二 13:38:43 ,而resin-pro-4.0.46目录下的有些文件的时间是2015年12月03日
系统时间

wKioL1Z497jQkcwiAABmw2iTpsQ404.jpg



文件时间(ls -l 查看到是文件的什么时间?ctime,atime,mtime?)
wKiom1Z498XhP45mAAD5on-y6SU589.jpg


解决办法:
一、把resin目录下文件时间修改为当前的系统时间(用touch命令修改的是atime,ctime还是mtime?)
[root@amai /usr/local/src/resin-pro-4.0.46]

# touch *


然后编译,没有错误信息提示,编译成功。

二、把当前系统时间修晚于resin目录下的文件时间。
2.1 用date命令设置系统时间,用clock把系统时间写入cmos。

# date -s "2015-12-08 14:51:00"  
# clock -w



2.2 用ntpdate更新系统时间为标准网络时间。该命令后要加上可用的标准网络时间服务器地址,见参考资料图。

# ntpdate time.windows.com



三、把虚拟机重启,让虚拟机自动更新为宿主机的系统时间。

# init 6


如果以后编译其他的软件时遇到configure: error: newly created file is older than distributed files! Check your system clock 的提示,都可以按照上面的思路和方法去解决。


参考资料:
http://blog.csdn.net/pjchen/article/details/7199804
http://blog.itpub.net/10617542/viewspace-960296/
http://vbird.dic.ksu.edu.tw/linux_server/0440ntp.php
http://www.stdtime.gov.tw/Time/ntp/resource.htm

双击windows 时间,查看可用标准网络时间服务器地址
wKioL1Z49-fC_so3AAAnLWIQ24E383.png