Skip to content
  • Robert Edmonds's avatar
    c600ae0f
    src/utils/Makefile.inc: Add $(libnghttp2_CFLAGS) where needed · c600ae0f
    Robert Edmonds authored and Daniel Salzman's avatar Daniel Salzman committed
    The header file src/utils/common/https.h includes the external header
    file <nghttp2/nghttp2.h> (when nghttp2 support is enabled by the build
    system). This header file is included by src/utils/common/netio.h, which can
    in turn be included directly or indirectly by various knot components.
    
    The nghttp2 header files are not guaranteed to be located in the compiler's
    default include paths. This dependency is detected by the build system
    via PKG_CHECK_MODULES, which populates the automake variable
    $(libnghttp2_CFLAGS). These extra CFLAGS must be added to the compiler flags
    for any targets that include a header file that results in header file
    inclusions of the external dependencies. Otherwise the build will fail when
    those external header files cannot be located.
    
    This commit adds $(libnghttp2_CLAGS) to the *_CPPFLAGS for kdig, khost, and
    knsupdate.
    
    Without the $(libnghttp2_CFLAGS) fixes in this commit, the build will
    fail with an error like:
    
        Making all in src
        make[1]: Entering directory '/tmp/knot-3.0.0/src'
          GEN      contrib/dnstap/dnstap.pb-c.c
          GEN      contrib/dnstap/dnstap.pb-c.h
        NOTE: Compilation of scanner.c can take several minutes!
        make  all-recursive
        make[2]: Entering directory '/tmp/knot-3.0.0/src'
        make[3]: Entering directory '/tmp/knot-3.0.0/src'
          CC       libdnssec/la-tsig.lo
          CC       utils/kdig/khost-kdig_exec.o
          CC       utils/kdig/khost-kdig_params.o
          CC       utils/kdig/kdig-kdig_exec.o
          CC       utils/kdig/kdig-kdig_main.o
          CC       utils/kdig/kdig-kdig_params.o
          CC       utils/common/libknotus_la-cert.lo
          CC       utils/common/libknotus_la-exec.lo
          CC       utils/common/libknotus_la-hex.lo
          CC       utils/common/libknotus_la-https.lo
          CC       utils/common/libknotus_la-lookup.lo
          CC       utils/common/libknotus_la-msg.lo
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from ./utils/kdig/kdig_exec.h:19,
                         from utils/kdig/kdig_exec.c:22:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_params.c:23:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5500: utils/kdig/khost-kdig_exec.o] Error 1
        make[3]: *** Waiting for unfinished jobs....
        make[3]: *** [Makefile:5514: utils/kdig/khost-kdig_params.o] Error 1
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_main.c:20:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5416: utils/kdig/kdig-kdig_main.o] Error 1
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from ./utils/kdig/kdig_exec.h:19,
                         from utils/kdig/kdig_exec.c:22:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_params.c:23:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5402: utils/kdig/kdig-kdig_exec.o] Error 1
        make[3]: *** [Makefile:5430: utils/kdig/kdig-kdig_params.o] Error 1
        make[3]: Leaving directory '/tmp/knot-3.0.0/src'
        make[2]: *** [Makefile:5950: all-recursive] Error 1
        make[2]: Leaving directory '/tmp/knot-3.0.0/src'
        make[1]: *** [Makefile:2046: all] Error 2
        make[1]: Leaving directory '/tmp/knot-3.0.0/src'
        make: *** [Makefile:491: all-recursive] Error 1
    c600ae0f
    src/utils/Makefile.inc: Add $(libnghttp2_CFLAGS) where needed
    Robert Edmonds authored and Daniel Salzman's avatar Daniel Salzman committed
    The header file src/utils/common/https.h includes the external header
    file <nghttp2/nghttp2.h> (when nghttp2 support is enabled by the build
    system). This header file is included by src/utils/common/netio.h, which can
    in turn be included directly or indirectly by various knot components.
    
    The nghttp2 header files are not guaranteed to be located in the compiler's
    default include paths. This dependency is detected by the build system
    via PKG_CHECK_MODULES, which populates the automake variable
    $(libnghttp2_CFLAGS). These extra CFLAGS must be added to the compiler flags
    for any targets that include a header file that results in header file
    inclusions of the external dependencies. Otherwise the build will fail when
    those external header files cannot be located.
    
    This commit adds $(libnghttp2_CLAGS) to the *_CPPFLAGS for kdig, khost, and
    knsupdate.
    
    Without the $(libnghttp2_CFLAGS) fixes in this commit, the build will
    fail with an error like:
    
        Making all in src
        make[1]: Entering directory '/tmp/knot-3.0.0/src'
          GEN      contrib/dnstap/dnstap.pb-c.c
          GEN      contrib/dnstap/dnstap.pb-c.h
        NOTE: Compilation of scanner.c can take several minutes!
        make  all-recursive
        make[2]: Entering directory '/tmp/knot-3.0.0/src'
        make[3]: Entering directory '/tmp/knot-3.0.0/src'
          CC       libdnssec/la-tsig.lo
          CC       utils/kdig/khost-kdig_exec.o
          CC       utils/kdig/khost-kdig_params.o
          CC       utils/kdig/kdig-kdig_exec.o
          CC       utils/kdig/kdig-kdig_main.o
          CC       utils/kdig/kdig-kdig_params.o
          CC       utils/common/libknotus_la-cert.lo
          CC       utils/common/libknotus_la-exec.lo
          CC       utils/common/libknotus_la-hex.lo
          CC       utils/common/libknotus_la-https.lo
          CC       utils/common/libknotus_la-lookup.lo
          CC       utils/common/libknotus_la-msg.lo
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from ./utils/kdig/kdig_exec.h:19,
                         from utils/kdig/kdig_exec.c:22:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_params.c:23:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5500: utils/kdig/khost-kdig_exec.o] Error 1
        make[3]: *** Waiting for unfinished jobs....
        make[3]: *** [Makefile:5514: utils/kdig/khost-kdig_params.o] Error 1
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_main.c:20:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5416: utils/kdig/kdig-kdig_main.o] Error 1
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from ./utils/kdig/kdig_exec.h:19,
                         from utils/kdig/kdig_exec.c:22:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        In file included from ./utils/common/netio.h:23,
                         from ./utils/common/exec.h:21,
                         from ./utils/kdig/kdig_params.h:22,
                         from utils/kdig/kdig_params.c:23:
        ./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
           45 | #include <nghttp2/nghttp2.h>
              |          ^~~~~~~~~~~~~~~~~~~
        compilation terminated.
        make[3]: *** [Makefile:5402: utils/kdig/kdig-kdig_exec.o] Error 1
        make[3]: *** [Makefile:5430: utils/kdig/kdig-kdig_params.o] Error 1
        make[3]: Leaving directory '/tmp/knot-3.0.0/src'
        make[2]: *** [Makefile:5950: all-recursive] Error 1
        make[2]: Leaving directory '/tmp/knot-3.0.0/src'
        make[1]: *** [Makefile:2046: all] Error 2
        make[1]: Leaving directory '/tmp/knot-3.0.0/src'
        make: *** [Makefile:491: all-recursive] Error 1
Loading