local/overlay method: gtk/gtk.h no such file

Clarke Wixon cwixon at usa.net
Thu Sep 27 00:04:23 CEST 2007


Shakthi Kannan <shakthimaan at ...> writes:

> When we say, "inherit openmoko" shouldn't it include the required
> header files, or am I missing some libraries to be included?

Shakthi,

It took me a loooooong time to figure this out myself, but the bottom line is,
unfortunately, NO -- the c cross-compiler doesn't automatically know where the
headers from your build environment are.

You have a couple of choices.

(1) Tell it manually, as in:

    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/gtk-2.0"

. . . in your .bb file.  Note that ${STAGING_INCDIR} is the root directory of
where the header files from your cross-compile environment live -- but it has
many subdirectories that AREN'T automatically searched.

But this is only part of the story.  Even if you are successful in pointing to
gtk via the line above, then gtk will look for other headers it wants and
probably won't be able to find them.  Most likely you will end up with something
like:

    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/gtk-2.0"
    TARGET_CFLAGS_append += "-I${STAGING_LIBDIR}/gtk-2.0/include"
    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/cairo"
    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/glib-2.0"
    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/pango-1.0"
    TARGET_CFLAGS_append += "-I${STAGING_INCDIR}/atk-1.0"

Yuck!

To avoid this, you take the other option, which is . . .

(2) Use pkgconfig.

    http://en.wikipedia.org/wiki/Pkg-config

Then, if your program's Makefile is set up to use pkg-config, you can just add

    inherit pkgconfig

. . . to your .bb file, and that's basically all you would need to do.  The
pkgconfig.bbclass file takes care of the rest, and ensures that the CFLAGS are
set up properly to point to the cross-compilation headers.

It's a nice solution.

-C




More information about the openmoko-devel mailing list