2008/03/10

waf build errors

I'm evaluating waf to see if it's easier to use than SCons (especially for Qt projects). So far the results are encouraging. In particular, waf reports many kinds of problems using straightforward (color-coded!) error messages, rather than Python tracebacks.

target 'build_info' does not exist

Sometimes waf does spew an unintelligible Python traceback reminiscent of SCons. For me, these typically end with a KeyError:

File "/path/to/.waf-1.3.2-blah/wafadmin/Task.py", line 290, in must_run
prev_sig = tree.m_sig_cache[key][0]
KeyError: -214303645


This error always translates to "you are trying to build a file which is part of your source tree."

My SConscripts work in situ, creating object files etc. in the same directories where the source code resides. waf prefers to put build products in a separate build/ subdirectory. When waf is instructed to generate an output file in its build tree, and when that file already exists in the source tree, waf fails with the KeyError traceback.

I'd bet this problem is most common in software projects which started life using build systems like Make or SCons -- tools which default to building in situ.

For example, I'm trying to use waf in a subversion workspace where I've been doing SCons builds for years. To make matters worse, one of the build products is a header file, containing revision number and date for the current build. This looks like a source file, so it's likely that I never checked whether it was properly removed by scons -u -c.

In retrospect, I should have started with a clean check-out...

1 comment:

Richard Quirk said...

I use scons with a separate build dir. It's not without its own problems, feel the pain as you naively glob.glob your source files... I'm evaluating waf based solely on the lack of a proper glob - it's in Scons' SVN, but how long until that trickles downstream? - waf's find_source_files function (or whatever it's called) looks good, if it works as expected. I fear it may miss generated headers, for example.

But at least new features get to go in your distributed waf file.

My other concern is that adding new tools (e.g. converting data to something that a program can read, common in games coding) requires much more voodoo in waf than in scons. And woe be you if you need to pass multiple targets with flags to some program.

Finally, waf mocks me for trying to cross compile.