While analyzing a CI failure in the Debian package of igc (https://salsa.debian.org/opencl-team/intel-graphics-compiler/-/jobs/3346488/raw), I found that some #include "../../foo.h do not point to actual files but need to be looked up via the -I search paths. That lead to the inclusion of a header from two different locations, causing weird duplicate definition errors. (The CI seems to have another unpacked source tree further up in the path and one copy was found there via ../../.. and some -I$sourceroot)
The actual culprit was IGC/AdaptorOCL/OCL/sp/sp_g8.cpp which has #include "../../../visa/include/visaBuilder_interface.h" that is missing a ../ to actually find the file.
A quick check with this script (as ../check-relative-includes):
#!/bin/sh
# find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -exec ../check-relative-includes '{}' \;
f=$1
test -f "$f" || exit 1
d=$(dirname $f)
for rincl in $(sed -r -n 's/^.*#\s*include\s+[<"](.*\.\..*)[>"].*$/\1/p' $f)
do
test -f "$d/$rincl" || echo "$f $rincl"
done
While analyzing a CI failure in the Debian package of igc (https://salsa.debian.org/opencl-team/intel-graphics-compiler/-/jobs/3346488/raw), I found that some
#include "../../foo.h
do not point to actual files but need to be looked up via the-I
search paths. That lead to the inclusion of a header from two different locations, causing weird duplicate definition errors. (The CI seems to have another unpacked source tree further up in the path and one copy was found there via../../..
and some-I$sourceroot
) The actual culprit wasIGC/AdaptorOCL/OCL/sp/sp_g8.cpp
which has#include "../../../visa/include/visaBuilder_interface.h"
that is missing a../
to actually find the file.A quick check with this script (as
../check-relative-includes
):found a few more possibly wrong include paths:
(please check intel-compute-runtime, too)