Cross-compiling Gtk+-3.12.2 with Wayland-1.3.39 backend for ARM

Author: kozmers@gmail.com

Server: [OpenSuSE 13.1 x86_64]

Target: [arm-linux]

cross-complie tool: [arm-linux-gcc 4.4.3]

 

 I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html

1. Prepare environment

2. Compile Wayland backend.

3. Complie Pictures libs.

4. Compile gtk libs.

 

1. Prepare environment

I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html

export PREFIX=/opt/gtk_wayland
export PATH=$PATH:$PREFIX/bin:/home/small2440/Tools/arm-linux-4.4.3/
export LD_LIBRARY_PATH=$PREFIX/lib
export C_INCLUDE_PATH=$PREFIX/include
export LDFLAGS="-L$PREFIX/lib"
export CFLAGS="-g -I$PREFIX/include"
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PREFIX/lib/
export ZLIB_CFLAGS=-I$PREFIX/include
export ZLIB_LIBS="-L$PREFIX/lib -lz"

 

wget http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz
CC=arm-linux-gcc ./configure --prefix=$PREFIX
make
make install

 

wget wget https://github.com/kergoth/tslib/archive/release/1.1.zip
mv 1.1.zip tslib-release-1.1.zip
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache
make
make install

 

2. Compile Wayland backend.

I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html

wget ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX 
make 
make install
cp $PREFIX/lib/libffi-3.0.11/include/ffi.h $PREFIX/inclue
cp $PREFIX/lib/libffi-3.0.11/include/ffitarget.h $PREFIX/include

 

wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 

wget http://wayland.freedesktop.org/releases/wayland-1.3.91.tar.xz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX  --disable-documentation

vi src/Makefile
commit below lines at the end of sr/Makefile
%-protocol.c : $(protocoldir)/%.xml
#    $(AM_V_GEN)$(wayland_scanner) code < $< > $@

%-server-protocol.h : $(protocoldir)/%.xml
#    $(AM_V_GEN)$(wayland_scanner) server-header < $< > $@

%-client-protocol.h : $(protocoldir)/%.xml
#    $(AM_V_GEN)$(wayland_scanner) client-header < $< > $@

copy a x86 version wayland  wayland-protocal.c wayland-server-protocal.h wayland-client-protocal.h to src/ (build by ./configure make make install based on expat)
make
make install

 

3. Complie Pictures libs.

I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html

wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --enable-shared
make
make install

 

wget http://sourceforge.net/projects/libpng/files/libpng12/1.2.51/libpng-1.2.51.tar.bz2
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 

wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 

4 Compile gtk libs.
I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html


gtk.org/download/linux.php
Stable release

wget http://ftp.gnome.org/pub/gnome/sources/glib/2.40/glib-2.40.0.tar.xz
echo ac_cv_type_long_long=yes>arm-linux.cache
echo glib_cv_stack_grows=no>>arm-linux.cache
echo glib_cv_uscore=no>>arm-linux.cache
echo ac_cv_func_posix_getpwuid_r=yes>>arm-linux.cache
echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.cache
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache --disable-debug
make
make install

 

wget http://ftp.gnome.org/pub/gnome/sources/atk/2.12/atk-2.12.0.tar.xz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 

 

wget http://cairographics.org/releases/pixman-0.32.2.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 


wget http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.30/gdk-pixbuf-2.30.8.tar.xz
echo gio_can_sniff=yes >arm-linux.cache解决下面的问题:
configure:26130: checking if gio can sniff png
configure:26137: error: in `/root/work/workspace/playerlib-code/gtk-dfb-imx51/gtk+-2.16.0':
configure:26140: error: cannot run test program while cross compiling

echo gio_can_sniff=yes >arm-linux.cache
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --without-x11 --cache-file=arm-linux.cache
make
make install

 

 Complie Fonts libs.

wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install
wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.0.tar.gz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX
make
make install

 

 

wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.29.tar.bz2
./autogen.sh
export FREETYPE_CFLAGS="-I$PREFIX/include -I$PREFIX/include/freetype2"
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --without-icu --without-cairo
make
make install

 


/*
wget http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.40/gobject-introspection-1.40.0.tar.xz
wget http://ftp.gnome.org/pub/gnome/sources/gtk-doc/1.19/gtk-doc-1.19.tar.xz
*/

 Cairo

wget http://www.cairographics.org/releases/cairo-1.12.16.tar.xz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --without-x --disable-xlib --disable-xlib-xrender --disable-xcb --disable-xcb-shm --disable-quartz --disable-quartz-font --disable-win32 --enable-pdf --enable-ps --enable-svg --enable-png
make
make install

 

wget http://ftp.gnome.org/pub/gnome/sources/pango/1.36/pango-1.36.3.tar.xz
export FREETYPE_CFLAGS="-I$PREFIX/include -I$PREFIX/include/freetype2"
export FONTCONFIG_CFLAGS="-I$PREFIX/include"
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --without-xft
make
make install

 

wget http://xkbcommon.org/download/libxkbcommon-0.4.2.tar.xz
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --disable-x11
make
make install

 

I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html 

wget http://ftp.gnome.org/pub/gnome/sources/gtk+/3.12/gtk+-3.12.2.tar.xz
vim configure
change below to line  let if always true
 #if ac_fn_c_try_link "$LINENO"; then :
if true; then :
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --without-x  \
--disable-x11-backend --enable-wayland-backend --disable-win32-backend --disable-quartz-backend \
--disable-cups --disable-papi --disable-cloudprint --disable-debug --enable-gtk2-dependency
vim gdk/wayland/gdkwindow-wayland.c
commit two lines as below
//typedef struct _GdkWaylandWindow GdkWaylandWindow;
//typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass;
make
make install

 

I firstly log my compiling journal on http://www.cnblogs.com/kozmers/articles/3800899.html

#include <gtk/gtk.h>

int main(int argc, char **argv)
{
    GtkWidget *window;
    gtk_init(&argc,&argv);

    window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show(window);

    gtk_main();
    return 0;
}

 

 

export PREFIX=/opt/gtk_wayland_arm
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig

arm-linux-gcc -o hello main.c -Wl,-rpath,$PREFIX/lib -lts `pkg-config --cflags --libs gtk+-3.0`
file hello 
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped

 

 

I have problem with test hello on my arm board as issue show below, and I will fix this later.
./hello
XDG_RUNTIME_DIR not set in the environment
export XDG_RUNTIME_DIR=/tmp

./hello
(hello:588): Gtk-WARNING **: cannot open display: 

export GDK_BACKEND=wayland

export DISPLAY=:0.0

./hello
(hello:588): Gtk-WARNING **: cannot open display: 
Wayland partially working outside of X with a frame buffer (on nvidia)  http://lists.freedesktop.org/archives/wayland-devel/2010-November/000234.html
"The Linux framebuffer is a graphic hardware-independent abstraction layer
to show graphics on a console without relying on system-specific libraries
such as SVGALib or the heavy overhead of the X Window System." -
https://wiki.ubuntu.com/FrameBuffer

I hope uv doesn't get too mad at me for posting this.  It's not done.  It's
broken.  But I ran the wayland compositor outside of X on my nvidia card
with nouveau, on nouveaufb.  With mouse and keyboard input even working.
He was using it with uvesafb.  No DRI / mesa required.  And, well,
I'm excited about that enough that I feel a need to share.

It sucked up over 8 gigabytes of virtual ram, on my machine with 8 gigs of
ram.  The only client I got to work was terminal.  Backgrounds didn't work.

Apply this patch to wayland:
http://www.iarc.org/~4z5uv/wayland-fb-2.diff

Copy this into the compositor directory:
http://www.iarc.org/~4z5uv/compositor-fb.c

I also needed to comment out three lines in compositor/compositor.c:

        else {
                //ec = drm_compositor_create(display, option_connector);
                //if (ec == NULL) {
                        ec = fb_compositor_create(display);
                //}
        }

Because it was selecting the DRM compositor (which doesn't work on nvidia).

Then build.

The most problematic part by far was figuring out that it only supports 16
bits per pixel.  If you have it at 32bpp, it breaks video output before
printing that error.

What I eventually did to get nouveaufb into 16bpp was:
GRUB_CMDLINE_LINUX_DEFAULT="video=DVI-I-1:1600x1200-16 at 75"
in /etc/default/grub, and then run update-grub

nouveaufb was set up under ubuntu by default after I disabled the
proprietary driver.

Unfortunately DVI-I-1 probably isn't going to be right for a lot of people.

To run wayland and the terminal client at the same time:

(sudo compositor/compositor &);sleep 1;clients/terminal &

Yeah I actually ran the compositor as root instead of figuring out what was
up with the permissions problems.

Using a background is broken too.  Using a jpeg doesn't seem to work.  I
noticed something about pngs in the patch, so I tried that.  It loaded the
background but then crashed.

-- 
"For every complex problem, there is a solution that is simple, neat,
and wrong." - H. L. Mencken
http://www.ChaosReigns.com

Wayland, Dumb Frame-Buffers & Embedded SoCs   http://www.phoronix.com/scan.php?page=news_item&px=OTI0MA 

 
posted @ 2014-06-24 22:23  Kozmers  阅读(1573)  评论(0编辑  收藏  举报