Page 1 of 1

Clutter & Cogl on raspberry pi without X server

Posted: Sun Oct 12, 2014 9:10 am
by loftsy
Hi All,

Clutter is a really nice graphics library / scene graph for making user interfaces from Intel. It handles drawing to the screen, text rendering, input events and works through GLES so is fast. It has bindings to lots of languages (python, javascript, ...). Basically it is an awesome way to use the HDMI output without running an X server.

I couldn't find any instructions for getting this working on the pi and it took me a while to work out. It required patching cogl for the specific GLES initialization required on the PI.

To install it on raspbian (these instructions will build it in /home/pi/dev/build):

Code: Select all

# Install base libraries
sudo apt-get install autoconf libtool automake libgudev-1.0-dev libxkbcommon-dev libudev-dev libmtdev-dev libev-dev gobject-introspection libgirepository1.0-dev python-gi-cairo

# Define some variables !!!
export LIBS="-lGLESv2 -lEGL  -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm"
export CPPFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
export CFLAGS="-DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi"
export LDFLAGS="-L/opt/vc/lib"
export LD_LIBRARY_PATH=/home/pi/dev/build/lib:/opt/vc/lib
export PKG_CONFIG_PATH=/home/pi/dev/build/lib/pkgconfig
export XDG_DATA_DIRS=/home/pi/dev/build/share
export GI_TYPELIB_PATH=/home/pi/dev/build/lib/girepository-1.0

# Download my patched Cogl-1.18.0 branch
git clone [email protected]:adamlofts/cogl.git
./autogen.sh --prefix=/home/pi/dev/build --enable-gl=no --enable-xlib-egl-platform=no --enable-gles2=yes --enable-null-egl-platform=yes --disable-glibtest --without-x --enable-introspection=yes
make
make install

# Checkout libevdev (git://anongit.freedesktop.org/libevdev)
./autogen.sh --prefix=/home/pi/dev/build && make && make install

# Checkout libinput (git://anongit.freedesktop.org/libinput)
./autogen.sh --prefix=/home/pi/dev/build && make && make install

# Download Clutter-1.2.0
./autogen.sh --prefix=/home/pi/dev/build --enable-egl-backend=yes --enable-evdev-input=yes --enable-x11-backend=no --without-x --enable-maintainer-flags=no --enable-gdk-backend=no --enable-introspection=yes
make && make install