gtk升级之路

0x00 前言

为了安装好看的主题,决定自行升级gtk到3.24.8

0x01 准备

登录 https://www.gtk.org/ 下载最新版gtk源码并解压

运行

1
./configure --prefix=/opt/gtk

提示如下

1
2
3
4
5
6
7
8
9
10
configure: error: Package requirements (glib-2.0 >= 2.53.4    atk >= 2.15.1    pango >= 1.41.0    fribidi >= 0.19.7    cairo >= 1.14.0    cairo-gobject >= 1.14.0    gdk-pixbuf-2.0 >= 2.30.0) were not met:

No package 'glib-2.0' found
No package 'atk' found
No package 'pango' found
No package 'fribidi' found
No package 'cairo' found
No package 'cairo-gobject' found
No package 'gdk-pixbuf-2.0' found

一个一个来

1. atk 安装

1
sudo apt install libatk1.0-dev

2. glib 安装

先到官网下载源码,解压并进入目录,install.in提示用meson编译

安装meson

1
2
3
4
5
# meson安装前必须确认是否已经安装python3.5以上的版本。
sudo apt-get install python3 python3-pip ninja-build

安装meson
pip3 install --user meson

回到glib目录

1
2
3
mkdir build
cd build
meson --prefix=/usr ..

提示

1
2
3
4
Dependency mount found: NO (tried pkgconfig and cmake)

meson.build:1814:2: ERROR: Dependency "mount" not found, tried pkgconfig and cmake

执行

1
sudo apt-get install libmount-dev

继续

1
2
ninja
sudo ninja install

参考:http://www.linuxfromscratch.org/blfs/view/cvs/general/glib2.html

安装后启动应用会报错,重启无法进入桌面

1
/usr/sbin/lightdm: symbol lookup error: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: g_date_copy

检查

1
2
ls -il /lib/x86_64-linux-gnu/libglib-2.0.so*
ls -il /usr/lib/x86_64-linux-gnu/libglib-2.0.so*

两个版本不一致,删除/lib下的

1
rm -f /lib/x86_64-linux-gnu/libglib-2.0.so.0 /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1

参考:https://medium.com/@Aenon/glib-symbol-lookup-bug-in-debian-or-ubuntu-def678dab5a6

源码安装pango

下载,解压

1
wget http://ftp.gnome.org/pub/gnome/sources/pango/
1
2
3
mkdir build
cd build
meson --prefix=/usr ..

提示

1
pango/meson.build:134:2: ERROR: Program(s) ['g-ir-scanner'] not found or not executable

安装包

1
sudo  apt install gobject-introspection

编译

1
ninja

报错

1
2
Couldn't find include 'GObject-2.0.gir' (search path: ['/usr/share/gnome/gir-1.0', '/usr/local/share/gir-1.0', '/usr/share/gir-1.0', '/var/lib/snapd/desktop/gir-1.0', '/usr/share/gir-1.0', '/usr/share/gir-1.0', '/usr/share/gir-1.0'])

安装

1
sudo apt install libgirepository1.0-dev

安装gdk-pixbuf-2.0

下载,解压并进入目录

1
wget http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2

编译

1
2
3
mkdir build
cd build
meson --prefix=/usr ..

报错

1
2
3
Dependency x11 found: NO (tried pkgconfig and cmake)

meson.build:393:2: ERROR: Dependency "x11" not found, tried pkgconfig and cmake

安装

1
sudo apt-get install xorg-dev

编译`

1
ninja

报错

1
2
3
4
5
6
[29/167] Generating gdk-pixbuf-query-loaders-man with a custom command.
FAILED: /usr/bin/xsltproc --nonet --stringparam man.output.quietly 1 --stringparam funcsynopsis.style ansi --stringparam man.th.extra1.suppress 1 --stringparam man.authors.section.enabled 0 --stringparam man.copyright.section.enabled 0 -o docs/gdk-pixbuf-query-loaders.1 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl ../docs/gdk-pixbuf-query-loaders.xml
I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

解决

1
sudo apt install docbook-xsl

继续

1
sudo ninja install 

继续安装cairo

1
sudo apt install  libcairo2-dev