[Kea-users] How to Enable Parser Generation with Meson in Kea 3.0.0?

Andrei Pavel andrei at isc.org
Wed Jul 16 05:51:42 UTC 2025


Hi, Dipesh!

As I may have mentioned, running "meson compile parser" will generate 
the files. Removing the previoulsy generated files is not required. This 
is mentioned in the dev guide: 
https://reports.kea.isc.org/dev_guide/d0/d9b/parser.html although I 
notice now it is not properly formatted.

If you want only certain parsers generated, you can consult the list of 
targets with:

$ ninja -t targets all | grep -E 'lexer:|parser:' | grep -Ev 
'^meson-internal'
src-lib-eval-parser: phony
src-lib-eval-lexer: phony
src-bin-dhcp4-parser: phony
src-bin-dhcp4-lexer: phony
src-bin-dhcp6-parser: phony
src-bin-dhcp6-lexer: phony
src-bin-d2-parser: phony
src-bin-d2-lexer: phony
src-bin-agent-parser: phony
src-bin-agent-lexer: phony
src-bin-netconf-parser: phony
src-bin-netconf-lexer: phony
parser: phony

In your case, it sounds like you want to call "meson compile 
src-bin-dhcp4-lexer" and "meson compile src-bin-dhcp4-parser".

Having the parsers generated automatically on compilation is indeed 
something Kea has lost when leaving Autotools behind. Not intentionally. 
I am not opposed to bringing it back.

Best of luck!
--
Andrei

On 15/07/2025 23:48, Dipesh Kayastha wrote:
>
> Hi Andrei,
>
> I'm working on Kea with a *Meson-based build system*, and I’m trying 
> to regenerate the parser and lexer from the available |.yy| and |.ll| 
> sources. I am compiling my code under Docker.
>
>
>       My environment:
>
> |Program bison found: YES 3.8.2 (/usr/local/bin/bison) Program flex 
> found: YES 2.6.4 (/usr/bin/flex) |
>
> So both Bison (≥3.3.0) and Flex are correctly detected.
>
>
>       What I tried:
>
> I removed the generated files:
>
>  *
>
>     |src/bin/dhcp4/dhcp4_parser.cc|
>
>  *
>
>     |src/bin/dhcp4/dhcp4_lexer.cc|
>
> Expecting Meson to regenerate them from:
>
>  *
>
>     |dhcp4_parser.yy|
>
>  *
>
>     |dhcp4_lexer.ll|
>
> But when I run |meson setup| or |meson compile|, I get the error:
>
> |src/bin/dhcp4/meson.build:1:12: ERROR: File dhcp4_lexer.cc does not 
> exist. |
>
> It seems Meson is *expecting pre-generated files* instead of running 
> Flex/Bison, even though the sources are present and the tools are 
> available.
>
>
>       Question:
>
> Is there a recommended or supported way to integrate |.yy| and |.ll| 
> Generation with Meson in Kea?
>
> Any guidance or examples for Meson would be greatly appreciated!
>
> Thanks,
> Dipesh
>
>


More information about the Kea-users mailing list