这两天用docker编译openwrt的时候遇见这个错误,检查time命令失败,如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
Checking connectivity... done. Create index file './feeds/staging.index' Checking 'working-make'... ok. Checking 'case-sensitive-fs'... ok. Checking 'proper-umask'... ok. Checking 'gcc'... ok. Checking 'working-gcc'... ok. Checking 'g++'... ok. Checking 'working-g++'... ok. Checking 'ncurses'... ok. Checking 'perl-thread-queue'... ok. Checking 'tar'... ok. Checking 'find'... ok. Checking 'bash'... ok. Checking 'patch'... ok. Checking 'diff'... ok. Checking 'cp'... ok. Checking 'seq'... ok. Checking 'awk'... ok. Checking 'grep'... ok. Checking 'getopt'... ok. Checking 'stat'... ok. Checking 'unzip'... ok. Checking 'bzip2'... ok. Checking 'wget'... ok. Checking 'time'... failed. Checking 'perl'... ok. Checking 'python'... ok. Checking 'git'... ok. Checking 'file'... ok. Checking 'ldconfig-stub'... ok. Build dependency: Please install GNU 'time' or BusyBox 'time' that supports -f Prerequisite check failed. Use FORCE=1 to override. make: *** [staging_dir/host/.prereq-build] Error 1 Collecting package info: done Collecting target info: done |
可以看到上面checking ‘time’ …. failed
但是time命令确实已经安装了,但是是bash默认安装的,不是busybox的也不是gun的,所以会报错
如下参考链接 https://blog.csdn.net/weixin_34075551/article/details/85946904
检查出错的根本原因
1 2 3 4 5 6 7 |
$ grep -rnw './' -e 'that supports -f' ./include/prereq-build.mk:141:$(eval $(call SetupHostCommand,time,Please install GNU 'time' or BusyBox 'time' that supports -f, \ $ more include/prereq-build.mk $(eval $(call SetupHostCommand,time,Please install GNU 'time' or BusyBox 'time' that supports -f, \ gtime --version 2>&1 | grep GNU, \ time --version 2>&1 | grep GNU, \ busybox time 2>&1 | grep -- '-f FMT')) |
解决方法
1 2 3 4 5 6 |
$ wget https://ftp.gnu.org/gnu/time/time-1.9.tar.gz $ tar zxvf time-1.9.tar.gz $ ./configure $ make $ sudo make install $ ln -s /usr/local/bin/time /usr/bin/gtime |
完成