TigerVNC official site:http://www.linuxfromscratch.org/blfs/view/svn/xsoft/tigervnc.html
TigerVNC版本:1.6.0
一、前提
*******************************************************************************
** Building TigerVNC
*******************************************************************************
================================
Build Requirements (All Systems)
================================
-- CMake (http://www.cmake.org) v2.8 or later
-- zlib
-- FLTK 1.3.3 or later
-- If building TLS support:
* GnuTLS 3.x
* See "Building TLS Support" below.
-- If building native language support (NLS):
* Gnu gettext 0.14.4 or later
* See "Building Native Language Support" below.
-- libjpeg-turbo
* "Normal" libjpegv6 is also supported, although it is not
recommended as it is much slower.
=========================
※备注:可通过tigervnc源码中BUILDING.txt查看到以上内容,表明TigerVNC依赖FLTK库。
二、编译安装FLTK-1.3.3
1) 将下载的fltk-1.3.3-source.tar.gz放到/usr/local/src目录下
2) 切换至/usr/local/src目录,解压fltk-1.3.3-source.tar.gz
[email protected]:/usr/local/src# tar -xvf fltk-1.3.3-source.tar.gz
[email protected]:/usr/local/src# ls
fltk-1.3.3
3) 创建bin目录
[email protected]:/usr/local/src# cd fltk-1.3.3/
[email protected]:/usr/local/src/fltk-1.3.3# mkdir bin
4) 配置
[email protected]:/usr/local/src/fltk-1.3.3# cd bin
[email protected]:/usr/local/src/fltk-1.3.3/bin# cmake ..
5) 编译
[email protected]:/usr/local/src/fltk-1.3.3/bin# make
6) 安装
[email protected]:/usr/local/src/fltk-1.3.3/bin# make install
三、编译安装TigerVNC-1.6.0
1) 将下载的tigervnc-1.6.0.tar.gz放到/opt目录下
2) 将下载的tigervnc-1.6.0-gethomedir-1.patch和tigervnc-1.6.0-xorg118-1.patch 放到/opt目录下
3) 打补丁
[email protected]:/opt# patch -Np1 -i tigervnc-1.6.0-xorg118-1.patch
[email protected]:/opt# patch -Np1 -i tigervnc-1.6.0-gethomedir-1.patch
4) 切换至/opt目录,解压tigervnc-1.6.0.tar.gz
[email protected]:/opt# tar -xvf tigervnc-1.6.0.tar.gz
[email protected]:/opt# cd tigervnc-1.6.0/
5) 创建build目录
[email protected]:/opt/tigervnc-1.6.0# mkdir -vp build
6) 配置FLTK_BASE_LIBRARY、FLTK_IMAGES_LIBRARY及FLTK_INCLUDE_DIR变量
通过修改/opt/tigervnc-1.6.0/CMakeLists.txt配置
a) 找到fltk库的全路径
[email protected]:/opt/tigervnc-1.6.0# find / -type f -name libfltk.a
/opt/fltk/lib/libfltk.a
/opt/fltk-1.3.3/lib/libfltk.a
/usr/local/lib/libfltk.a
/usr/local/src/fltk-1.3.3/bin/lib/libfltk.a
/usr/lib/libfltk.a
[email protected]:/usr/local/lib# ls
fltk libfltk_forms.a libfltk_images.a
libfltk.a libfltk_gl.a
b) 修改CMakeLists.txt
[email protected]:/opt/tigervnc-1.6.0# vi /opt/tigervnc-1.6.0/CMakeLists.txt
增加如下内容
------------------
set(FLTK_BASE_LIBRARY "/usr/local/lib/libfltk.a")
set(FLTK_IMAGES_LIBRARY "/usr/local/lib/libfltk_images.a")
set(FLTK_INCLUDE_DIR "/usr/local/include/")
------------------
※备注:此步骤很关键,如果不配置变量,cmake配置时会报出warning,在make阶段报出错误
------------------
Linking CXX executable vncviewer
................................
collect2: error: ld returned 1 exit status
vncviewer/CMakeFiles/vncviewer.dir/build.make:404: recipe for target ‘vncviewer/vncviewer‘ failed
make[2]: *** [vncviewer/vncviewer] Error 1
CMakeFiles/Makefile2:775: recipe for target ‘vncviewer/CMakeFiles/vncviewer.dir/all‘ failed
make[1]: *** [vncviewer/CMakeFiles/vncviewer.dir/all] Error 2
Makefile:117: recipe for target ‘all‘ failed
------------------
7) 配置
[email protected]:/opt/tigervnc-1.6.0/build# cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
8) 编译
[email protected]:/opt/tigervnc-1.6.0/build# make
9) 安装
[email protected]:/opt/tigervnc-1.6.0/build# make install
即可使用/usr/bin/vncviewer。