GNOME Bugzilla – Bug 747445
GDK include flags (pkg-config workaround for epoxy) break cross-compile build
Last modified: 2015-05-10 05:15:55 UTC
Commit 57751fa3 breaks cross-compiling (at least on yocto). It adds GDK_EXTRA_CFLAGS="-I${prefix}/include" into configure.ac which then poisons the include path with "-I/usr/include" in an environment that uses another sysroot. The commit message was: Work around a pkg-config bug It doesn't report -I${prefix}/include in cflags, even if .pc files explicitly put it there. This was breaking the build outside of a jhbuild shell when libepoxy is in the jhbuild tree but not in /usr. I don't really understand the reasoning: pkg-config dropping system include directories is not a bug AFAIK. If the stripping is not what is wanted in jhbuild, maybe setting PKG_CONFIG_ALLOW_SYSTEM_CFLAGS/LIBS would help (in jhbuild)?
Either it is a bug that I explicitly include the needed include in CFLAGS, or it is a bug that pkg-config drops includes that are needed for a successful build. You can't have it both ways...
Ok, I don't want to argue that: As I said, I don't really understand the case you are fixing. Generally speaking I do believe pkg-config dropping paths that it and compilers consider "system include dirs" is something pkg-config developers consider a feature. In any case just adding "-I${prefix}/include" seems wrong to me: It does add an unwanted (possibly dangerous) include directory to CFLAGS while cross compiling, and reverting the commit fixes things.
(In reply to Jussi Kukkonen from comment #2) > Ok, I don't want to argue that: As I said, I don't really understand the > case you are fixing. libepoxy installs its headers inside ${includedir}/epoxy, but its pkg-config file presents -I${includedir} as the include path, and callers are expected to use #include <epoxy/...> to include libepoxy include files. pkg-config removes -I${includedir}, which means that libepoxy headers are not found when building GTK+, i.e. this is the result: $ pkg-config --cflags epoxy > In that case, epoxy is installed in jhbuild but *not* in the system, and the ${includedir} is definitely not `/usr/include`. > In any case just adding "-I${prefix}/include" seems wrong to me: It does add > an unwanted (possibly dangerous) include directory to CFLAGS while cross > compiling, and reverting the commit fixes things. It seems that this is a bug in pkg-config being overeager in stripping include paths.
I just checked, and jhbuild sets C_INCLUDE_PATH to be the install prefix + '/include'. This triggers the "is this a system inclusion rule" check inside pkg-config. A plausible solution would be to add PKG_CONFIG_ALLOW_SYSTEM_CFLAGS inside jhbuild, but that would obviously expose us to pkgconfig files that really did say '-I/usr/include' instead of '-I${prefix}/include'. Another solution would be to move libepoxy headers from '${includedir}/epoxy' to '${includedir}/epoxy-1/epoxy', as a workaround for the system cflags policy of pkg-config.
I think the original patch was bad -- we should not expect that randomly typing 'make' should work outside of 'jhbuild shell'.
I've reverted the problematic patch.