"pkg-config --cflags" incorrectly omits -I flags
With pkg-config 0.29.2 under Debian, pkg-config --cflags
incorrectly omits -I
flags, potentially yielding errors, or even incorrect builds because a wrong .h
file could be included. This happens when a CPATH
or C_INCLUDE_PATH
environment variable has the include directory in question.
Example:
zira% pkg-config --cflags fplll
-pthread -I/home/vinc17/opt/fplll/include
zira% CPATH=/home/vinc17/opt/fplll/include pkg-config --cflags fplll
-pthread
zira% C_INCLUDE_PATH=/home/vinc17/opt/fplll/include pkg-config --cflags fplll
-pthread
At least with C_INCLUDE_PATH
, this is incorrect because this environment variable is ignored by g++
.
Not sure about CPATH
, but it would be safer to ignore it as well in case it would be unset or it would not be taken into account by some compiler (it is not specified by POSIX).
Bug also reported in the Debian BTS: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984504