Linux下Clock skew detected的解决办法

本文介绍了解决Linux环境下编译安装软件包时出现的“Clock skew detected”警告的方法。通过调整系统时间并使用`clock-w`命令同步CMOS时间,可以避免编译不完整的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux下Clock skew detected的解决办法

作者: 丁丁,  出处:IT专家网, 责任编辑: 月之冬, 
2009-06-20 07:00
  在Linux下编译安装软件包时提示make: warning: Clock skew detected. Your build may be incomplete.

  在Linux下编译安装软件包时提示

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

  修改系统的日期与时间然后重新编译安装。则错误消失。方法如下:

  [root@server vsftpd-2.0.5]# date

  Sat Jan 26 04:33:07 CST 2002

  [root@server vsftpd-2.0.5]# date -s 12/11/2006

  Mon Dec 11 00:00:00 CST 2006

  [root@server vsftpd-2.0.5]# date -s 14:42:50

  Mon Dec 11 14:42:50 CST 2006

  [root@server vsftpd-2.0.5]# date

  Mon Dec 11 14:43:00 CST 2006

  [root@server vsftpd-2.0.5]# clock -w

  [root@server vsftpd-2.0.5]# date

  Mon Dec 11 14:43:33 CST 2006

  然后重新make 并 make install则安装正常。

  注意,这里说的是系统时间,是linux由操作系统维护的。

  在系统启动时,Linux操作系统将时间从CMOS中读到系统时间变量中,以后修改时间通过修改系统时间实现。为了保持系统时间与CMOS时间的一致 性,Linux每隔一段时间会将系统时间写入CMOS。由于该同步是每隔一段时间(大约是11分钟)进行的,在我们执行date -s后,如果马上重起机器,修改时间就有可能没有被写入CMOS,这就是问题的原因。如果要确保修改生效可以执行如下命令。

  #clock -w

  这个命令强制把系统时间写入CMOS。

在WSL中编译C程序出现编译警告 root@DESKTOP-2QBDJV0:/mnt/d/work/openeuler_env/code/testUsbDongleRFID_pro# ./script/build.sh -- The C compiler identification is GNU 10.3.1 -- The CXX compiler identification is GNU 10.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /mnt/d/work/openeuler_env/oecore-x86_64/sysroots/x86_64-peesdk-linux/usr/bin/aarch64-powereuler-linux-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /mnt/d/work/openeuler_env/oecore-x86_64/sysroots/x86_64-peesdk-linux/usr/bin/aarch64-powereuler-linux-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/d/work/openeuler_env/code/testUsbDongleRFID_pro/build make: Warning: File 'Makefile' has modification time 0.31 s in the future make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 0.28 s in the future make[2]: Warning: File 'CMakeFiles/run_testUsbDongleRFID.dir/flags.make' has modification time 0.21 s in the future make[2]: warning: Clock skew detected. Your build may be incomplete. make[2]: Warning: File 'CMakeFiles/run_testUsbDongleRFID.dir/flags.make' has modification time 0.17 s in the future [ 50%] Building C object CMakeFiles/run_testUsbDongleRFID.dir/main.c.o /mnt/d/work/openeuler_env/code/testUsbDongleRFID_pro/main.c: In function 'main': /mnt/d/work/openeuler_env/code/testUsbDongleRFID_pro/main.c:121:5: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result] 121 | write(fd, command, strlen(command)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [100%] Linking C executable run_testUsbDongleRFID make[2]: warning: Clock skew detected. Your build may be incomplete. [100%] Built target run_testUsbDongleRFID make[1]: warning: Clock skew detected. Your build may be incomplete. make: warning: Clock skew detected. Your build may be incomplete.
06-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值