[PATCH] waf upgrade broke flex and bison detection and flex build

Alexander Bokovoy ab at samba.org
Wed Sep 5 13:21:27 UTC 2018

On ke, 05 syys 2018, Ralph Böhme via samba-technical wrote:
> Hi!
> Looks like the recent waf update broke flex and bison detection and flex build.
> Attached patches fix the detection, but the build error is more difficult:
> seems as if flex is invoked from a the toplevel git checkout directory, not
> from bin, so the path to the flex source which is relative to bin, is wrong:
Thanks. Please push these two patches, they are right:

$ git grep \\.detect
source3/wscript:        bison.detect(conf)
source3/wscript:        flex.detect(conf)
third_party/waf/waflib/Tools/ifort.py:          compiler, version, path, includes, libdirs, arch = conf.detect_ifort()
third_party/waf/waflib/Tools/msvc.py:   compiler, version, path, includes, libdirs, cpu = conf.detect_msvc()
third_party/waf/waflib/extras/compat15.py:              ret.configure = ret.detect

When upgrading waf, I also tried to move us away from using waf 1.5
compatibilty layer. This one item was missed but as you can see from
compat15.py, a compat is reassigning 'detect()' code as 'configure()' 
when loading the tools:

        if 'detect' in ret.__dict__:
                if Logs.verbose:
                        Logs.warn('compat: rename "detect" to "configure"')
                ret.configure = ret.detect
        return ret

So the change you did is correct.

> [slow at kazak scratch]$ pwd
> /home/slow/git/samba/scratch
> [slow at kazak scratch]$ make
> WAF_MAKE=1 python ./buildtools/bin/waf build
> ...
> [1998/3795] Compiling source3/rpc_server/mdssvc/sparql_lexer.l
> ...
> /home/slow/git/samba/scratch
> flex: can't open ../source3/rpc_server/mdssvc/sparql_lexer.l
> Traceback (most recent call last):
>  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Task.py", line 320, in process
>    ret = self.run()
>  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Tools/flex.py", line 36, in flexfun
>    txt = bld.cmd_and_log(lst, env=env.env or None, quiet=0)
>  File "/home/slow/git/samba/scratch/third_party/waf/waflib/Context.py", line 464, in cmd_and_log
>    raise e
> WafError: Command ['/usr/bin/flex', '-t', '../source3/rpc_server/mdssvc/sparql_lexer.l'] returned 1
> make: *** [Makefile:8: all] Error 1
> I've patched cmd_and_log to print the cwd and error, that's where the lines
> /home/slow/git/samba/scratch
> flex: can't open ../source3/rpc_server/mdssvc/sparql_lexer.l
> are coming from.
> Note, you need --enable-spotlight to trigger this.
> Any help appreciated.
I'll look at it.

/ Alexander Bokovoy

More information about the samba-technical mailing list