Building OpenOffice from source (debian way)
Hi, I use Debian Sid (unstable) distribution.
I'm trying to build binary deb package of OpenOffice from source (openoffice.org_2.2.1-9) for my Core 2 Duo (T5500) processor. I know that the CFLAGS for make should look like: CFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer" http://gentoo-wiki.com/Safe_Cflags#Intel_Core_2_Solo.2... but I'm not sure where exactly I should put it. I mean how can I reedit debian/rules file. I started with adding CFLAGS at the end of that fragment of that file: CONFIGURE_FLAGS= --disable-post-install-scripts \ --with-tag=$(TAG) \ --with-distro=$(PATCHSET) \ --with-vendor='$(OOO_VENDOR)' \ --enable-package-directories \ --with-installed-ooo-dirname=openoffice$(VER) \ --mandir=/usr/share/man \ --with-docdir=/usr/share/doc/openoffice.org \ --with-lang="$(ISOS)" \ --with-build-version="openoffice.org$(VER)-core $(BINARY_VERSION), `LANG=C date`" \ --disable-strip \ --enable-atkbridge \ --enable-lockdown \ CFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer" but I'm not sure if it's good solution. I've noticed that gcc compile my sources with -03 and -02 flag at the same time. Perhaps I should make something with that options: OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) DIST := $(shell lsb_release -is) DISTREL := $(shell lsb_release -cs) or use prepare special DEB_BUILD_OPTIONS variable? I know that it's better to install binary packages but I want to speed up my linux. Anyone can halp me? |
I get the overwhelming urge to tell you not to follow Gentoo docs. Gentoo does have a very good documentation selection, yes, however when looking at distro-specific documentation (as 95% of Gentoo documentation tends to be specific to Gentoo) don't be so sure that you can transfer it over to a different distribution and have it carry over.
If you read the Gentoo documentation you got that environment variable from, you would notice that it's meant to reside in a file called "/etc/make.conf". On Debian, that file doesn't exist. What you can probably do is alias the gcc (or cc) command in your ~/.bashrc file to include those compiler flags. Code:
export CFLAGS='-march=prescott -O3 -pipe -fomit-frame-pointer' Remember, you only need to be root to "make install". |
Quote:
Anyway I'll try to compile openoffice with that alias but I'm not sure what would happen if a debian/rules script override some of this flags. e.g. var ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) get the i386 value. I guess it's connected with -march flag. Am I wrong? Sometimes I see a flag -O2 in other packages (in debian/rules). What would happen if there are both -03 (from alias) and -O2 (from a script) flags? Thanks for a solution. Openoffise's going to compile for more than 10h :) #### UPDATE: I've been compiling in that package like you told me and I've noticed that gcc gives me the following log for almost every file belongs to openoffice package. That's a small screenshot from my compiling. -mtune is setted for pentiumpro. That's not the architecture I wanted to use man gcc describe that there are lots of arch between mentioned ones: i386, i486, i586 (pentium), pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, pentium4, pentium4m, prescott /Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support/ #### UPDATE 2 I've found another solution. There is a ARCH_FLAGS var but I don't know where should I use it. openoffice.org (1.1.1-3) unstable; urgency=medium (...) * New patches: (...) - build-arch-flags: support ARCH_FLAGS to change compiler flags from envrionment [MM] Should I put add that var into the debian/rules file? I've found two patches that can propobly help inside the source (openoffice.org-2.2.1/ooo-build/patches/src680: testing-more-optimizations-ark.diff and mandriva-archflags.diff) and they reference to the following files: solenv/inc/unxlngi4.mk.mdvarch solenv/inc/unxlngi4.mk solenv/inc/unxlngi5.mk.mdvarch solenv/inc/unxlngi5.mk solenv/inc/unxlngi6.mk.mdvarch solenv/inc/unxlngi6.mk I can't see that files. So how can I use the patches? I know that they change these vars: -ARCH_FLAGS*=-mcpu=pentiumpro +ARCH_FLAGS*=-mtune=pentiumpro +ARCH_FLAGS_CC*=$(ARCH_FLAGS) +ARCH_FLAGS_CXX*=$(ARCH_FLAGS) +ARCH_FLAGS_OPT*=-O1 Anyone can help me solve that problem? ##### UPDATE 3 That files are in ooo-build/src/OOo_2.2.1_src_core.tar.bz2.dfsg archive. ./OOF680_m18/solenv/inc/unxlngi6.mk ./OOF680_m18/solenv/inc/unxlngi4.mk ./OOF680_m18/solenv/inc/unxlngi5.mk I'll try to edit them and start compilation. ##### UPDATE 4 I think that the most important thing is to edit: ./ooo-build/patches/src680/debian-opt.diff |
I've found the answer but I can't finish compiling OpenOffice.
Code:
cat /etc/apt/sources.list | grep debian.org Code:
--- solenv/inc/unxlngi6.mk~ 2006-09-21 14:19:05.398388000 +0200 Code:
dpkg-buildpackage -rfakeroot -uc -b | tee ../logs After 3 hours I've got the following errors: Code:
----------------------------- |
I noticed you chose -O3 over -Os, a better choice maybe to do -O2 as -O3 I believe may increase the file size and do a lot of code expansion to the point where it actually slows it down; I could be wrong though. The undefined references means the linker can't find the reference for that function and as far as I can tell its a function included in the source. I'd try cleaning the source and do it again, if not check your build options.
edit: also this probably isn't it, but try compiling it without your optimization changes if all else fails. |
Quote:
1/ with -O2 optimalization option 2/ if the /1/ fails i'll change march to mtune 3/ and then without my optimalization I forgot to tell that I checked that behavior for BUILD_AMD64=n and BUILD_AMD64=y option in debian/rules. I added there the fallowing var as well: DEB_BUILD_OPTIONS := lang=pl |
Here are a few links on gcc's optimizations:
http://gentoo-wiki.com/Safe_Cflags#P..._.2F_Celeron_D http://www.network-theory.co.uk/docs...cintro_49.html http://www.gentoo.org/doc/en/gcc-optimization.xml (tells you to use -O2 over -O3 if using version 4 of gcc) http://tools.openoffice.org/performance/ http://www.lockergnome.com/nexus/lin...t-start-faster (this one probably will make more of a difference) edit: http://www.lockergnome.com/nexus/win...up-openoffice/ (one more tweak) I just found most of these and on a windows machine the tweaks did make a huge difference, I'm not sure what limitations there are to disabling jre keeping -Os and doing just the tweaks would probably yield the most because most of the time the slowest part of OO.org is loading it from the hard drive, and if the binary is bigger so is the loading time. |
Quote:
Quote:
edit: I passed that problem with -O2 optimalization option. I'll report the result of the compilation here. edit2: At the end of compilation I've got the following log Code:
Cleaning up ... DEB_BUILD_OPTIONS := lang=pl but what's wrong with that. There is a solution in the openoffice documentation debian/README: Quote:
edit3: I'll try compile with var: DEB_BUILD_OPTIONS := lang=en-US,pl because the script looks like Code:
(...) |
It looks like the:
Code:
DEB_BUILD_OPTIONS := lang=en-US pl It's still compiling... :) |
At last :) It works great OO start 2 sec. now :)
and the size all debs I need is about 110 MB. Code:
-rw-r--r-- 1 gontek gontek 137930 2007-09-28 00:13 openoffice.org_2.2.1-9_i386.deb |
All times are GMT -5. The time now is 11:38 PM. |