Bugzilla – Bug 3562
configlexer.c and zlexer.c Makefile dependencies are altered while being used
Last modified: 2018-03-05 11:14:39 CET
I'm not sure which version of `nsd` that I am attempting to build is (4.1.9 is mentioned in "ChangeLog"), but I provide a commit hash a few lines down and the date at the top of the "ChangeLog" which is:
20 February 2017: Wouter
- For more clang warnings
- Fix spelling error in xfr-inspect.
To reproduce error:
sudo apt -y install libevent-dev
sudo apt -y install bison
git clone https://github.com/NLnetLabs/nsd.git
git checkout ee44df629568c7d01842cc8c56de1840825bf211
"make" is a command with a parallel operation via multiple processes. Inside the top level Makefile, there are two sections which delete then regenerate a ".c" file. Another part of the make depends on that file and fails when it does not find it. Additionally, if I alter the code to atomically replace the ".c" file, then the old one could have been seen before being replaced, which is not deterministic behavior.
This is my "make" version information:
$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
This happens with both "configlexer.c" and with "zlexer.c" as seen here:
gcc -I. -g -O2 -flto -c answer.c
gcc -I. -g -O2 -flto -c axfr.c
gcc -I. -g -O2 -flto -c buffer.c
if test ":" != ":"; then rm -f configlexer.c ;\
echo '#include "configyyrename.h"' > configlexer.c ;\
: -i -t ./configlexer.lex >> configlexer.c ;\
gcc -I. -g -O2 -flto -c configlexer.c
gcc: error: configlexer.c: No such file or directory
gcc: fatal error: no input files
Makefile:86: recipe for target 'configlexer.o' failed
make: *** [configlexer.o] Error 1
Your problem is that you have bison, but not flex. And flex is what generates that .c file. It tries to use it, the line with the ':', but nothing happens, because it wasn't detected. The configure script assumes that people that have bison installed also have flex.
Solution is, I think, apt install flex
Best regards, Wouter
The other issue is that you are compiling from the source repo. And the source repo does not ship the output for lex and bison (it does for Unbound, but not for NSD). The tarball downloads on our website have the output of flex and bison included and then you do not have to install flex yourself, it just works straight away.
NSD won't compile from source repo without flex and bison. (and make and a compiler, and so on). I changed the build script to printout this when it happens:
No configlexer.c : need flex and bison to compile from source repository
Thanks for the report!
Best regards, Wouter