#984504 pkg-config: "pkg-config --cflags" incorrectly omits -I flags

Package:
pkg-config
Source:
pkg-config
Description:
manage compile and link flags for libraries (transitional package)
Submitter:
Vincent Lefevre
Date:
2021-03-06 02:15:02 UTC
Severity:
important
#984504#5
Date:
2021-03-04 11:39:37 UTC
From:
To:
"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 dir.

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).

#984504#10
Date:
2021-03-06 02:13:55 UTC
From:
To:
I've reported the bug upstream.