1 TITLE: Compiling OpenOffice.Org from Scratch
5 AUTHOR: Tushar Teredesai <Tushar@LinuxFromScratch.Org>
8 How to compile 'OpenOffice.org from Scratch'.
12 Primary Location of this hint:
13 http://www.linuxfromscratch.org/~tushar/
14 The latest version of the hint and any relevant patches are available at that
15 site. Please refer to the primary location before submitting
16 bug-reports/enhancements to this hint.
18 You may freely copy this document or create derivate works or distribute the
19 document in any format. At your discretion, you may give credit to the original
22 Use the hint at your own risk. Neither the author, nor the Linux From Scratch
23 project accepts any reponsibility for anything that happens when using these
24 documents or associated files.
26 An appropriate place to discuss this hint is blfs-support MailingList/NewsGroup
27 at LinuxFromScratch.Org.
31 * Changed primary location and e-mail address.
33 * Upgraded to OpenOffice 1.0.1.
35 * Added optimization hint.
37 * Added alternate site for hint.
39 * First public version.
42 The build takes a lot in terms of CPU power, hard disk space and time:)
43 On my PIII-850MHz, it took around 12 hours and consumed 2 GB.
46 Pre-requisites (post LFS):
48 <http://freshmeat.net/projects/freetype/>
50 <http://freshmeat.net/projects/xfree86/>
52 <http://freshmeat.net/projects/sunjdk/>
54 <http://freshmeat.net/projects/zip/>
56 <http://freshmeat.net/projects/unzip/>
58 <http://freshmeat.net/projects/tcsh/>
60 <http://freshmeat.net/projects/linux-pam/>
62 * Installation of these packages in discussed in the BLFS book at
63 <http://beyond.linuxfromscratch.org>.
64 * The patches are for gcc-3.2 system and may work for future versions. If you
65 using a previous version, correct the configure.in patch before applying.
66 * Previous version of X will probably work though I have not tested them.
67 * JDK 1.3 may work, no guarantees.
68 * You don't need to install PAM You just need the PAM headers in
69 /usr/include/security. You can either download PAM and do a "./configure
70 --prefix=/tmp --includedir=/usr/include && make install" or download the
71 headers from the hint's primary site. Alternately if you don't want to install
72 the headers system wide, you can follow the instructions given below to
73 install them in the OpenOffice source tree. Please not that I have submitted
74 the patch to the OpenOffice bugzilla, but dunno if or when it will be
76 * If you have set the LS_COLORS variable, do a export LS_COLORS="" to prevent
77 tcsh from reading bash syntax for LS_COLORS.
81 <http://freshmeat.net/projects/berkeleydb/>
83 <http://freshmeat.net/projects/stlport/>
85 <http://freshmeat.net/projects/openoffice/>
86 * General Polygon Clipper
87 <http://freshmeat.net/projects/gpclib/>
90 Thanks are due to Debian and Redhat developers for providing hints and patches.
93 The OOo source comes with some of the packages I have mentioned above, but the
94 versions are slightly old and may have problems with gcc-3.2. Hence I decided to
95 use system installed versions wherever possible.
98 Compiling Berkeley DB:
100 Install Berkeley DB using the following commands. Note that these commands
101 differ slightly from that in the BLFS book (we also compile the C++ and Java
105 ../dist/configure --prefix=/usr --enable-compat185 --enable-cxx --enable-java
107 make docdir=/usr/share/doc/db install
111 The patches for STLport are available at the primary site for this hint.
113 export PATH=$PWD/stlport:$PATH
115 sed -e "s:\-O2:$CFLAGS:" gcc-linux.mak > Makefile
117 make INSTALLDIR=/usr install
118 export PATH=$PATH_HOLD
124 Untar both OOo and gpc and copy the gpc.c and gpc.h files from the gpc package
125 to <$OOSRC/external/gpc>.
127 Apply the patches that you have downloaded.
129 If you need to set optimization flags, set the CFLAGS variable and do the
130 following to incorporate those into the configuration files. My setting for
131 CFLAGS is "-O3 -march=i686 -fforce-addr -fomit-frame-pointer -funroll-loops
132 -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4". Using that
133 increased the compile time from 12 hours to 17 hours.
134 cd $OOSRC/solenv/inc &&
135 cp unxlngi3.mk unxlngi3.mk.orig &&
136 sed -e "s:^CFLAGSOPT=.*:CFLAGSOPT=${CFLAGS}:g" \
137 unxlngi3.mk.orig > unxlngi3.mk &&
138 cp unxlngi4.mk unxlngi4.mk.orig &&
139 sed -e "s:^CFLAGSOPT=.*:CFLAGSOPT=${CFLAGS}:g" \
140 unxlngi4.mk.orig > unxlngi4.mk
142 The mozilla libraries that are included with openoffice are pretty old and link
143 against gcc-3.0.x. Instead what we will do is to recreate the mozilla files that
144 are needed by OpenOffice. Set MOZ_PREFIX to the prefix where you have installed
145 Mozilla. Also note that you will need slightly modified Mozilla installation
146 instructions. Check the Mozilla hint for the update. Don't worry if some of the
147 libraries seem to be missing. I had problems using these instructions with
148 Mozilla 1.2a, but 1.0.1 was ok.
150 rm -f moz/zipped/LINUXGCCI*.zip
151 cd ${MOZ_PREFIX}/include/mozilla
152 zip -r ${OOSRC}/moz/zipped/LINUXGCCIinc.zip *
153 cd ${MOZ_PREFIX}/lib/mozilla
154 zip -j ${OOSRC}/moz/zipped/LINUXGCCIlib.zip openoffice/lib*.a \
155 libnspr4.so libxpcom.so
157 mkdir -p mozilla/components mozilla/defaults/pref
159 for i in absyncsvc addrbook mork mozldap necko pref profile rdf strres \
160 uconv ucvcn ucvibm ucvja ucvko ucvlatin ucvtw ucvtw2 \
161 unicharutil uriloader vcard xpconnect
163 cp -a ${MOZ_PREFIX}/lib/mozilla/components/lib${i}.so components
165 for i in necko_dns xpcom_xpti xpcom_threads xpcom_io xpcom_ds \
166 xpcom_components xpcom_base
168 cp -a ${MOZ_PREFIX}/lib/mozilla/components/${i}.xpt components/
170 for i in xpti xptitemp
172 cp -a ${MOZ_PREFIX}/lib/mozilla/components/${i}.dat components/
174 cp -a ${MOZ_PREFIX}/lib/mozilla/defaults/pref/*.js defaults/pref/
175 for i in mozjs msgbaseutil ldap50 nspr4 plc4 plds4 xpcom prldap50
177 cp -a ${MOZ_PREFIX}/lib/mozilla/lib${i}.so .
179 zip -r ${OOSRC}/moz/zipped/LINUXGCCIruntime.zip *
183 If you don't want to install Linux PAM system wide (even the headers as
184 mentioned above), download the Linux-PAM header tar ball from the hint's primary
185 location and move the headers to $OOSRC/external/pam. Also apply the patch to
188 Configure OOo with the options. This will generate LinuxIntelEnv.Set in $OOSRC
189 directory. We need to run autoconf since in the above patches we patch
190 configure.in but not configure.
191 cd $OOSRC/config_office/ &&
193 ./configure --enable-gcc3 --with-jdk-home=${JAVA_HOME} \
194 --with-lang=ENUS --with-x --with-stlport4-home=/usr
195 I configured for US English, you can enable more languages or all languages by
196 using --with-lang=ALL.
198 Verify that the $OOSRC/LinuxIntelEnv.Set file is correct.
200 If when compiling gcc, you included java in the list of languages, then you will
201 have a file /usr/include/jni.h which will give you problems since it appears
202 first in the include path. So move the file to a different location and remember
203 to restore it back after compiling OOo. (To avoid this problem, I compile gcc
204 with --includedir=/usr/include/gcc)
206 Now some workarounds to 'fix' the build process. If you do a "make clean"
207 remember to repeat the following steps again. Note that libgcc_s.so* files in
208 your installation could be in /lib.
210 mkdir -p solver/641/unxlngi4.pro/inc/
211 touch solver/641/unxlngi4.pro/inc/minormkchanged.flg
212 mkdir -p solver/641/unxlngi4.pro/lib/
213 cp -f /usr/lib/libstdc++.so.5* /usr/lib/libgcc_s.so* \
214 solver/641/unxlngi4.pro/lib/
215 chmod +x solenv/bin/zipdep.pl
217 Now run the bootstrapping program which will build the pre-requisites such as
218 dmake that are required for building OOo.
219 tcsh -c "source LinuxIntelEnv.Set; ./bootstrap"
220 This will run for sometime and build the required tools.
222 Now to compiling the package. Remember looks are deceiving:) Though a one liner,
223 the following command does everything except for the kitchen sink:) It will
224 build all the sub-projects of OOo and then copy them to the appropriate
225 locations and then make suitable installation sets.
226 tcsh -c "source LinuxIntelEnv.Set; dmake"
228 Once the package is built, now on to installation.
229 cd $OOSRC/instsetoo/unxlngi4.pro/01/normal
230 In case you are wondering, 01 represents the telephone code for US (the language
231 I built). So if you want a German installation, replace 01 by 49.
233 If you would like to keep a backup for future installations, the files in this
234 directory are all you need to keep.
236 Edit the install script. I prefer making the following changes
237 cp install install.orig
238 sed -e "s:oo_home=OpenOffice.org1.0:oo_home=openoffice:" install.orig > install
241 Now install OOo. Note that though the script does not open any windows it needs
242 permission to open the display. So set the DISPLAY variable accordingly.
243 ./install --prefix=/opt
245 I prefer creating symbolic links to the programs from a standard location
246 (/usr/X11R6/bin) rather than including the directory where the OOo programs
248 If you prefer to do that, do the following:
249 for appl in swriter scalc sdraw simpress smath soffice
251 ln -sf /opt/openoffice/program/$appl /usr/X11R6/bin/$appl
254 If you had moved /usr/include/jni.h, remember to restore it to its proper
255 location, else the Gods will be angry and curse the OOo installation:)
257 The first time you start the application as any user, the setup program will
258 start. Select the "Workstation Install" option to configure OpenOffice. This
259 will create the user directories that OOo can use.
261 Don't forget to send me bug reports and enhancements so that I can keep the hint