After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747445 - GDK include flags (pkg-config workaround for epoxy) break cross-compile build
GDK include flags (pkg-config workaround for epoxy) break cross-compile build
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-04-07 12:35 UTC by Jussi Kukkonen
Modified: 2015-05-10 05:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jussi Kukkonen 2015-04-07 12:35:58 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)?
Comment 1 Matthias Clasen 2015-04-08 11:47:18 UTC
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...
Comment 2 Jussi Kukkonen 2015-04-09 12:08:48 UTC
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.
Comment 3 Emmanuele Bassi (:ebassi) 2015-04-09 12:35:57 UTC
(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.
Comment 4 Emmanuele Bassi (:ebassi) 2015-04-09 12:42:32 UTC
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.
Comment 5 Allison Karlitskaya (desrt) 2015-04-09 13:19:54 UTC
I think the original patch was bad -- we should not expect that randomly typing 'make' should work outside of 'jhbuild shell'.
Comment 6 Matthias Clasen 2015-05-10 05:15:55 UTC
I've reverted the problematic patch.