Symbolic link resolution of g-ir-scanner leads to header files not found using compiler wrappers on FreeBSD
When using the pkgsrc framework and its cwrappers to build packages with gobject-introspection, some header files are not found due to g-ir-scanner.
I encountered the problem with pango. First is a custom command in build.ninja:
g-ir-scanner [...] --cflags-begin [...] -I/home/triaxx/pkg/include/harfbuzz [...]
Then a compilation command is resulting:
cc [...] -I/usr/home/triaxx/pkg/include/harfbuzz [...]
/home is resolved in /usr/home because FreeBSD provides /home as a link to /usr/home. Here, cc is a wrapper on clang that checks that header files are in a dedicated "buildlink" directory (.buildlink/home/triaxx/pkg/include/harfbuzz). Since this directory is built using "/home/triaxx/pkg/include/harfbuzz" path, hb.h is not found in /usr/home/triaxx/pkg/include/harfbuzz because .buildlink/usr/home/triaxx/pkg/include/harfbuzz does not exist.
In this very specific case, the patch below solves the problem.
Is there strong reasons to pass realpath of include directories to the compiler?
Index: patches/patch-giscanner_ccompiler.py =================================================================== RCS file: patches/patch-giscanner_ccompiler.py diff -N patches/patch-giscanner_ccompiler.py 0a1,13 > $NetBSD$ > > --- giscanner/ccompiler.py.orig 2020-04-05 14:08:04.702725000 +0000 > +++ giscanner/ccompiler.py > @@ -432,7 +432,7 @@ class CCompiler(object): > other_options =  > > for o in options: > - option = utils.cflag_real_include_path(o) > + option = o > if option.startswith('-I'): > includes.append(option[len('-I'):]) > elif option.startswith('-D'): Index: patches/patch-giscanner_scannermain.py =================================================================== RCS file: patches/patch-giscanner_scannermain.py diff -N patches/patch-giscanner_scannermain.py 0a1,13 > $NetBSD$ > > --- giscanner/scannermain.py.orig 2020-04-05 14:08:04.702725000 +0000 > +++ giscanner/scannermain.py > @@ -52,7 +52,7 @@ def process_cflags_begin(option, opt, value, parser): > if arg == "-I" and parser.rargs and parser.rargs != '--cflags-end': > # This is a special case where there's a space between -I and the path. > arg += parser.rargs.pop(0) > - cflags.append(utils.cflag_real_include_path(arg)) > + cflags.append(arg) > > > def process_cflags_end(option, opt, value, parser):