Ubuntu 22.4 LTS 源码编译Tigervnc
1、安装前的依赖软件准备
-- make version > 3.10
apt install cmake
-- tigervnc依赖
apt install zlib1g-dev libpixman-1-dev libjpeg-turbo8-dev libfltk1.3-dev
apt install libsystemd-dev libavutil-dev
apt-get install gettext libffmpeg-ocaml-dev libgmp-dev libnettle-dev libgnutls28-dev libxi-dev
-- Xorg xserver使用
apt install xutils-dev
以上依赖在cmake中都有检查,不存在会提示。
2、Xorg Xserver
软件仓地址:
Files · server-1.20-branch · xorg / xserver · GitLab
tigervnc 1.14的官方指导安装文档是基于 server-1.20-branch的,在这个版本以上的高版本都不存在configure.ac
3、安装tigervnc的官方指导构建
Building the TigerVNC Server (Xvnc) is a bit trickier. Xvnc is typically built
to use the X11 shared libraries provided with the system. The procedure for
this is system-specific, since it requires specifying such things as font
directories, but the general outline is as follows (this procedure assumes
that the viewer has already been built, per above.)
> cd {build_directory}
If performing an out-of-tree build:
> cp -R {source_directory}/unix/xserver unix/
> cp -R {xorg_source}/* unix/xserver/
(NOTE: {xorg_source} is the directory containing the Xorg source for the
machine on which you are building TigerVNC. The most recent versions of
Red Hat/CentOS/Fedora, for instance, provide an RPM called
"xorg-x11-server-source", which installs the Xorg source under
/usr/share/xorg-x11-server-source.)
> cd unix/xserver/
> patch -p1 < {source_directory}/unix/xserver{version}.patch
(where {version} matches the X server version you are building, such as
"120" for version 1.20.x.)
> autoreconf -fiv
> ./configure --with-pic --without-dtrace --disable-static --disable-dri \
--disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \
--disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \
--disable-config-hal --disable-config-udev --disable-dri2 --enable-glx \
--with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \
--with-xkb-path=/usr/share/X11/xkb \
--with-xkb-output=/var/lib/xkb \
--with-xkb-bin-directory=/usr/bin \
--with-serverconfig-path=/usr/lib64/xorg \
{additional configure options}
(NOTE: This is merely an example that works with Red Hat Enterprise/CentOS
9 and recent Fedora releases. You should customize it for your particular
system. In particular, it will be necessary to customize the XKB
directory.)
For a regular, in-tree build:
> make TIGERVNC_SRCDIR={source_directory}
If performing an out-of-tree build:
> make TIGERVNC_SRCDIR={source_directory} TIGERVNC_BUILDDIR={build_directory}
(NOTE: Use absolute paths for source_directory and build_directory)
值得一提的是,前几步是在构建xserver,直到make TIGERVNC_SRCDIR={source_directory}才是构建tigervnc。
该操作指导,是一个in-tree和out-of-tree是指xserver。xserver的构建是放在tigervnc源码的unix/xserver中构建,还是使用单独的目录构建,上文中的{build_directory}就是用用来存在xserver的代码,和tigervnc对xserver的扩展。
如果使用in-tree方式构建,直接将xserver源码copy到tigervnc的源码的unix/xserver目录中。
如果使用out-of-tree方式构建,则新建文件夹{build_directory},并创建Unix目录,将xserver源码copy到Unix目录中,将tigervnc对xserver的扩展hw也copy到Unix下。此种方式,在构建tigervnc时,需要在make命令中指定tigervnc的源码目录和新建的{build_directory}。
4、将构建后的二进制打包
在tigervnc源码目录中,执行make tarball,可将构建的所有文件打到一个tar包中。
5、不包含xserver的构建
在构建时,如果直接在tigervnc中执行构建,只能构建x0vncserver,xvnc不能得到构建,因为其依赖xserver,xvnc是tigervnc的核心。正如其介绍:
Xvnc - the TigerVNC Server for Unix. Xvnc is both a VNC server and an X
server with a "virtual" framebuffer. You should normally use the vncserver service to start Xvnc.
x0vncserver - an inefficient VNC server which continuously polls any X
display, allowing it to be controlled via VNC. It is intended mainly as a demonstration of a simple VNC server.