编译软件时,你可以采取哪些步骤来确保健全的构build环境?

我有一个可怕的时间让一个软件在CentOS盒子上编译,下面列出的问题是特定的,但我希望正确的方法来源于这是一个可以应用于类似的问题,因为这似乎并不是一个特定于这一块软件的问题。 虽然…到了…

在CentOS 5.4上构build一个标准化的虚拟机时,我遇到了一个编译问题,而我在这个黑暗中一直在为这个错误发生的原因,以及b)如何解决这个问题,别人也绊倒了这个问题,我希望有人能帮我find解决scheme在这里。

我得到一个configure: error: newly created file is older than distributed files! 尝试运行安装程序时试图编译Ruby Enterprise时遇到错误,并且在论坛上提供的解决scheme(检查时间戳,以及触摸文件以更新与之关联的时间)似乎没有帮助这里。

我可以采取哪些步骤来找出造成这个问题的原因?

 [vagrant@vagrant-centos-5 ruby-enterprise-1.8.7-2009.10]$ sudo ./installer Welcome to the Ruby Enterprise Edition installer This installer will help you install Ruby Enterprise Edition 1.8.7-2009.10. Don't worry, none of your system files will be touched if you don't want them to, so there is no risk that things will screw up. You can expect this from the installation process: 1. Ruby Enterprise Edition will be compiled and optimized for speed for this system. 2. Ruby on Rails will be installed for Ruby Enterprise Edition. 3. You will learn how to tell Phusion Passenger to use Ruby Enterprise Edition instead of regular Ruby. Press Enter to continue, or Ctrl-C to abort. Checking for required software... * C compiler... found at /usr/bin/gcc * C++ compiler... found at /usr/bin/g++ * The 'make' tool... found at /usr/bin/make * Zlib development headers... found * OpenSSL development headers... found * GNU Readline development headers... found -------------------------------------------- Target directory Where would you like to install Ruby Enterprise Edition to? (All Ruby Enterprise Edition files will be put inside that directory.) [/opt/ruby-enterprise] : -------------------------------------------- Compiling and optimizing the memory allocator for Ruby Enterprise Edition In the mean time, feel free to grab a cup of coffee. ./configure --prefix=/opt/ruby-enterprise --disable-dependency-tracking checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-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 

这是在virtualbox上运行的虚拟机,主机和虚拟机的时间是相同的,并且是最新的。 我也尝试过更新时间后用ntp客户端运行,所以没有用。 在阅读这篇文章后,我遇到了类似问题的人

 [vagrant@vagrant-centos-5 ruby-enterprise-1.8.7-2009.10]$ date Tue Apr 27 08:09:05 BST 2010 

我试过的另一种方法是触摸构build文件夹中的顶层文件, 就像这里所build议的那样 ,但是这也不起作用(说实话,我不知道为什么它也可以)

 [vagrant@vagrant-centos-5 ruby-enterprise-1.8.7-2009.10]$ sudo touch ruby-enterprise-1.8.7-2009.10/* 

我不确定接下来在这里可以做什么 – 问题似乎是返回这个错误error: newly created file is older than distributed files!bashconfiguration脚本error: newly created file is older than distributed files! ,在线:2214

 { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi ### PROBLEM LINE #### # this line is the problem line - this is returned true, sometimes it isn't and I can't # see a pattern that that determines when this will test will pass or not. test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi 

这令人感到非常沮丧的事情是,这个脚本有时候工作,当虚拟机已经运行了一个小时左右的工作,但不是在启动。 在crontab中我没有看到任何可以改变系统状态的小时间任务,足以改变这个脚本的工作。

在这里进行debugging时,我完全不知所措。 这里最好的方法是什么?

谢谢

今天在安装ree-1.8.7-2011.03的时候,我在一个新安装的盒子上遇到了这个问题。

configurationntpd后,检查硬件时钟,排除实际问题与时钟和tima错误信息仍然存在。 最后,我追查到这个错误,包括谷歌perftools目录。 触摸该configuration脚本后,问题刚刚解决,Ruby企业版安装没有任何问题。

 [mark@host347 ~]$ cd src/ree-1.8.7-2011.03/source/ [mark@host347 source]$ touch ./distro/google-perftools-1.7/configure 

该configurationshell脚本中的“date健全性检查”看起来像是在我身上,它需要修复。 看这个:

 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then 

因此,它触及一个文件,然后试图找出它的mtime是否比$srcdir/configure的mtime更新,并且通过调用ls然后将输出与固定string进行比较来实现。 作者写道

  # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". 

但我认为这是垃圾。 ls版本/风格太多,并且改变ls输出的方式(他们甚至命名一个)来确定ls的输出格式。

无论如何,有办法更好的方法来做到这一点。 例如在bash中(参见help test ):

 if [ $FILE1 -nt $FILE2 ] ; then echo "$FILE1 is newer than $FILE2" elif [ $FILE2 -nt $FILE1 ] ; then echo "$FILE2 is newer than $FILE1" else echo "$FILE1 and $FILE2 are equally new" fi 

或者直接找出未来是否有一段时间!

 find -L $FILE -newermt now -exec echo THE FILE {} IS COMING FROM THE FUTURE \; 

要么

 find -L $FILE -mtime -0 -exec echo THE FILE {} IS COMING FROM THE PRESENT OR THE FUTURE \; 

现在自己写补丁:-)

你不会谈论你的系统时钟性能。 而不是看编译问题,如何testing系统时钟性能? NTP可以帮助时钟漂移,但它不会修复一些不稳定的东西。 如果硬件时钟被中断,则可能需要新的主板。 这是一个可能有所帮助的testing:

 for i in `seq 1 60` do date sleep 60 done 

这应该每分钟输出一次。 如果输出结果不如下所示:

  Tue Apr 27 13:33:28 ADT 2010 Tue Apr 27 13:34:28 ADT 2010 Tue Apr 27 13:35:28 ADT 2010 ... 

那么你有一个硬件时钟的问题。 用像NTP这样的工具来对付它可能行不通。 硬件是最好的解决scheme,如果你有硬件问题。