CPPFLAGS never passed down to compiler invocation
Summary
Compiler fails to find header files for libreadline because include directory is not passed:
/opt/aCC/bin/aCC -Ae -Ae -z -I/var/tmp/ports/work/bind-9.11.35 -I../.. -I./include -I/var/tmp/ports/work/bind-9.11.35/lib/dns/include -I../../lib/dns/include -I/var/tmp/ports/work/bind-9.11.35/lib/bind9/include -I../../lib/bind9/include -I/var/tmp/ports/work/bind-9.11.35/lib/isc/include -I../../lib/isc -I../../lib/isc/include -I../../lib/isc/unix/include -I../../lib/isc/nothreads/include -I../../lib/isc/noatomic/include -I/var/tmp/ports/work/bind-9.11.35/lib/lwres/include -I../../lib/lwres/unix/include -I../../lib/lwres/include -I/var/tmp/ports/work/bind-9.11.35/lib/isccfg/include -I../../lib/isccfg/include -DVERSION=\"9.11.35\" -D_XOPEN_SOURCE_EXTENDED -g -Wl,+vnocompatwarnings +z +w1 +W 474,530,2193,2236 -c nslookup.c
...
"nslookup.c", line 56: error #3696-D: cannot open source file
"readline/readline.h"
#include <readline/readline.h>
^
"nslookup.c", line 58: error #3696-D: cannot open source file
"readline/history.h"
#include <readline/history.h>
...
2 errors detected in the compilation of "nslookup.c".
gmake[2]: *** [Makefile:245: nslookup.o] Error 2
gmake[2]: Leaving directory '/var/tmp/ports/work/bind-9.11.35/bin/dig'
gmake[1]: *** [Makefile:79: subdirs] Error 1
gmake[1]: Leaving directory '/var/tmp/ports/work/bind-9.11.35/bin'
gmake: *** [Makefile:88: subdirs] Error 1
BIND version used
9.11.35
Steps to reproduce
Have readline in a non-standard location, provide -I...
with the path to readline header files in CPPFLAGS
. configure
properly detects it, but the variable is never actually passed to compiler invocation.
export PREFIX=/opt/ports
export LIBDIR=$PREFIX/lib/hpux32
export SYSCONFDIR=/etc/opt/ports
export CC=/opt/aCC/bin/aCC
export CXX=/opt/aCC/bin/aCC
export CONFIGURE="./configure --prefix=$PREFIX --libdir=$LIBDIR"
export CPPFLAGS="-I$PREFIX/include"
export LDFLAGS="-L$LIBDIR"
$CONFIGURE --sysconfdir=$SYSCONFDIR --localstatedir=/var --disable-threads \
--with-gssapi=$PREFIX/bin/krb5-config \
--with-libxml2=no --with-readline --with-eddsa=no --with-zlib=no --with-python=no \
--disable-rpz-nsip --disable-rpz-nsdname --with-openssl=no --with-libxml2=no
So readline is available from CPPFLAGS
and LDFLAGS
.
configure
then says:
configure: checking for readline with -ledit
checking for readline... no
configure: checking for readline with -ledit -lterminfo
checking for readline... no
configure: checking for readline with -ledit -ltermcap
checking for readline... no
configure: checking for readline with -ledit -lncurses
checking for readline... no
configure: checking for readline with -ledit -lcurses
checking for readline... no
configure: checking for readline with -lreadline
checking for readline... (cached) no
configure: checking for readline with -lreadline -lterminfo
checking for readline... no
configure: checking for readline with -lreadline -ltermcap
checking for readline... no
configure: checking for readline with -lreadline -lncurses
checking for readline... no
configure: checking for readline with -lreadline -lcurses
checking for readline... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
What is the current bug behavior?
nslookup.c
cannot find readline headers.
What is the expected correct behavior?
Pass CPPFLAGS
down the line.
Possible fixes
Naive fix:
# diff -u ./bin/dig/Makefile.orig ./bin/dig/Makefile
--- ./bin/dig/Makefile.orig 2021-08-20 00:03:59 +0000
+++ ./bin/dig/Makefile 2021-08-20 08:05:36 +0000
@@ -236,7 +236,7 @@
ALL_CPPFLAGS = \
${ALWAYS_INCLUDES} ${CINCLUDES} ${STD_CINCLUDES} \
- ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES}
+ ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES} ${BUILD_CPPFLAGS}
ALL_CFLAGS = ${EXT_CFLAGS} ${ALL_CPPFLAGS} ${CFLAGS} \
${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS}
After I have applied the fix:
root@deblndw024v:/var/tmp/ports/work/bind-9.11.35
# ldd ./bin/dig/nslookup
./bin/dig/nslookup:
libreadline.so.8 => /opt/ports/lib/hpux32/libreadline.so.8
libxcurses.so.1 => /usr/lib/hpux32/libxcurses.so.1
libgssapi_krb5.2 => /opt/ports/lib/hpux32/libgssapi_krb5.2
libkrb5.3 => /opt/ports/lib/hpux32/libkrb5.3
libk5crypto.3 => /opt/ports/lib/hpux32/libk5crypto.3
libcom_err.3 => /opt/ports/lib/hpux32/libcom_err.3
libnsl.so.1 => /usr/lib/hpux32/libnsl.so.1
libxnet.so.1 => /usr/lib/hpux32/libxnet.so.1
libc.so.1 => /usr/lib/hpux32/libc.so.1
libkrb5support.0 => /opt/ports/lib/hpux32/libkrb5support.0
libintl.so.10 => /opt/ports/lib/hpux32/libintl.so.10
libc.so.1 => /usr/lib/hpux32/libc.so.1
libxti.so.1 => /usr/lib/hpux32/libxti.so.1
libxti.so.1 => /usr/lib/hpux32/libxti.so.1
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
libiconv.so.8 => /opt/ports/lib/hpux32/libiconv.so.8
libc.so.1 => /usr/lib/hpux32/libc.so.1
libc.so.1 => /usr/lib/hpux32/libc.so.1