Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: util/configlexer.c: No such file or directory #885

Closed
origamiofficial opened this issue May 4, 2023 · 2 comments
Closed

Error: util/configlexer.c: No such file or directory #885

origamiofficial opened this issue May 4, 2023 · 2 comments

Comments

@origamiofficial
Copy link

Describe the bug
Recently unbound started failing to compile. It shows gcc: error: util/configlexer.c: No such file or directory. I've got a Docker project pihole-unbound that builds images using GitHub Actions and was building fine for 9 Months. But recently the build has started failing. Seems unbound issue. Full log available on Run #223

To reproduce
Steps to reproduce the behavior:

  1. Compile unbound

Expected behavior
Compile fine and build complete.

System:

  • Unbound version: Latest (Repo Sync)
  • OS: Debian bullseye
  • unbound -V output: Compile Failed!

Compile Log

> [linux/amd64 unbound 4/4] RUN build_deps="curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make bison" &&     set -x &&     DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends       $build_deps       bsdmainutils       ca-certificates       ldnsutils       libevent-2.1-7       libexpat1       libprotobuf-c-dev       protobuf-c-compiler &&     git clone https://github.com/NLnetLabs/unbound.git &&     cd unbound &&     groupadd _unbound &&     useradd -g _unbound -s /dev/null -d /etc _unbound &&     ./configure         --disable-dependency-tracking         --prefix=/opt/unbound         --with-pthreads         --with-username=_unbound         --with-ssl=/opt/openssl         --with-libevent         --with-libnghttp2         --enable-dnstap         --enable-tfo-server         --enable-tfo-client         --enable-event-api         --enable-subnet &&     make install &&     mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example &&     apt-get purge -y --auto-remove       $build_deps &&     rm -rf         /opt/unbound/share/man         /tmp/*         /var/tmp/*         /var/lib/apt/lists/*:
#24 141.4 	echo "#include \"config.h\"" > util/configlexer.c ;\
#24 141.4 	echo "#include \"util/configyyrename.h\"" >> util/configlexer.c ;\
#24 141.4 	: -t ./util/configlexer.lex >> util/configlexer.c ;\
#24 141.4 fi
#24 141.4 ./libtool --tag=CC --mode=compile gcc -I.  -I/opt/openssl/include -DSRCDIR=. -g -O2 -flto -pthread -I/usr/include/google  -o configlexer.lo -c util/configlexer.c
#24 141.5 libtool: compile:  gcc -I. -I/opt/openssl/include -DSRCDIR=. -g -O2 -flto -pthread -I/usr/include/google -c util/configlexer.c  -fPIC -DPIC -o .libs/configlexer.o
#24 141.5 gcc: error: util/configlexer.c: No such file or directory
#24 141.5 gcc: fatal error: no input files
#24 141.5 compilation terminated.
#24 141.5 make: *** [Makefile:319: configlexer.lo] Error 1
------
Dockerfile:36
--------------------
  35 |     
  36 | >>> RUN build_deps="curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make bison" && \
  37 | >>>     set -x && \
  38 | >>>     DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
  39 | >>>       $build_deps \
  40 | >>>       bsdmainutils \
  41 | >>>       ca-certificates \
  42 | >>>       ldnsutils \
  43 | >>>       libevent-2.1-7 \
  44 | >>>       libexpat1 \
  45 | >>>       libprotobuf-c-dev \
  46 | >>>       protobuf-c-compiler && \
  47 | >>>     git clone https://github.com/NLnetLabs/unbound.git && \
  48 | >>>     cd unbound && \
  49 | >>>     groupadd _unbound && \
  50 | >>>     useradd -g _unbound -s /dev/null -d /etc _unbound && \
  51 | >>>     ./configure \
  52 | >>>         --disable-dependency-tracking \
  53 | >>>         --prefix=/opt/unbound \
  54 | >>>         --with-pthreads \
  55 | >>>         --with-username=_unbound \
  56 | >>>         --with-ssl=/opt/openssl \
  57 | >>>         --with-libevent \
  58 | >>>         --with-libnghttp2 \
  59 | >>>         --enable-dnstap \
  60 | >>>         --enable-tfo-server \
  61 | >>>         --enable-tfo-client \
  62 | >>>         --enable-event-api \
  63 | >>>         --enable-subnet && \
  64 | >>>     make install && \
  65 | >>>     mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example && \
  66 | >>>     apt-get purge -y --auto-remove \
  67 | >>>       $build_deps && \
  68 | >>>     rm -rf \
  69 | >>>         /opt/unbound/share/man \
  70 | >>>         /tmp/* \
  71 | >>>         /var/tmp/* \
  72 | >>>         /var/lib/apt/lists/*
  73 |     
--------------------
ERROR: failed to solve: process "/bin/bash -c build_deps=\"curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make bison\" &&     set -x &&     DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends       $build_deps       bsdmainutils       ca-certificates       ldnsutils       libevent-2.1-7       libexpat1       libprotobuf-c-dev       protobuf-c-compiler &&     git clone https://github.com/NLnetLabs/unbound.git &&     cd unbound &&     groupadd _unbound &&     useradd -g _unbound -s /dev/null -d /etc _unbound &&     ./configure         --disable-dependency-tracking         --prefix=/opt/unbound         --with-pthreads         --with-username=_unbound         --with-ssl=/opt/openssl         --with-libevent         --with-libnghttp2         --enable-dnstap         --enable-tfo-server         --enable-tfo-client         --enable-event-api         --enable-subnet &&     make install &&     mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example &&     apt-get purge -y --auto-remove       $build_deps &&     rm -rf         /opt/unbound/share/man         /tmp/*         /var/tmp/*         /var/lib/apt/lists/*" did not complete successfully: exit code: 2
Error: buildx failed with: ERROR: failed to solve: process "/bin/bash -c build_deps=\"curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make bison\" &&     set -x &&     DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends       $build_deps       bsdmainutils       ca-certificates       ldnsutils       libevent-2.1-7       libexpat1       libprotobuf-c-dev       protobuf-c-compiler &&     git clone https://github.com/NLnetLabs/unbound.git &&     cd unbound &&     groupadd _unbound &&     useradd -g _unbound -s /dev/null -d /etc _unbound &&     ./configure         --disable-dependency-tracking         --prefix=/opt/unbound         --with-pthreads         --with-username=_unbound         --with-ssl=/opt/openssl         --with-libevent         --with-libnghttp2         --enable-dnstap         --enable-tfo-server         --enable-tfo-client         --enable-event-api         --enable-subnet &&     make install &&     mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example &&     apt-get purge -y --auto-remove       $build_deps &&     rm -rf         /opt/unbound/share/man         /tmp/*         /var/tmp/*         /var/lib/apt/lists/*" did not complete successfully: exit code: 2
@wcawijngaards
Copy link
Member

The error happens because a recent code contribution removed the generated lexer and parser files from the code repository. With installed flex and bison, the files are created during the compile.

Thanks for the report! It would be nice to have readable explanatory output for this. The fixup prints understandable error messages, explaining that flex and bison are needed to compile the code from the source repository. For compiles from source tarballs, the generated files in the release tarball can be used. For the build process in the issue ticket, append flex bison to the apt-get install -y line, or add it to the build_deps variable. Here is a diff for docker-pihole-unbound/latest/Dockerfile, that adds flex to the build dependencies:

--- Dockerfile.orig	2023-05-04 11:22:45.305097778 +0200
+++ Dockerfile.new	2023-05-04 11:23:13.055096312 +0200
@@ -33,7 +33,7 @@
 
 COPY --from=openssl /opt/openssl /opt/openssl
 
-RUN build_deps="curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make bison" && \
+RUN build_deps="curl gcc libc-dev libevent-dev libexpat1-dev libnghttp2-dev make flex bison" && \
     set -x && \
     DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
       $build_deps \

origamiofficial added a commit to origamiofficial/docker-pihole-unbound that referenced this issue May 4, 2023
The error happens because a recent code contribution removed the generated lexer and parser files from the code repository. With installed flex and bison, the files are created during the compile.
Thanks to [@wcawijngaards](https://github.com/wcawijngaards) for the fix explained [here](NLnetLabs/unbound#885 (comment))
@origamiofficial
Copy link
Author

Thanks for the fix!!

jedisct1 added a commit to jedisct1/unbound that referenced this issue May 25, 2023
* nlnet/master: (39 commits)
  - Fix unbound-dnstap-socket time fraction conversion for printout.
  - Fix unbound-dnstap-socket printout when no query is present.
  - Fix to remove unused variables from RPZ clientip data structure.
  - Fix RPZ removal of client-ip, nsip, nsdname triggers from IXFR.
  - Fix to print debug log for ancillary data with correct IP address.
  - Fix NLnetLabs#888: [FR] Use kernel timestamps for dnstap.
  - Fix warning in windows compile, in set_recvtimestamp.
  - Fix doxygen in addr_to_nat64 header definition.
  - Fix to remove unused whitespace from acx_nlnetlabs.m4 and config.h.
  - Fix NLnetLabs#885: Error: util/configlexer.c: No such file or directory,   adds error messages explaining to install flex and bison.
  Changelog entry for NLnetLabs#722: - Merge NLnetLabs#722 from David 'eqvinox' Lamparter: NAT64 support. - For NLnetLabs#722: minor fixes, formatting, refactoring.
  - For NLnetLabs#722: Minor fixes, formatting and refactoring.
  - Fix RPZ IP responses with trigger rpz-drop on cache entries, that   they are dropped.
  Changelog for NLnetLabs#860
  Remove msg_del_for_0ttl, call msg_cache_remove directly
  - Fix for NLnetLabs#882: document variable to stop doxygen warning.
  - Fix for NLnetLabs#882: small changes, date updated in Copyright for   util/timeval_func.c and util/timeval_func.h. Man page entries and   example entry.
  stats: add query max wait time metric
  stats: add counter for timed out queries
  config: add sock_queue_timeout configuration
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants