Misc. Build problems:   We collect here rare build problems some users have reported and the corresponding workarounds. See also the FAQ's on building.

ENV parameter: One user had a problem where the build script below was failing because his work environment had the ENV variable set to a script that was resetting his PATH so that gcc could no longer be found. Make sure you do not have any ENV or BASH_ENV in your environment doing things like that. Typing "unset ENV", etc. before configuring and building should clear it.

Bash xpg: One user had his bash shell compiled with --enable-xpg-echo-default that causes some strange behavior with things like echo "\\1 ..." the configure script executes. In particular instead of getting "\1" the non-printable character "^A" is produced, and causes failures at compile time like:
  ../rfb/rfbconfig.h:9:22: warning: extra tokens at end of #ifndef directive
The workaround is to configure like this:
  env CONFIG_SHELL=/bin/sh /bin/sh ./configure
i.e. avoid using the bash with the misbehavior. A bug has been filed against autoconf to guard against this.

AIX: one user had to add the "X11.adt" package to AIX to get build header files like XShm.h, etc.

Ubuntu Feisty Fawn 7.04: In May/2007 one user said he needed to add these packages to compile x11vnc on that Linux distro and version:
  apt-get install build-essential make bin86 libjpeg62-dev libssl-dev libxtst-dev
Note that Ubuntu is based on Debian, so perhaps this is the list needed on Debian (testing?) as well. To build in Avahi (mDNS service advertising) support it would appear that libavahi-client-dev is needed as well.

Exceedingly slow compilation: x11vnc has a couple of files which contain very large "case statements" (over 100 cases) that on some platforms can take a very long time to compile (in extreme cases over an hour). However on 32bit Linux with intel/amd processor and gcc these files usually take less than 10 seconds to compile. For 64bit systems using gcc the problem appears to be much worse.

The two files with the large number of cases, remote.c and x11vnc.c, have no real need to be optimized (the code is used only very infrequently). So it is fine to supply "-O0" (disables optimization) to CFLAGS when compiling them. However, it is tricky with autoconf/automake to do this (especially since both the compiler and make versions have a big effect).

So if the compile times are getting too long for you for these two files you will need to manually change some things. First, run configure and when it has finished, edit the generated file x11vnc/Makefile and put these lines at the very top:

x11vnc-x11vnc.o :  CFLAGS += -O0
x11vnc-remote.o :  CFLAGS += -O0
Those lines assume gnu make (gmake) is being used. If you are using another make, say Solaris make, insert these instead:
x11vnc-x11vnc.o := CFLAGS += -O0
x11vnc-remote.o := CFLAGS += -O0
You could write a build shell script that modified the Makefile this way before running make.

The "-O0" (note it is "capital Oh" followed by "zero") assumes the gcc compiler. If you are using a different compiler you will need to find the command line option to disable optimization, or otherwise have the lines set CFLAGS to the empty string.

Broken Thread Local Storage on SuSE 9.2: Starting with x11vnc 0.9.8 the bundled libvncserver uses the __thread keyword to make some of the encodings (i.e. tight) thread safe (multiple VNC clients can be using tight at the same time in x11vnc -threads mode.) Evidently on the old SuSE 9.2 system the compiler does not support the thread local storage properly. Here is an example build failure:
tight.c:1126: error: unrecognizable insn:
(insn:HI 11 10 13 0 (nil) (set (reg/f:SI 59)
        (const:SI (plus:SI (symbol_ref:SI ("%lpalette"))
                (const_int 2048 [0x800])))) -1 (nil)
    (expr_list:REG_EQUAL (const:SI (plus:SI (symbol_ref:SI ("%lpalette"))
                (const_int 2048 [0x800])))
tight.c:1126: internal compiler error: in extract_insn, at recog.c:2175
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://www.suse.de/feedback for instructions.
The workaround is to disable thread local storage at configure time like this:
env CPPFLAGS="-DTLS=''" ./configure
and then build it.