Installing and Building OpenOffice OO638C for MacOS X 10.1

Edward Peterlin

1/12/02 - 1/14/02


Installing and building OpenOffice on OS X can be a quite interesting experience. The build documents on the OOo website are currently out of date and can't be followed word for word. Additionally, the introduction of new linker features in OS 10.1 makes the sources which you download unbuildable. I'm updating my distribution today to the proper revision, and decided to write up some build instructions to go along with it.

Note: I find it's probably best to set aside a whole day for this process. It takes a while, and does require some patience. I usually find it mingles quite pleasently with football games, hockey games, gardening, cleaning, or just about any other mostly mindless thing that you can do while waiting for builds to finish.

Oh. Also reserve a couple of gigs of hard drive space.

Preparing to Build

In order to prepare to build, you should have the 'standard' development environment set up to work on OOo. Because of special issues involving the instability of the OOo codebase and the devlopment environment Apple provides, some of the porters have come to a somewhat defacto bunch of goals for the environment the port will work on:

You should install both 10.1.2 and the 10.1 development tools before beginning a new distribution. After the Apple tools are installed, proceed to download the OpenOffice source from the cvs repository. First, create a local directory which will be your source root. I used /openoffice in these documents, but you could use otherwise for different drives or the like.

To download the CVS distribution:

  1. Open a new Terminal (/Applications/Utilities/Terminal)
  2. mkdir /openoffice
  3. cd /openoffice
  4. setenv CVSROOT
  5. cvs login
  6. Enter the password anoncvs
  7. cvs co -rOO638C OpenOffice
  8. go get some coffee, or a beer, since it'll take a while to get it all

After you get the CVS distribution you will need to obtain some external sources not included in the OO638C CVS branch. The first set is the STLPort code. This is a compiler-agnostic STL implementation used with the OOo sources. To obtain the source:

  1. cd /openoffice
  2. mkdir stlport-4.0
  3. Launch Internet Explorer (or equivalent non M$FT browser)
  4. Download the contents of
  5. Move the extracted contents of the STLport-4.0 directory into /openoffice/stlport-4.0
  6. Back in the shell, cd /openoffice/stlport-4.0; ls and make sure ChangeLog and TODO appear in the listing. If you see STLport-4.0 as a directory, then simply mv STLport-4.0/* . to move the contents one directory lower.
  7. /openoffice/solenv/unxmacxp/bin/patch-STLport-4.0
  8. Enter /openoffice/stlport-4.0 as the directory when prompted
  9. cd /openoffice/stlport-4.0/src
  10. /usr/bin/make -f gcc-apple-macosx.mak
  11. go get some more coffee, or another beer, since it'll take a while to build

The next set of sources you will need is an opensource polygon clipper library gpc which isn't included with the distribution. The steps below download the appropriate library and extract its contents into /openoffice/external/gpc. The instructions below assume that you have configured Internet Explorer or your other default browser to download directly to your desktop.

  1. Go back to Internet Explorer (or your other favorite browser) and download
  2. Switch back to your terminal
  3. uncompress ~/Desktop/gpc231.tar.Z
  4. cd /openoffice/external/gpc
  5. tar xvf ~/Desktop/gpc231.tar
  6. mv gpc231/* .
  7. rmdir gpc231

Congratulations! You've just finished downloading all of the sources necessary to undertake your first adventurous build of OpenOffice!

The First Build

Before you do the first build you will need to set up your environment. Again, the instructions below assume that you have installed OOo's source into "/openoffice", but you can replace it with whatever you want.

The first step is to run the configure script to properly set up the environment variables for the build environment and create headers describing the features of the compilers. If you used a different STLport installation directory than /openoffice/stlport-4.0 be sure to substitute it into the following directions. Due to some inconsistencies on how the Java headers are located on MacOS X, the configure script will prompt for errors relating to the Java home directory which are inapplicable.

  1. cd /openoffice/config_office
  2. ./configure --with-stlport4-home=/openoffice/stlport-4.0
  3. Hit Enter/Return at the "Please enter Java home directory" prompt.
  4. Enter "n" and hit return at he "Direcotry does nto exist. Do you want to create it?" prompt.

After running the configure script, you will then need to apply your first patch to the source code. The compiler changes introduced in the December build tools apparently broke some of the previous fixes. These headers, unfortunately, are needed to build the tools which are used in the build process used by OOo. To download and apply the patch:

  1. Download the patch sal.011302.diff from either this site or OpenOffice Issue 2823. If you download it from this site, you will need to gunzip the file. For an explaination of this patch, see this page.
  2. cd /openoffice/sal
  3. patch -p0 < /your/downloaded/sal.011302.diff

With the patch applied, now we need to create the build utilities that are necessary for building the other components of OpenOffice. To perform this, execute the following:

  1. cd /openoffice
  2. source MacosxEnv.Set
  3. ./bootstrap
  4. If you're a heavy drinker, grab another beer. Building the build utilities can take a while if you have a slow machine.

The bootstrap utilities should build if you've successfully applied the patch. You may have noticed during the bootstrap build that there are "zipdep: command not found" messages. This is because the bootstrap process actually builds zipdep. To find it, if you're continuing the build process in the same terminal or if you've opened a new terminal:

  1. cd /openoffice
  2. source MacosxEnv.Set

This will cause the shell to rescan the executables available in the search path and will allow zipdep to be found for future builds.

Now we're ready to continue with the build. This roughly follows the instructions from the current docs online at openofficeorg, but with some ordering and patch instructions interspersed.

  1. cd /openoffice
  2. dmake debug=true
  3. The previous step will fail in the berkeleydb module. This module has been fixed and can be built after applying a patch. If you got a 'dmake: command not found' error, be sure to source MacosxEnv.Set before starting the build.

Since we're building the debug version, we need to apply some more patches to continue building modules. The next module specified in the build, the i18n module, references the rsc module which has a prototype error. This build failure only occurs when doing the debug build. So we need to patch it:

  1. Download the rsc patch from this site or from Issue 2824. Note that if you download it from this site you will need to gunzip the file.
  2. cd /openoffice/rsc
  3. patch -p0 < /path/to/downloaded/rsc.011302.diff

Now we can continue with the build

  1. cd /openoffice/i18n
  2. build -all debug=true
  3. Wait a few hours.
  4. cd /openoffice/stoc
  5. build -all debug=true
  6. Wait a while (perhaps an hour?)
  7. cd /openoffice/cpputools
  8. build -all debug=true

Note that unlike the build instructions posted on OOo's site, you actually do need to build cpputools before dtrans. This is because dtrans needs to register a component for doing aqua data transfer via the clipboard (?) with the regcomp utility, but that utility is built with cpputools.

Before we do the next build step, we need to apply another patch. This patch addresses an error in the makefiles in the dtrans module which caused them to fail to register properly.

  1. Download the dtrans patch from Issue 2672. This patch was by Daniel Boss (originated by Radovan Biciste).
  2. cd /openoffice/dtrans
  3. patch -p0 < /path/to/downloaded/dtrans_OO638C.patch

Now we can continue building :)

  1. cd /openoffice/dtrans
  2. build -all debug=true

After that finishes, take a breather. You've finished building the basic abstraction and infrastructure layers of OO! If you've made it this far, you've already either got some dedication, or at least a masochistic streak. Why not consider joining the porting project on the OOo website and filling out the copyright assignment form so you can start contributing patches of your own? :)

So Now Then

What you've built is the basic abstraction and infrastructure layers of the application. Things are still a long way off before it's possible to even begin thinking about building a full OO binary for distribution. Read through the work remaining to be done documents and compiler issues on the OOo Mac porting site for more information.

I found by reading some of the white papers I got a better understanding for the terminology as well as the structure of the program. This was extremely helpful in decoding the build system and making more sense out of other documents on OO.

The next step in the build instructions on OOo mentions building the sample applications. Go for it! You'll find that several of them are broken, so it's a good indication of what still needs to be done.

For more fun, apply all of the latest patches available through OOo issuezilla. There are two patches I've done for vcl and berkeleydb which haven't been applied in these instructions. Other patches from Daniel Boss are available from OOo's IssueZilla and patch the following modules: svx, setup2, odk, scaddins, product, and sj2. There are still more that don't build, and right now that's what I'm kind of addressing along with fixing up bugs in the vcl module (which will require additional work beyond bug fixing as well).

Feel free to read up and join in!