Development Environment with solver

From Apache OpenOffice Wiki
Jump to: navigation, search


This document describes how to set up an development environment with solver in a few hours.

Target readers

Software engineers who want or need to fix a bug or to enhance

Two ways to set up an environment

There are at least two ways to set up a development environment: entire build and use of solver.

Method Steps Merits Drawbacks
Entire build

1. Download source tar-balls of
2. Extract them.
3. Build entirely from scratch.

No need to take care of distribution.

Need to wait until build process is finished. It might be for more than one day.

Impossible to provide your customers with patch files. You will have to deliver an installer of and your customers will need to uninstall an official built by the community and then install your own You might be responsible for the whole

Use of solver

1. Download both source tar-balls and solver of
2. Extract them.

No need to wait.

Possible to provide your customers with patch files. All your customers need is to replace some files already installed in their PC with the patch files. You would not be responsible for the whole but only part of

Need to carefully choose a distribution that meets an environment used for the community builds.

This document will explain the latter one, use of solver.


Solver is a name of folder that holds all the necessary files created during a process of building

The community normally delivers an installer of along with the corresponding solver.

Further information on solver can be found at


  • In this document it is assumed that you are using bash.
  • To make it easy to copy some example command lines in this document and paste them into your terminal emulator, a shell prompt is intensionally omitted. Please differentiate which line is a command that you will type and which line is an output that is produced by the command.
  • When invoking a UNIX command, you should be an appropriate user, a super user or normal user.

For example, the following example cited in this document

make install


(normal user)$ script
(normal user)$ ./configure
(normal user)$ make
(normal user)$ exit
(normal user)$ /bin/su
(super  user)# script -a
(super  user)# make install
(super  user)# exit
(super  user)# exit

Development Environment on Linux


Firstly, it would be meaningful to know the System Requirements for 2 released by the community. It says that

Linux kernel version 2.2.13 or higher, glibc2 version 2.2.0 or higher

The Linux kernel-2.2.13 became available late in 1999. Looking for similar distributions, you would find some:

Nowadays it is relatively difficult to get such a somewhat antique distribution. So we will need to find an alternative.

Choosing a Linux distribution

Secondarily, choose a Linux distribution. There are many distributions currently available. Since the 'solver' seems to be created on the environment firstly prepared in the year of around 2000, some of the distributions can work with it, but others can not.

Fedora Core Distributions

Fedora Core and Fedora distributions are freely available and widely used in the world.

Versions of the packages bundled in the Fedora Core and Fedora distributions

Package FC1 FC2 FC3 FC4 FC5 FC6 Fedora 7 Fedora 8
kernel 2.6.5 2.6.9 2.6.11 2.6.15 2.6.18 2.6.21 2.6.23
glibc 2.3.3 2.3.3 2.3.5 2.4 2.5 2.6 2.7
gcc 3.3.3 3.4.2 4.0.0 4.1.0 4.1.1 4.1.2 4.1.2
binutils 2.15.90 2.15.92 2.15.94 2.16.91 2.17.50 2.17.50 2.17.50
ant 1.5.2 n/a 1.6.2 1.6.5 1.6.5 n/a 1.7.0
scim n/a n/a n/a 1.4.4 1.4.4 1.4.5 1.4.7

n/a: Not Available



Fedora Core 4 plus gcc-3.4.1 seems to be the better choice among the Fedora distributions.

Setting up development environment

Setting up a Fedora Core 4 box

  1. Visit
  2. Follow links to find a list of mirror servers.
  3. Download core/4/i386/iso/FC4-i386-DVD.iso
  4. Install it.
  5. Additionally install necessary packages, if needed.

To use yum, you will need to create a directory 'repodata' since FC4-i386-DVD.iso does not have it while an iso image of Fedora 8 does.

mount -o /dev/cdrom /mnt
mkdir /var/tmp/RPMS
cd /var/tmp/RPMS
ln -s /mnt/Fedora/RPMS/* .
createrepo .

To use the repodata, specify a path of the directory in which repodata is.

cd /etc/yum.repos.d
mkdir disabled
mv *.repo disabled
cat > dvd.repo 
name=Fedora 4 Install DVD
yum list
yum install name_of_package
mv disabled/* . 
mv dvd.repo disabled
umount /mnt

Installing gcc-3.4.1

  1. Visit
  2. Follow links to find a list of mirror servers.
  3. Download releases/gcc-3.4.1/gcc-3.4.1.tar.gz
  4. Apply two patches following an article [porting-dev] OOo Linux builds: Hamburg RE switches over to gcc-3.4.1 by Jens-Heiner Rechtien.
    1. enum patch - by Jakub Jelinek
    2. visibility patch - by Niall Douglas
  5. Install it following instructions at gcc-3.4.1/INSTALL/index.html
bunzip2 -dc gcc-3.4.1.tar.bz2 | tar zxf -
cd gcc-3.4.1
patch -p0 < ../Fix_C++_enums_handling_in_build_range_check.patch
patch -p1 < ../GCC3.4.0VisibilityPatch2.diff
mkdir -p build/object
cd build/object
../../configure '--enable-languages=c,c++'
make bootstrap
make install

Here is an example file Fix_C++_enums_handling_in_build_range_check.patch
This example is cited from
and then a portion "--- gcc/fold-const.c.jj" in the first line is intentionally replaced with "--- gcc.original/fold-const"

--- gcc.original/fold-const	2004-07-09 13:50:54.000000000 +0200
+++ gcc/fold-const.c	2004-07-09 18:10:52.945905468 +0200
@@ -3844,7 +3844,13 @@ build_range_check (tree type, tree exp, 
       HOST_WIDE_INT hi;
       int prec;
-      prec = TYPE_PRECISION (etype);
+      /* For enums the comparison will be done in the underlying type,
+	 so using enum's precision is wrong here.
+	 Consider e.g. enum { A, B, C, D, E }, low == B and high == D.  */
+      if (TREE_CODE (etype) == ENUMERAL_TYPE)
+	prec = GET_MODE_BITSIZE (TYPE_MODE (etype));
+      else
+	prec = TYPE_PRECISION (etype);
       if (prec <= HOST_BITS_PER_WIDE_INT)
 	  hi = 0;

Installing JDK

  1. Visit
  2. Follow a link 'Java SE' to find a JDK 6.
  3. Download and install it.
/bin/sh jdk-6u3-linux-i586-rpm.bin

Tweaking pre-installed ant

Since the pre-installed ant bundled in Fedora Core 4 does not work with JDK released by Sun, clear an environment variable JAVA_HOME which will be assigned by .

  1. Backup /etc/ant.conf
  2. Edit /etc/ant.conf to append a line 'JAVA_HOME=' at the end of file.
cp -p /etc/ant.conf{,-original}
vi /etc/ant.conf
diff /etc/ant.conf{-original,}

Downloading files

Getting files of

You will need an installer, source tar-balls, and solver of

  1. Visit .
    1. For OOo 2.3.0,
    2. Mirrors:
  2. For 2.3.0, download the following files:
    1. stable/2.3.0/OOo_2.3.0_LinuxIntel_install_wJRE_en-US.tar.gz or localized/your_preferable_language/2.3.0/OOo_2.3.0_LinuxIntel_install_wJRE_xxxxx.tar.gz
    2. stable/2.3.0/OOo_2.3.0_src_binfilter.tar.bz2
    3. stable/2.3.0/OOo_2.3.0_src_core.tar.bz2
    4. stable/2.3.0/OOo_2.3.0_src_l10n.tar.bz2
    5. stable/2.3.0/OOo_2.3.0_src_sdk.tar.bz2
    6. stable/2.3.0/OOo_2.3.0_src_system.tar.bz2
    7. extended/2.3.0rc3/OOo_2.3.0_LinuxIntel_solver.tar.gz
  3. Install following instructions
  4. Expand the source tar-balls.
  5. Expand the solver tar-balls.
fox x in /where_downloaded/stable/2.3.0/OOo_2.3.0_src_*.tar.bz2; do bunzip2 -dc $x | tar -xf -; done
tar -zxf /where_downloaded/extended/2.3.0rc3/OOo_2.3.0_LinuxIntel_solver.tar.gz
cd OOG680_m5
ln -s ../solver .

Getting extra files

You will need some extra files.


cp -p solver/680/ external/unowinreg


cd moz/download
wget -nd -r
cd ../..


Running configure

  1. Run the shell script configure .
cd config_office
sh -xv

Here is a sample shell script for the configure .

#!/bin/bash --norc
export LANG=C
export PATH=/bin:/usr/bin:/usr/X11R6/bin
export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++
./configure \

Making dmake

  1. Make dmake using a shell script bootstrap created by the configure .
cd ..

Building a module


You will need to set up certain environment variables.

  1. Run the shell script

Building a module

  1. Run an alias command build to build a module
cd sw

Options of build

To add an option -g to gcc, give an option debug=1 to the alias command build.

build debug=1

To add a CFLAGS,

build debug=1 envcflagscxx=-DHDU_DEBUG

To add more than one options,

build debug=1 'envcflagscxx="-DHDU_DEBUG -DTORA_DEBUG"'

Known error messages

If you encounter the following error messages that prevent building process, try some solutions described here.

version `CXXABI_1.3.1' not found

Checking DLL ../ ...: ERROR: /xxx/2.3.0/OOG680_m5/solver/680/ version `CXXABI_1.3.1' not found (required by ../
  • Solution: Use gcc-3.4.x instead of gcc-4.x.x

referenced in section `.rodata' of ... defined in discarded section `.gnu.linkonce.t. ...

`.L125' referenced in section `.rodata' of ../ defined in discarded section `.gnu.linkonce.t._ZN3com3sun4star3unorSERKNS2_3AnyERd' of ../

undefined reference to `__ctype_b'

/xxx/2.3.0/OOG680_m5/solver/680/ In function `MakeTCPConnection':
ConnSvr.c: undefined reference to `__ctype_b'
/xxx/2.3.0/OOG680_m5/solver/680/ In function `_AuConnectServer':
ConnSvr.c: undefined reference to `__ctype_b'
/xxx/2.3.0/OOG680_m5/solver/680/ undefined reference to `__ctype_tolower'
/xxx/2.3.0/OOG680_m5/solver/680/ undefined reference to `__ctype_b'
collect2: ld returned 1 exit status
  • Solution: Run "build" with LINKFLAGSDEFS= that is normally specified as "LINKFLAGSDEFS*=-Wl,-z,defs" in solenv/inc/
  • References: an option "-z defs" of ld

Debugging your source code

Now that you have your own shared files (.so) in your development environment.

To debug your code, you will need to replace shared files in the installation set of with your shared files that have been just made from your source code.

Replacing shared files in the installation set

  1. Backup original shared files.
  2. Create symbolic link files addressing to your own shared files.
cd /opt/openoffice.org2.3/program
mkdir original-sw
mv libsw*.so original-sw
ln -s /your_development_environment/sw/*.so .

Debugging with gdb or ddd

  1. Start your with a sample document file to test your source code.
  2. Use a function in in order to load relevant shared library files that you want to debug. E.g. if you want to debug one dialog window in Writer, you would need to start Writer to load shared library files of Writer and then choose a certain entry in the menu or click on a certain button on the tool bar to load UI related shared file of Writer. Otherwise, your dbg would not load any symbol in the target shared library files at its startup. For more details, see help about the the following commands of gdb: info sharedlibrary, add-symbol-file.
  3. Find a process id of soffice.bin with pgrep .
  4. Start gdb or ddd givinning the process id to attach to the process of
/opt/openoffice.org2.3/program/soffice sample.odt &
pgrep soffice.bin
gdb /opt/openoffice.org2.3/program/soffice.bin nnnnn

or, more simply,

/opt/openoffice.org2.3/program/soffice sample.odt &
gdb /opt/openoffice.org2.3/program/soffice.bin `pgrep soffice.bin`

Tips of gdb and ddd

Since is written in two languages, c and c++, the debugger sometime mistakenly chose a type of language. If you encounter an error message like this,

break xxx::yyy
Can't find member of namespace, class, struct, or union named "xxx::yyy"

try to explicitly specify a type of language.

set language c++
Personal tools