2008/06/27

WMU-6500FS - GTK+ 2.10.14



GTK+ 2.10.14

[Home page] [List of dependencies]

Build results: [binary] [list files]

Related stuff:
[XCB] [XCB util] [gperf] [cairo] [pango] [libtiff] [fontconfig]

Build sequence:
dev# cd /usr/local/src
dev# wget http://ftp.gnome.org/pub/gnome/sources/gtk+/2.10/gtk+-2.10.14.tar.bz2
dev# tar xjvf gtk+-2.10.14.tar.bz2
dev# ./configure --prefix=/mnt/C/sys
gdkdrawable-x11.c:32:24: cairo-xlib.h: No such file or directory
Not much of a progress. It seems we need to build the cairo library. Here are the details.

Now we can try to re-configure...
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
configure: error:
*** Checks for TIFF loader failed. You can build without it by passing
*** --without-libtiff to configure but some programs using GTK+ may
*** not work properly
We can build it with the --without-libtiff option or we have to install the TIFF library.

Once it is done we can re-configure and make:
dev# export LDFLAGS=-L/mnt/C/sys/lib
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
dev# make
...
 gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION 
-I../.. -I../../gdk -I../../gdk -DGDK_PIXBUF_DISABLE_DEPRECATED 
-DG_DISABLE_CAST_CHECKS -pthread -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo 
-I/mnt/C/sys/X11/include/ -g -O2 -Wall -MT gdkdrawable-x11.lo -MD -MP -MF 
.deps/gdkdrawable-x11.Tpo -c gdkdrawable-x11.c  -fPIC -DPIC -o 
libs/gdkdrawable-x11.o
gdkdrawable-x11.c:32:24: cairo-xlib.h: No such file or directory
It seems some modules try to directly include the cairo header files as they were placed at an include path, but that is not the case.
dev# export CXXFLAGS=-I/mnt/C/sys/X11/include/cairo
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
dev# make
In file included from gdkdrawable-x11.c:32:
/mnt/C/sys/X11/include/cairo/cairo-xlib.h:97:3: #error Cairo was not compiled with support for the xlib backend
It seems we have to build the XCB library (Here is the build sequence) and then re-build the cairo library properly.

Now we are ready to proceed with GTK:
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
...
configure:31390: gcc -o conftest -I/mnt/C/sys/X11/include/cairo -Wall -I/mnt/C/sys/X11/include
-L/mnt/C/sys/lib conftest.c -L/mnt/C/sys/X11/lib -lXext -lXrender -lX11  -lintl >&5
/mnt/C/sys/X11/lib/libxcb-xlib.so.0: undefined reference to `backtrace_symbols'
/mnt/C/sys/X11/lib/libxcb-xlib.so.0: undefined reference to `backtrace'
It seems that xcb is not properly configured, it needs a backtrace support (not provided by uClibc). So we have to rebuild libxcb with the HAVE_BACKTRACE configure hack.

Let's try it again, do not worry, we are almost there ;-)
dev# make clean
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
dev# make
...
/bin/sh ../libtool --mode=link gcc  -I/mnt/C/sys/X11/include/cairo -Wall  
-L/mnt/C/sys/lib -L/mnt/C/sys/X11/lib -o gtk-query-immodules-2.0 queryimmodules.o 
libgtk-x11-2.0.la ../gdk-pixbuf/libgdk_pixbuf-2.0.la ../gdk/libgdk-x11-2.0.la 
gcc -I/mnt/C/sys/X11/include/cairo -Wall -o .libs/gtk-query-immodules-2.0 
queryimmodules.o  -L/mnt/C/sys/lib -L/mnt/C/sys/X11/lib  ./.libs/libgtk-x11-2.0.so 
/usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so -L/mnt/C/sys/X11/lib 
/usr/lib/libatk-1.0.so ../gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so 
../gdk/.libs/libgdk-x11-2.0.so /usr/lib/libpangocairo-1.0.so /usr/lib/libcairo.so 
/usr/lib/libpixman-1.so /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so 
...
/usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so: undefined reference to `cairo_xlib_surface_create_for_bitmap'
/usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so: undefined reference to `cairo_xlib_surface_create'
/usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so: undefined reference to `cairo_xlib_surface_set_size'
collect2: ld returned 1 exit status
It seems that the static linker did not find some cairo symbols.
Let's look to gdk to be sure what cairo symbols are referenced:
dev# nm /usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so | grep cairo_xlib_surface_create
         U cairo_xlib_surface_create
         U cairo_xlib_surface_create_for_bitmap
Let's look at the cairo library why they are missing...
dev# nm /mnt/C/sys/X11/lib/libcairo.so | grep cairo_xlib_surface_create
...
0005b7d3 T cairo_xlib_surface_create
0005b834 T cairo_xlib_surface_create_for_bitmap
...
It seems the symbols are there. If they was not there it would be due to incorrect cairo configuration, namely missing --with-x configure script option (see this mail). However I think that in this regard we have the cairo configured properly.

Not sure what is actually going on here, maybe it is the order of libraries passed to static linker (the fact that the libcairo.so goes after the libgdk-x11-2.0.so):
gcc -I/mnt/C/sys/X11/include/cairo -Wall -o .libs/gtk-query-immodules-2.0 queryimmodules.o
-L/mnt/C/sys/lib -L/mnt/C/sys/X11/lib ./.libs/libgtk-x11-2.0.so 
/usr/local/src/gtk+-2.10.14/gdk/.libs/libgdk-x11-2.0.so -L/mnt/C/sys/X11/lib 
/usr/lib/libatk-1.0.so ../gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so 
../gdk/.libs/libgdk-x11-2.0.so /usr/lib/libpangocairo-1.0.so /usr/lib/libcairo.so 
/usr/lib/libpixman-1.so /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so 
/usr/lib/libpng12.so /mnt/C/sys/X11/lib/libxcb-render-util.so /mnt/C/sys/X11/lib/libxcb-render.so 
/mnt/C/sys/X11/lib/libpixman-1.so /usr/lib/libfontconfig.so /usr/lib/libfreetype.so 
-lz /usr/lib/libexpat.so /mnt/C/sys/X11/lib/libXinerama.so 
/mnt/C/sys/X11/lib/libXrandr.so /mnt/C/sys/X11/lib/libXext.so 
...
In any case the following hack "fixed" the problem:
dev# make clean
dev# export LDFLAGS="-L/mnt/C/sys/lib -L/mnt/C/sys/X11/lib /mnt/C/sys/X11/lib/libcairo.so"
dev# ./configure --prefix=/mnt/C/sys/X11/ --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
dev# make
Test installation:

Now we are ready to test the installation:
dev# /mnt/C/sys/X11/bin/gtk-demo
...
(gtk-demo:25684): Pango-CRITICAL **: No fonts found:
This probably means that the fontconfig
library is not correctly configured. You may need to
edit the fonts.conf configuration file. More information
about fontconfig can be found in the fontconfig(3) manual
page and on http://fontconfig.org
...
The application seems as follows:

The fonts are compiled and deployed but not installed correctly, when we build the fontconfig then we can perform the following test:
dev# fc-list
dev#
We have to create a link to /usr/share/ directory to make fonts visible:
dev# ln -s /mnt/C/sys/X11/lib/X11/fonts/ /usr/share/fonts
dev# fc-cache
dev# fc-list
Luxi Serif:style=Regular
LucidaBright:style=Italic
Utopia:style=Bold Italic
Serto Malankara:style=Regular
...
The startup time of the gtk-demo application (as well as for example simple xclock) increased significantly. It seems that number of fonts greatly influences the x-apps' startup times. When we (according to this source) limit the number of linked fonts (e.g. only OTF and TTF) (see alsho this tip), the situation is slightly better:
box# rm /usr/share/fonts
box# mkdir /usr/share/fonts
box# ln -sn $XORG_PREFIX/lib/X11/fonts/OTF /usr/share/fonts/X11-OTF &&
box# ln -sn $XORG_PREFIX/lib/X11/fonts/TTF /usr/share/fonts/X11-TTF
Still the x-client applications are relatively slow, turning the ssh compression helped a bit, but more evaluation and benchmarking is needed...

libxcb-1.1

[XCB dependencies]

Build results: [binary] [list files]

Build sequence: We can download XCB via the git_xorg.sh script (for details see XOrg related post) or we can do it by hand. As it is described here. First we have to download and build the protocol headers and pthread stubs (on linux it should be just stubs and nothing more).
dev# cd /usr/local/src
dev# wget http://xcb.freedesktop.org/dist/xcb-proto-1.1.tar.gz
dev# tar xzvf xcb-proto-1.1.tar.gz
dev# ./configure --prefix=/mnt/C/sys/X11
dev# make
dev# cp xcb-proto.pc /mnt/C/sys/X11/lib/pkgconfig/
dev# cd ..
dev# wget http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2
dev# tar xjzf libpthread-stubs-0.1.tar.bz2
dev# cd libpthread-stubs-0.1
dev# ./configure --prefix=/mnt/C/sys
dev# make
dev# make install
Now we can proceed to build the XCB itself:
dev# cd /usr/local/src
dev# wget http://xcb.freedesktop.org/dist/libxcb-1.1.tar.bz2
dev# tar xjvf libxcb-1.1.tar.bz2
dev# cd libxcb-1.1
In order to configure the it was necessary to set the PKG_CONFIG_PATH properly. Maybe it is a good idea to have it set on every boot...
For now we just set it one-shot:
dev# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/mnt/C/sys/lib/pkgconfig/:/mnt/C/sys/X11/lib/pkgconfig/
Another problem was with backtrace symbols. During the static linking everything seem ok, but the runtime linker (when an application is launched) complains about missing symbols:
/mnt/C/sys/X11/lib/libxcb-xlib.so.0: undefined reference to `backtrace_symbols'
/mnt/C/sys/X11/lib/libxcb-xlib.so.0: undefined reference to `backtrace'
It seems that backtrace support is not implemented in uClibc 0.9.27. Regarding this ticket it should be present since version 0.9.28.
For now I decided to re-configure the library not to use the backtrace support at all. It is relatively simple - we just backup and alter the configure.ac file as follows:
dev# cat configure.ac | grep backtrace
AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
dev# cp configure.ac{,.backup}   
dev# sed -i 's/AC_CHECK_HEADER(\[execinfo.h\],\[AC_DEFINE(HAVE_BACKTRACE/#AC_CHECK_HEADER(\[execinfo.h\],\[AC_DEFINE(HAVE_BACKTRACE/g' configure.ac
dev# cat configure.ac | grep backtrace
#AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
One more time we re-configure and rebuild the library:
dev# make clean
dev# ./configure --prefix=/mnt/C/sys/X11
dev# make
dev# make install
Note: Regarding to the missing backtrace support we can also consider deleting the /usr/include/execinfo.h file instead of altering the configuration files.
dev# mv /usr/include/execinfo.h{,.deleted}
I do not know if it is correct solution but it seems logically the file contains just declarations of those backtrace related functions and the fact that is it not present fixes the behavior of configure scripts.
For more info see Problems compiling pdns using uClibc.

gperf-3.0.3

Build results: [binary] [list files]

Build sequence:
dev# cd /usr/local/src
dev# wget http://ftp.gnu.org/gnu/gperf/gperf-3.0.3.tar.gz
dev# tar xzvf gperf-3.0.3.tar.gz
dev# cd gperf-3.0.3
dev# ./configure --prefix=/mnt/C/sys/
dev# make
dev# make install

xcb-util-0.2

Dependencies: [gperf] [xcb]

Build results: [binary] [list files]

Build sequence:
dev# cd /usr/local/src
dev# wget http://xcb.freedesktop.org/dist/xcb-util-0.2.tar.bz2
dev# tar xjvf xcb-util-0.2.tar.bz2
dev# ./configure --prefix=/mnt/C/sys/X11
dev# make
dev# make install

cairo-1.6.4

[Home page]

Dependencies: [xcb]

Build results: [binary] [list files]

Build sequence:
dev# cd /usr/local/src
dev# wget http://cairographics.org/releases/cairo-1.6.4.tar.gz
dev# tar xzvf cairo-1.6.4.tar.gz
dev# cd cairo-1.6.4
Simply calling ./configure --prefix=/mnt/C/sys/X11 does not work with the GTK library, we have to configure the cairo with the Xlib support.
dev# ./configure --prefix=/mnt/C/sys/X11 --with-x -x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/ --enable-xlib=yes --enable-xlib-xrender=yes --enable-xcb=yes
cairo (version 1.6.4) will be compiled with the following surface backends:
  image:         yes (always builtin)
  Xlib:          yes
  Xlib Xrender:  yes
  Quartz:        no (CoreGraphics framework not found)
  Quartz-image:  no (disabled, use --enable-quartz-image to enable)
  XCB:           yes
  Win32:         no (requires a Win32 platform)
  OS2:           no (disabled, use --enable-os2 to enable)
  PostScript:    yes
  PDF:           yes
  SVG:           yes
  glitz:         no (disabled, use --enable-glitz to enable)
  BeOS:          no (disabled, use --enable-beos to enable)
  DirectFB:      no (disabled, use --enable-directfb to enable)

the following font backends:
  FreeType:      yes
  Win32:         no (requires a Win32 platform)
  Quartz:        no (CoreGraphics framework not found)

the following features:
  PNG functions: yes

and the following debug options:
  gcov support:  no
  test surfaces: no
  ps testing:    no (requires ghostscript)
  pdf testing:   no (requires poppler-glib >= 0.8.0)
  svg testing:   no (requires librsvg-2.0 >= 2.15.0)

using CFLAGS:
-I/usr/include/freetype2 -I/usr/include/libpng12 -I/mnt/C/sys/X11/include -I/mnt/C/sys/XOrg/include -I/mnt/C/sys/XOrg/include -I/mnt/C/sys/XOrg/include/pixman-1 -Wall -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute 
-Wno-unused-parameter -Wno-long-long -Winline -fno-strict-aliasing

*** The XCB backend is still under active development and
*** is included in this release only as a preview. It does not
*** fully work yet and incompatible changes may yet be made
*** to XCB-backend specific API.

dev# make
dev# make install

libtiff 3.8.2

Build results: [binary] [list files]

Build sequence:
dev# cd /usr/local/src
dev# wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz
dev# tar xzvf tiff-3.8.2.tar.gz
dev# ./configure --prefix=/mnt/C/sys
dev# make
dev# make install

pango-1.21.3

[Home page]

Dependencies: [cairo]

Build results: [binary] [list files]

Build sequence:
dev# cd /usr/local/src
dev# wget http://ftp.gnome.org/pub/GNOME/sources/pango/1.21/pango-1.21.3.tar.bz2
dev# tar xjvf pango-1.21.3.tar.bz2
dev# cd pango-1.21.3
dev# ./configure --prefix=/mnt/C/sys/X11 --with-x --x-includes=/mnt/C/sys/X11/include/ 
--x-libraries=/mnt/C/sys/X11/lib/
dev# make
dev# make install

fontconfig-2.6.0

[Home page]

Build results: [binary] [list files]

Build sequence: We have to configure it to look at the /mnt/C/sys/X11/etc/fonts/ directory (instead of default /etc/fonts/) since the /etc directory is read-only (we are not even able to create a symlink).
dev# cd /usr/local/src
dev# wget http://fontconfig.org/release/fontconfig-2.6.0.tar.gz
dev# tar xzvf fontconfig-2.6.0.tar.gz
dev# cd fontconfig-2.6.0
dev# ./configure --prefix=/mnt/C/sys/X11 --with-confdir=/mnt/C/sys/X11/etc/fonts/
dev# make 
dev# make install

2 comments:

Dynia said...

Hi Filodej,
It`s me again. :)
I decided to look how GTK works on the box and installed all that staff. when i ran gtk-test it complain that libXinerama.so is missing and drop-out.
I did not locate that file either.

Thanks,
Dynia

filodej said...

Hello again,
did you install the X.Org stuff? libXinerama.so is placed in the archive. X11 libraries are a precondition for any X application.
(Maybe I should have mention it explicitly).

Let me know how it went.
Regards,
Filodej.