Missing header file (cfg_globals.h) in install paths causes custom hook compilation to fail
Name:
Missing header file "cfg_globals.h" in install target causes custom hook compilation to fail
Describe the bug
Hook compilation fails (which works on 2.0.0) with:
In file included from /include/kea/dhcpsrv/subnet.h:15, from src/callouts.cc:9: /include/kea/dhcpsrv/network.h:17:10: fatal error: dhcpsrv/cfg_globals.h: No such file or directory 17 | #include <dhcpsrv/cfg_globals.h> | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:13: src/callouts.o] Error 1
This was added in: !1078 (diffs)
and appears this code should have been updated to include the header file in the installation target (If I'm understanding correctly):
https://gitlab.isc.org/isc-projects/kea/-/blob/master/src/lib/dhcpsrv/Makefile.am#L291
To Reproduce
- Build Kea from source with config options listed below
- Attempt to compile a custom hook that includes subnet.h
- Copying the header file: /kea-2.2.0/src/lib/dhcpsrv/cfg_globals.h -> PREFIX/include/kea/dhcpsrv/ allows compilation to succeed.
Expected behavior
Hook should compile successfully
Environment:
- Kea version: 2.2.0
- OS: Ubuntu Focal
- Config options: --enable-generate-messages --enable-perfdhcp --enable-shell --prefix=/
Additional Information
Makefile details from the custom hook code:
KEA_MSG_COMPILER ?= kea-msg-compiler
KEA_INCLUDE ?= /include/kea
KEA_LIB ?= /lib
OBJECTS = src/messages.o src/logger.o src/load.o src/runscript.o src/callouts.o src/version.o src/multithreading.o
CXXFLAGS = -I $(KEA_INCLUDE) -fPIC -Wno-deprecated -std=c++11
LDFLAGS = -L $(KEA_LIB) -shared -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions
I am building this hook code in a multistage Docker build pipeline and would prefer not to depend on source files not installed by the Kea tooling. If that's not a reasonable assumption I can adjust our tooling behavior.