Index
Previous
Next

Applications Software

How do I compile Xvfb for Solaris using gcc?


Xvfb, (vfb stands for Virtual Frame Buffer) is an X server which can be
used to give an application a DISPLAY when one isn't available.
It's useful for rendering off-screen images in memory.
Read this article for more background.

Xvfb doesn't come with Solaris out-of-the-box and (to date) isn't available
on Sunfreeware as a package.
It's hard to compile, you need to build the entire X11 distribution.
This is hard, especially if you want to get it right so the generated Xvfb is
set-up for the rest of Sun's X11 distribution (located in /usr/openwin)
and don't have the Sun C compiler so you need to rely on gcc.

One major downside - it only seems to correctly support 8bpp, if you
specify a greater colour depth the red and blue seem to be swapped :-(
If you know how to fix this please email me.

Here's how to do it:

1) Download the X11R6.6 distribution from X.org
Fetch all the files in that directory and unpack them.
You'll get a directory structure starting "xc".

2) Patch the distribution as follows:
-----------------------------------------------------
2.1) Get the imake boot compilation to use gcc:
-----------------------------------------------------
*** xc.orig/config/imake/Makefile.ini   Thu Aug 17 20:41:50 2000
--- xc/config/imake/Makefile.ini        Mon Sep  9 10:14:50 2002
***************
*** 9,15 ****
  #
  
  BOOTSTRAPCFLAGS = 
! CC = cc
  CDEBUGFLAGS = -O
  INCLUDES = -I../../include -I../../imports/x11/include/X11
  CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) $(INCLUDES)
--- 9,15 ----
  #
  
  BOOTSTRAPCFLAGS = 
! CC = gcc
  CDEBUGFLAGS = -O
  INCLUDES = -I../../include -I../../imports/x11/include/X11
  CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) $(INCLUDES)

-----------------------------------------------------
2.2) Copy config/cf/site.sample to config/cf/site.def.
Tell it you want to use gcc, build Xvfb, and how it 
should compile-in certain paths to its X11 directories.
Apply the following changes:
-----------------------------------------------------
*** xc.orig/config/cf/site.sample       Thu Aug 17 20:41:48 2000
--- xc/config/cf/site.def       Fri Sep  6 16:53:38 2002
***************
*** 50,67 ****
  #  endif
  # endif
  
- /*
  #ifndef HasGcc2
  #define HasGcc2 YES
  #endif
- */
  
  #endif /* BeforeVendorCF */
  
  #ifdef AfterVendorCF
  
! #define ProjectRoot /usr/X11R6.4
  
  /* Only set HasXdmAuth to YES if you have a Wraphelp.c file. */
  /* #define HasXdmAuth YES */
  
--- 50,70 ----
  #  endif
  # endif
  
  #ifndef HasGcc2
  #define HasGcc2 YES
  #endif
  
  #endif /* BeforeVendorCF */
  
  #ifdef AfterVendorCF
  
! #define ProjectRoot /usr/openwin
! #define ServerConfigDir /usr/openwin/server/etc
! #define XVirtualFramebufferServer YES
 
  /* Only set HasXdmAuth to YES if you have a Wraphelp.c file. */
  /* #define HasXdmAuth YES */
  

-----------------------------------------------------
2.3) There are some errors in the distribution sun.cf 
file that need to be patched:
-----------------------------------------------------
*** xc.orig/config/cf/sun.cf    Tue Dec 12 12:49:13 2000
--- xc/config/cf/sun.cf Fri Sep  6 15:51:12 2002
***************
*** 134,147 ****
  #ifdef i386Architecture
  # if OSMajorVersion > 4
  #  define ServerExtraDefines  AllocateLocalDefines XFree86ServerDefines
! #  define ServerOSDefines     XFree86ServerOSDefines IncludeCG2HeaderDefine
  # else
  #  define ServerExtraDefines AllocateLocalDefines
! #  define ServerOSDefines     -DDDXOSINIT IncludeCG2HeaderDefine
  # endif
  #else
  # define ServerExtraDefines AllocateLocalDefines
! # define ServerOSDefines      -DDDXOSINIT IncludeCG2HeaderDefine
  # define HasPlugin            YES
  #endif
  
--- 134,147 ----
  #ifdef i386Architecture
  # if OSMajorVersion > 4
  #  define ServerExtraDefines  AllocateLocalDefines XFree86ServerDefines
! #  define ServerOSDefines     XFree86ServerOSDefines $(IncludeCG2HeaderDefine)
  # else
  #  define ServerExtraDefines AllocateLocalDefines
! #  define ServerOSDefines     -DDDXOSINIT $(IncludeCG2HeaderDefine)
  # endif
  #else
  # define ServerExtraDefines AllocateLocalDefines
! # define ServerOSDefines      -DDDXOSINIT $(IncludeCG2HeaderDefine)
  # define HasPlugin            YES
  #endif
  

-----------------------------------------------------
2.4) Xi18nLib.conf should not assume that a Sparc 
build will always use the Sun CC compiler:
(Openoffice developers please take note!)
-----------------------------------------------------
*** xc.orig/lib/X11/xlibi18n/Xi18nLib.conf      Tue Dec 12 12:44:05 2000
--- xc/lib/X11/xlibi18n/Xi18nLib.conf   Fri Sep  6 15:54:44 2002
***************
*** 27,35 ****
--- 27,37 ----
      EXTRA_SHLIBLDFLAGS = 
  #endif
  
+ #ifndef HasGcc2
  #ifdef SparcArchitecture
  CFLAGS += -xregs=no%appl
  #endif
+ #endif
  
  all::
        $(_NULLCMD_)


3) Now you can build.  This takes about an hour on an a Netra X1 
(Ultrasparc-IIe 500MHz, 1Gb RAM).
$ cd xc
$ make World >world.log 2>&1 &
$ tail -f world.log


4) The build should complete successfully ;-)
The binary you need is in programs/Xserver/Xvfb
The corresponding man page is in programs/Xserver/hw/vfb/Xvfb.man


Ed Randall, 9/9/2002
Usual disclaimers apply, YMMV but "it worked for me" :-)


Index
Previous : How do I connect to Homechoice 512k using FreeBSD?
Next : How do I set configure SuSE 8.0 to work with Homechoice?

Ed Randall, Mon Sep 9 11:11:15 2002