Thursday, July 11, 2013

Building chromiumembedded on Ubuntu with pkg-config

Even after installing the necessary gtk libraries, you may find chromiumembedded build script complaining about a missing gtk/gtk.h file. To remedy this, you just have to tell the script where to find it.

First, make sure you have the a suitable version installed.

$ pkg-config --cflags gtk+-3.0
-pthread -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12

pkg-config will output the necessary include parameters so the build script knows where to find the script.  If pkg-config returns nothing, make sure you have a gtk development package installed.

Once that is properly set up, add this to the build file's cflags.  Find the line in the Makefile that defines the cflags.  Add the `pkg-config` in backticks, so when make runs, it will evaluate the flags and include the correct directions.

CFLAGS.target ?= $(CFLAGS)
becomes
CFLAGS.target ?= $(CFLAGS) `pkg-config --cflags gtk+-3.0`


If everything worked, you should have a Debug or Release directory with a beautiful libcef.so library in it.