ekam
ekam copied to clipboard
Ekam takes unnecessarily long for multi-step builds (almost all builds)
Imagine a simple C++ project with main.c++
and helper.c++
. One possible execution for Ekam is:
- Compile main.c++ -> main.o
- Attempt to link main.o ->
main
(since it has amain
symbol). Fail, sincehelper.o
isn't yet compiled. - Compile helper.c++ -> helper.o. Notice that the new object file has symbols that were missing in step 2.
- Link main.o + helper.o ->
main
Step 2 is unnecessary and slows down the build. This problem becomes worse as more steps are added (e.g. if some .c++ or .h files are generated by capnp or another tool).
One possible way to fix this is to allow .ekam-rule files to specify a priority, so that .capnp files are built before .c files, and .c before .o.
A simple priority doesn't work since to build a .capnp
file you first need to build the capnp
compiler tool which is itself compiled and linked from C++ source code. But with knowledge of the dependency tree from a previous run, we could be smarter about running things in the expected dependency order.
I'm not entirely convinced that Ekam actually wastes a whole lot of time on premature linking, though. The linker fails pretty quickly if symbols are missing. It would be nice to quantify this problem before spending time on it.