You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu20.04下ROS Noetic编译catkin工作空间时钟偏移问题求助

解决Ubuntu 20.04 + ROS Noetic编译catkin工作空间时的时钟偏移警告

问题描述

make: Warning: File 'Makefile' has modification time 86 s in the future
make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 86 s in the future
make[1]: warning: Clock skew detected. Your build may be incomplete.
make: warning: Clock skew detected. Your build may be incomplete.

系统时间经date命令确认正常,尝试过以下命令但仅减少时间偏差秒数,未彻底解决:

  • find build/. -exec touch {} \;
  • touch build/Makefile
  • touch build/CMakeFiles/Makefile2
  • find ~/new_ws/build/CMakeFiles/Makefile2 -type f -exec touch {} +
  • find ~/new_ws/build/Makefile -type f -exec touch {} +

项目来自其他团队,包含自定义ROS消息,拉取Git仓库后仅出现此问题。

解决方法

1. 彻底清理构建目录后重新编译

时钟偏移多因构建目录残留时间戳异常文件,彻底清理后重新生成构建文件可从根源解决:

cd ~/new_ws
catkin clean --yes  # 或直接执行 rm -rf build devel
catkin_make  # 若使用catkin_tools则替换为 catkin build

2. 调整Git仓库时间戳配置

部分Git仓库克隆时会保留原仓库的文件时间戳,修改Git配置让克隆文件使用本地系统时间:

git config --global core.trustctime false
git config --global core.filemode false

之后重新克隆仓库并编译:

cd ~
rm -rf new_ws
git clone <你的仓库地址> new_ws
cd new_ws
catkin_make

3. 重置自定义消息文件的时间戳

自定义ROS消息的编译生成文件可能存在时间戳异常,手动更新消息源文件时间后重新触发编译:

cd ~/new_ws
touch src/*/msg/*.msg  # 更新所有自定义消息文件时间戳
catkin_make --force-cmake

4. 检查存储设备时间同步

若项目存储在外部挂载设备(如共享目录、USB磁盘),可能设备本身时间与系统不一致,尝试将项目迁移到本地磁盘后重新编译。


内容的提问来源于stack exchange,提问作者krlepping

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 18:03:07