'Prerequisite Checking' within the build system

If anyone is sufficiently familiar with the build system, could you say where the actual checking takes place. In particular, I want to see how the check for 'time' is done to see if I can change it.

You really need to get first familiar with the build system and get it working in a normal Linux, before you are trying to implement it in Openwrt.

And please, keep your questions about the same major topic in one thread.


Actually I was trying to get it working on FreeBSD. I'm now looking at the 'time' check and see that it looks for a time which supports the '-f' parameter. Any idea why? Does it really need it? GNU time is not available on FreeBSD and FreeBSD time does not have a '-f' parameter.

According to https://wiki.openwrt.org/doc/howto/buildroot.exigence
the build system works on BSD. How can it if it requires a 'time' function which supports the '-f' parameter when FreeBSD doesn't have such an option?

That is needed since a few months ago. Either a recent GNU time or other time that supports the required formatting.

If you have run the build process a few times now (in a Linux where it works), you have likely seen the collected time info regarding various build steps.

If wiki contains wrong info regarding BSD, you can correct it in the wiki. Likely not many people currently using BSD for building, so nobody has corrected that recent build requirements change in wiki.

Other option for you is of course to patch the time check away from the buildroot. You can find the three related commits rather easily from the sources. Just look at the commits since May 2018 here:

wiki.openwrt.org is the outdated old read-only wiki.

$ diff ./include/subdir.mk ./include/subdir.mk.bak

env time -f "time: $(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)#%U#%S#%e" -- \

delete the displayed line from ./include/subdir.mk

and delete these 4 lines from the file shown above


have you seen this

Does the first line ...

env time -f ,,,,

end with a '\' which I thought was a continuation character...

I deleted the four lines mentioned and no check failed appeared, but I did get this at the end of ./scripts/feeds update -a:

Prerequisite check failed. Use FORCE=1 to override.
gmake: *** [/root/projects/openwrt/include/toplevel.mk:168: staging_dir/host/.prereq-build] Error 1
/bin/sh: mkhash: not found


There has been discussion to implement the necessary timing info in a small perl script, rather than requiring GNU- or busybox time (which is fragile, needs a pretty rare binary (bash's shell-builtin suits most other uses)), but I don't think anyone is actively working on it at the moment.

Already addressed in detail in OP's previous thread on this same topic:

The FreeBSD patch for mkhash.c works OK.

Would it be possible to incorporate it into the mkhash,c which is included in the build system?

Is there any way to retrieve the file referenced here using wget?


wget 'https://bugs.openwrt.org/index.php?getfile=292'

(with whatever options you need or want)

1 Like

Thanks for that, the quotes made all the difference.