For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > TigerVNC > 1.3.0 > building tigervnc

building tigervnc

Created by dave. Last edited by dave, 5 years and 40 days ago. Viewed 3,580 times. #3
[diff] [history] [edit] [rdf]

Building TigerVNC 1.3.0 on RHEL 6

For various reasons, I cannot use the RPMs for EL6, so I have to build from source.

The problem is that the documentation isn't clear on what you need to do in order to build TigerVNC server.

This sequence worked for me.

Building fltk:

Before you can build the server, you need to build the client in order to populate the common tree. Before you can build the client, you must build fltk. Before you can build fltk, you must patch fltk.

  • create a file called patch-fltk using the commands in the TigerVNC BUILDING.txt file.
  • then:
cd ~/build/fltk-1.3.2
bash ~/patch-fltk
./configure --prefix=/usr/local/fltk/1.3.2-patched --disable-threads --enable-shared
make install
Discussion: The BUILDING.txt file says about building fltk:
1. Check out FLTK 1.3.2 using Subversion:
$ svn co >> fltk-1.3.2
This never worked for me because was never reachable. I ended up grabbing the source from the fltk project page.

Further, the BUILDING.txt file says:

Use CMake to build FLTK using the same procedures described below for building TigerVNC. The recipes in the "Build Recipes" section also apply. If you want optimized code, make sure to build with -DCMAKE_BUILD_TYPE=Release.
This is useless advice at best. The cmake configuration for fltk is not a maintained configuration and the fltk project themselves don't recommend you use it. Autoconf may be old and busted, and not the new hotness, but in this case it has a terrific advantage over cmake in that it actually works. When I used cmake, I ended up with this build error:
[ 96%] Built target tabs
Linking CXX executable ../bin/examples/threads
CMakeFiles/threads.dir/threads.cxx.o: In function `fl_create_thread(unsigned long&, void* (*)(void*), void*)':
threads.cxx:(.text+0x29): undefined reference to `pthread_create'
collect2: ld returned 1 exit status
make[2]: *** [bin/examples/threads] Error 1
make[1]: *** [test/CMakeFiles/threads.dir/all] Error 2
make: *** [all] Error 2
I fussed around with cmake trying to get it to not build threads-related binaries, but could never get it to work, and the comment that cmake is not a maintained configuration probably explains why. I don't think the autoconf build will make the examples programs by default, so possibly I don't need --disable-threads, but the error above implied to me that I would be better off without them, so I disabled them to be safe.

TL/DR: don't use cmake for fltk.

Building TigerVNC Client:

cd ~/build/tigervnc-1.3.0
export PATH=/usr/local/fltk/1.3.2-patched/bin:$PATH
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/tigervnc/1.3.0 -G "Unix Makefiles" 
make install

Discussion: A few things here. First, the BUILDING.txt file talks about doing an out-of-tree build. This is a neat trick and one well worth while in the future. For the purposes of this build I want the server, and the server build is not cmake-driven, so you'll end up copying whacks of the server source into your out-of-source-tree tree, so frankly I don't see the point in this instance.

Secondly, you have to add the path to the fltk/bin directory that you installed fltk in above so that cmake can find it.

Finally, the -DCMAKE_INSTALL_PREFIX took me for ever to find on the internet.

More FLTK Discussion: the fltk instructions don't say to use --enable-shared, but the build process for TigerVNC seems to expect shared libraries by default. However the fltk project seems to prefer that people use statically linked libraries, so that's all they build by default. You have to manually enable the shared library build. If you don't, the vncviewer executable build will die with:

[100%] Building CXX object vncviewer/CMakeFiles/vncviewer.dir/X11PixelBuffer.cxx.o
Linking CXX executable vncviewer
/usr/local/fltk/1.3.2-patched/lib/libfltk_images.a(Fl_PNG_Image.o): In function `Fl_PNG_Image::load_png_(char const*, unsigned char const*, int)':
Fl_PNG_Image.cxx:(.text+0x71): undefined reference to `png_create_read_struct'
Fl_PNG_Image.cxx:(.text+0x83): undefined reference to `png_create_info_struct'
Fl_PNG_Image.cxx:(.text+0xaf): undefined reference to `png_destroy_read_struct'
Fl_PNG_Image.cxx:(.text+0xe6): undefined reference to `png_destroy_read_struct'
Fl_PNG_Image.cxx:(.text+0x147): undefined reference to `png_set_read_fn'
Fl_PNG_Image.cxx:(.text+0x158): undefined reference to `png_init_io'
Fl_PNG_Image.cxx:(.text+0x167): undefined reference to `png_read_info'
Fl_PNG_Image.cxx:(.text+0x176): undefined reference to `png_get_color_type'
Fl_PNG_Image.cxx:(.text+0x184): undefined reference to `png_set_expand'
Fl_PNG_Image.cxx:(.text+0x193): undefined reference to `png_get_color_type'
Fl_PNG_Image.cxx:(.text+0x1bc): undefined reference to `png_get_tRNS'
Fl_PNG_Image.cxx:(.text+0x1d1): undefined reference to `png_get_color_type'
Fl_PNG_Image.cxx:(.text+0x1ed): undefined reference to `png_get_image_width'
Fl_PNG_Image.cxx:(.text+0x204): undefined reference to `png_get_image_height'
Fl_PNG_Image.cxx:(.text+0x21e): undefined reference to `png_get_bit_depth'
Fl_PNG_Image.cxx:(.text+0x22c): undefined reference to `png_set_packing'
Fl_PNG_Image.cxx:(.text+0x236): undefined reference to `png_set_expand'
Fl_PNG_Image.cxx:(.text+0x247): undefined reference to `png_get_bit_depth'
Fl_PNG_Image.cxx:(.text+0x255): undefined reference to `png_set_strip_16'
Fl_PNG_Image.cxx:(.text+0x269): undefined reference to `png_get_valid'
Fl_PNG_Image.cxx:(.text+0x278): undefined reference to `png_set_tRNS_to_alpha'
Fl_PNG_Image.cxx:(.text+0x316): undefined reference to `png_set_interlace_handling'
Fl_PNG_Image.cxx:(.text+0x334): undefined reference to `png_read_rows'
Fl_PNG_Image.cxx:(.text+0x354): undefined reference to `png_read_end'
Fl_PNG_Image.cxx:(.text+0x365): undefined reference to `png_destroy_read_struct'
/usr/local/fltk/1.3.2-patched/lib/libfltk_images.a(Fl_PNG_Image.o): In function `png_read_data_from_mem(png_struct_def*, unsigned char*, unsigned long)':
Fl_PNG_Image.cxx:(.text+0x47d): undefined reference to `png_get_io_ptr'
Fl_PNG_Image.cxx:(.text+0x49e): undefined reference to `png_error'
collect2: ld returned 1 exit status
make[2]: *** [vncviewer/vncviewer] Error 1
make[1]: *** [vncviewer/CMakeFiles/vncviewer.dir/all] Error 2
make: *** [all] Error 2

Building TigerVNC Server:

cd ~/build/tigervnc-1.3.0
cp -R /usr/share/xorg-x11-server-source/* unix/xserver
cd unix/xserver
patch -p1 < ../xserver113.patch
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-dbus --disable-config-hal --disable-config-udev \\
      --disable-dri2 --enable-install-libxf86config --enable-glx \\
      --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \\
      --with-fontdir=/usr/share/X11/fonts \\
      --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 \\
echo all: > man/Makefile
echo install: >> man/Makefile
make install

Discussion: The xorg source is exactly where BUILDING.txt tells you it will be once you install the xorg-x11-server-source rpm. I found the instructions about copying and patching hard to follow, I got them wrong several times.

The configure command is the one from the BUILDING.txt file, with all the [64] parameters translated into 64 parameters instead, since I have a 64-bit platform. I ended up copying it to a file and then running the file as a command rather than keep typing it in.

The configure command will exit with:

configure: WARNING: unrecognized options: --with-fontdir, --with-dri-driver-path
...but the internet claims this is harmless.

Autoconf builds the Makefile in man/ but there don't seem to be any source files there. I don't know why, maybe my source tree is incomplete. My two steps here replace the correct Makefile with one that will dummy the build process so it won't die on a failed man page build.


That's it. After doing this, I could launch the server with something like

$ export PATH=/usr/local/tigervnc/1.3.0/bin:$PATH
$ Xvnc :42 -geometry=1024x768
...and it worked.


This worked for me on my system. Your milage may vary.

However, I'm more than a little pissed that it took two days of fucking around with builds for this to work. The instructions about fltk are misleading at best and flat-out wrong at worst. And when I brought the vncviewer build error to the tigervnc-users mailing list, I was told

The problem appears because you're trying to link FLTK statically. This is not a method that is particularly well supported with today's development tools.
The fact that one project is depending on another project to be built in a non-standard way -- doubly so, since you A) shouldn't use cmake even though they tell you to, and B) you need to enable the shared libraries -- just increases the waste of time.

TigerVNC is a great project, and the result they have is very usable. And if I'd been able to use the EL6 RPMs I wouldn't have tripped over any of this.

(The EL6 RPMs installed cleanly into a VM I made for paper-bag testing. So there's nothing wrong with them. It is only the mess of the rpm dependency tree on this particular EL6 system I need to run this on which forces me into the build-from-source route.)

Still, the build documentation could be clearer, so that idiots like me who know ./configure; make; make install can get around better.

Build from hell


This is the crib notes for installing on a CentOS-6 system which has been polluted by other repositories and has incomplete installs of things. It was incredibly painful, but might provide some hints for others in this boat.

  • build and install cmake:
./configure --prefix=/usr/local/cmake/2.8.12
make install
  • install some misc missing pieces:
yum install nasm
yum install libxkbfile-devel libxkbfile
yum install libXfont libXfont-devel
yum install xorg-x11-server-source.noarch
yum install xorg-x11-xtrans-devel.noarch
yum install xorg-x11-proto-devel.noarch
yum install xorg-x11-util-macros
  • build and install libjpeg-turbo:
./configure --prefix=/usr/local/libjpeg-turbo/1.3.0
make install
  • build and install gettext:
./configure --prefix=/usr/local/gettext/ --without-emacs
make install

(Note: the emacs bit was needed because it was complaining some font or other wasn't available.)

  • build tigervnc viewer:
export PATH=/usr/local/gettext/$PATH
ccmake -DCMAKE_INSTALL_PREFIX=/usr/local/tigervnc/1.3.0 -G "Unix Makefiles"
make install
Note: in the ccmake step, enable the advanced options and setup the paths to libjpeg-turbo manually; otherwise they won't be found and you'll probably end up with the non-turbo libraries. You probably also have to set the include directories for gettext manually. Once that's done, generate the build and exit cmake.
  • build tigervnc-server: as above, except my ./configure command looks like:
./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-dbus --disable-config-hal --disable-config-udev \\
      --disable-dri2 --enable-install-libxf86config --enable-glx \\
      --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \\
      --with-fontdir=/usr/share/X11/fonts \\
      --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 \\
      --with-dri-driver-path=/usr/lib64/dri \\
      --disable-unit-tests --disable-devel-docs \\
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt