Difference between revisions of "GNU Linux Sparc Porting"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (some problems have gone when Building with gcj)
(Building SRC680_m148 with gcc 4.1)
Line 34: Line 34:
 
<nowiki>./configure --enable-crashdump=STATIC --enable-symbols=SMALL --with-java=gij --with-jdk-home=/usr/local/4.1</nowiki>
 
<nowiki>./configure --enable-crashdump=STATIC --enable-symbols=SMALL --with-java=gij --with-jdk-home=/usr/local/4.1</nowiki>
  
== Building SRC680 with gcc 4.1 ==
+
== Building GNU/Linux Sparc SRC680_m148 with gcc-4.1/gcj ==
  
 
Building whith gcc4.1 requires the patches prepared by sb and pmladek. This is work-in-progress since m142 and patches are moving into cws. This diary is mainly for my own benefit to reproduce my build on the next milestone. I hope I have described the following steps correctly, but let me know if there is any problem to reproduce this and I will fix it.
 
Building whith gcc4.1 requires the patches prepared by sb and pmladek. This is work-in-progress since m142 and patches are moving into cws. This diary is mainly for my own benefit to reproduce my build on the next milestone. I hope I have described the following steps correctly, but let me know if there is any problem to reproduce this and I will fix it.
Line 40: Line 40:
 
In my case GCC 4.1 is built using gcc.gnu.org sources checked out from gcc-4.1-branch and installed in /usr/local/4.1.
 
In my case GCC 4.1 is built using gcc.gnu.org sources checked out from gcc-4.1-branch and installed in /usr/local/4.1.
  
With so many patches from different places it is easy to get muddled so i like to make everything explicit, and visible:
+
SRC_ROOT is jim@sun:~/build680
 +
Everything is run from SRC_ROOT unless stated.
  
(a) first checkout the sources for SRC680_m145
+
$ export CVSROOT=:pserver:sparcmoz@localhost:/cvs
 +
$ cvs -z4 co -r SRC680_m148 OpenOffice2
  
  cvs -z4 co -r SRC680_m145 OpenOffice2
+
Set the compiler variables. When building on sparc64, the -m32 is required to build for sparc:
 +
  $ export CC="/usr/local/4.1/bin/gcc -m32"
 +
$ export CXX="/usr/local/4.1/bin/g++ -m32"
  
(b) then make patches for the 2 required cws from $SRC_ROOT (top directory)
+
Adjust the PATH so there is no other gcc or gxx in the PATH, and that there is no fake java, so there is nothing returned by:
 +
$ which gcc
 +
$ which java
  
jim@sun:~/build680$ cvs diff -u -r SRC680_m145 -r cws_src680_sb41 > sb41.patch
+
If gjdoc is not in the jdk_home then it will not be found so:
  jim@sun:~/build680$ cvs diff -u -r SRC680_m145 -r cws_src680_gcc41 > gcc41.patch
+
  $ export JAVADOC=/usr/local/bin/gjdoc
  
(c) apply those patches but notice this method does not allow for new files, so there are 2 new files to add in cppu, using cvs update:
+
Get the needed patches for gcc4.1:
  inc/cppu/unotype.hxx
+
  $ cvs diff -u -r SRC680_m148 -r cws_src680_sb41 > sb41.diff
  qa/test_unotype.cxx
+
  $ cvs diff -u -r SRC680_m148 -r cws_src680_gcc41 > gcc41.diff
  
(d) I also apply some patches specifically for building GNU/Linux Sparc with my peculiar installations of gcj and ant in /usr/local which are explained at issue 50599
+
Notice from the cvs log, some new files should be checked out for sb41:
   
+
cvs server: inc/cppu/unotype.hxx no longer exists, no comparison available
(e) For GNU/Linux Sparc at least it is also necessary to have the bridges patches from cws_src680_warnings01 but those are still work-in-progress and I do not know the current status.
+
  cvs server: qa/test_unotype.cxx no longer exists, no comparison available
  
(f) I had a look and it seems all the required patches for issue 58141 are already in gcc41, but we shall soon find out if the build stops.
+
jim@sun:~/build680/cppu$ cvs update -dP -r cws_src680_sb41 inc/cppu/unotype.hxx
 +
U inc/cppu/unotype.hxx
 +
jim@sun:~/build680/cppu$ cvs update -dP -r cws_src680_sb41  qa/test_unotype.cxx
 +
U qa/test_unotype.cxx
  
(g) To run dmake runtest in testtools/source/bridgetest/pyuno it was necessary to update PYTHONPATH and revert the makefile ( see issue 40091 ). This may be useful to remember later...
+
For libwpd the fixes are in a new download version 0.8.4, to get this do:
 +
$ cvs co -r cws-src680_fs05 libwpd
  
(h) Some other patches currently needed that are already proposed but not yet in any cws:
+
Some patches for ant and gcj may be required, depending on the builders tools and environment.
 +
In my case the following are required:
  
  cppu - [http://www.openoffice.org/issues/show_bug.cgi?id=59036 issue 59036]
+
  ant-gcj.diff: remove ant test from configure, set the ant flags for gcj, remember to run autoconf before configure
  comphelper - expected for sb41 - [http://porting.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=16706 dev@porting email]
+
fastjar.diff: issue 57565, also need export JAR=/usr/local/4.1/bin/fastjar
  comphelper - for binfilter, expected for sb41 - [http://porting.openoffice.org/servlets/ReadMsg?list=dev&msgNo=16765 dev@porting email]
+
 
  goodies - [http://www.openoffice.org/issues/show_bug.cgi?id=58975 issue 58975]
+
For GNU/Linux Sparc it is also necessary to use the warnings01 patches for bridges with gcc4.1. This has not been resynced since m138, and after that we have sb41 and also unxlngs04 was integrated in bridges. Luckily sb41 is resynced to m148 already so the solution is to make a patch from m138 and merge that one after updating bridges to sb41. Some small changes were rejected and had to be applied by hand.
sw - [http://www.openoffice.org/issues/show_bug.cgi?id=58973 issue 58973]
+
  $ cvs diff -u -r SRC680_m138 -r cws_src680_warnings01 bridges > bridges-warnings01.diff
 +
  $ cvs update -dP -r cws_src680_sb41 bridges
 +
$ patch -p0 < bridges-warnings01.diff
 +
 
 +
Some miscellaneous patches (need to include issue references):
 +
sparc.diff: issue xxxxxx GNU/Linux Sparc only, needs further investigation
 +
register.diff: issue xxxxxx to preregister java components
 +
xmerge.diff: issue xxxxxx needs a better solution
 +
mozilla.diff: issue xxxxxx if building moz
 +
libxml2.diff: issue xxxxxx
 +
 
 +
Not sure if this is an issue yet or just a result of my merging?
 +
  bridges: need to replace "sal::static_int_cast" by "static_cast"
 +
 
 +
For berkeleydb a patch is needed, meanwhile:
 +
$ export JAVA=/usr/local/4.1/bin/gij
 +
 
 +
Nothing to do for moz this time, using the pre-built mozilla packages in moz/zipped.
 +
 
 +
Out of Memory: qadevOOo with gcj will need about 800-1000mb or RAM, but I have only 256mb. I must remember to increase swap file to 1000mb to be safe.
 +
 
 +
To run dmake runtest in testtools/source/bridgetest/pyuno it was necessary to update PYTHONPATH and revert the makefile ( see issue 40091 ). This may be useful to remember later...
 +
 
 +
This is needed for some run time issues:
 
  icu - [http://www.openoffice.org/issues/show_bug.cgi?id=59722 issue 59722]
 
  icu - [http://www.openoffice.org/issues/show_bug.cgi?id=59722 issue 59722]
  
(i) For any other problems refer to the issues and additional patches here[http://lists.ximian.com/pipermail/openoffice/2005-November/001356.html original patches]
+
Now run autoconf and configure:
 +
  $ cd config_office
 +
$ autoconf
 +
$ ./configure --with-java=gij --with-jdk-home=/usr/local/4.1 \
 +
--with-epm=internal --enable-crashdump=STATIC --enable-symbols=SMALL \
 +
--with-build-version="Built by Jim m148 gcc4.1/gcj" --with-package-format=rpm
  
 
== Building with gcj ==
 
== Building with gcj ==

Revision as of 11:04, 7 January 2006

GNU Linux Sparc Porting

The objective is to maintain the complete upstream sources so that the GNU/Linux sparc platform can be packaged for example by debian, gentoo and others. Also to provide an upstream "benchmark" released version that can be used for confirming who owns any bugs.

For GNU/Linux sparc all building now is done with gcj. As gcj is developing rapidly it is preferred to use the latest version. The gcj version being used now is gcc4.1.

Other projects that need more work:

- fix multimedia (sound is working but needs Java Media Framework with gij)

- qa with testtool

- very slow startup (depends on javaldx?)

The latest upstream release is on mirrors under pub/OpenOffice.org/contrib/linuxsparc

Building with GCC 4.1

There are 3 main issues listed below, and a few others yet...

i57855 Bad uses of getCppuType

Some patches for this isssue are in cws, for details see the dev@porting mail thread 
dev@porting

i58141 extra qualification on member

This affects many unrelated projects.

i58937 Build binfilter with gcc4.1

The entire product has been built on GNU/Linux Sparc using the patches mentioned at those issues and described in detail below. No modules are excluded by the configure step which is:

./configure --enable-crashdump=STATIC --enable-symbols=SMALL --with-java=gij --with-jdk-home=/usr/local/4.1

Building GNU/Linux Sparc SRC680_m148 with gcc-4.1/gcj

Building whith gcc4.1 requires the patches prepared by sb and pmladek. This is work-in-progress since m142 and patches are moving into cws. This diary is mainly for my own benefit to reproduce my build on the next milestone. I hope I have described the following steps correctly, but let me know if there is any problem to reproduce this and I will fix it.

In my case GCC 4.1 is built using gcc.gnu.org sources checked out from gcc-4.1-branch and installed in /usr/local/4.1.

SRC_ROOT is jim@sun:~/build680 Everything is run from SRC_ROOT unless stated.

$ export CVSROOT=:pserver:sparcmoz@localhost:/cvs
$ cvs -z4 co -r SRC680_m148 OpenOffice2

Set the compiler variables. When building on sparc64, the -m32 is required to build for sparc:

$ export CC="/usr/local/4.1/bin/gcc -m32"
$ export CXX="/usr/local/4.1/bin/g++ -m32"

Adjust the PATH so there is no other gcc or gxx in the PATH, and that there is no fake java, so there is nothing returned by:

$ which gcc
$ which java

If gjdoc is not in the jdk_home then it will not be found so:

$ export JAVADOC=/usr/local/bin/gjdoc

Get the needed patches for gcc4.1:

$ cvs diff -u -r SRC680_m148 -r cws_src680_sb41 > sb41.diff
$ cvs diff -u -r SRC680_m148 -r cws_src680_gcc41 > gcc41.diff

Notice from the cvs log, some new files should be checked out for sb41:

cvs server: inc/cppu/unotype.hxx no longer exists, no comparison available
cvs server: qa/test_unotype.cxx no longer exists, no comparison available
jim@sun:~/build680/cppu$ cvs update -dP -r cws_src680_sb41 inc/cppu/unotype.hxx
U inc/cppu/unotype.hxx
jim@sun:~/build680/cppu$ cvs update -dP -r cws_src680_sb41  qa/test_unotype.cxx
U qa/test_unotype.cxx

For libwpd the fixes are in a new download version 0.8.4, to get this do:

$ cvs co -r cws-src680_fs05 libwpd

Some patches for ant and gcj may be required, depending on the builders tools and environment. In my case the following are required:

ant-gcj.diff: remove ant test from configure, set the ant flags for gcj, remember to run autoconf before configure
fastjar.diff: issue 57565, also need export JAR=/usr/local/4.1/bin/fastjar

For GNU/Linux Sparc it is also necessary to use the warnings01 patches for bridges with gcc4.1. This has not been resynced since m138, and after that we have sb41 and also unxlngs04 was integrated in bridges. Luckily sb41 is resynced to m148 already so the solution is to make a patch from m138 and merge that one after updating bridges to sb41. Some small changes were rejected and had to be applied by hand.

$ cvs diff -u -r SRC680_m138 -r cws_src680_warnings01 bridges > bridges-warnings01.diff
$ cvs update -dP -r cws_src680_sb41 bridges
$ patch -p0 < bridges-warnings01.diff

Some miscellaneous patches (need to include issue references):

sparc.diff: issue xxxxxx GNU/Linux Sparc only, needs further investigation
register.diff: issue xxxxxx to preregister java components
xmerge.diff: issue xxxxxx needs a better solution
mozilla.diff: issue xxxxxx if building moz
libxml2.diff: issue xxxxxx

Not sure if this is an issue yet or just a result of my merging?

bridges: need to replace "sal::static_int_cast" by "static_cast"

For berkeleydb a patch is needed, meanwhile:

$ export JAVA=/usr/local/4.1/bin/gij

Nothing to do for moz this time, using the pre-built mozilla packages in moz/zipped.

Out of Memory: qadevOOo with gcj will need about 800-1000mb or RAM, but I have only 256mb. I must remember to increase swap file to 1000mb to be safe.

To run dmake runtest in testtools/source/bridgetest/pyuno it was necessary to update PYTHONPATH and revert the makefile ( see issue 40091 ). This may be useful to remember later...

This is needed for some run time issues:

icu - issue 59722

Now run autoconf and configure:

$ cd config_office
$ autoconf
$ ./configure --with-java=gij --with-jdk-home=/usr/local/4.1 \
--with-epm=internal --enable-crashdump=STATIC --enable-symbols=SMALL \
--with-build-version="Built by Jim m148 gcc4.1/gcj" --with-package-format=rpm

Building with gcj

This is mainly intended as a diary to remind myself what i am doing. Building with gcj is not fully supported "out of the box" and anyone seeking to build this way will need to figure out some things for themselves. Recent patches for building GNU Linux Sparc with gcj are at i50599 but these will not be committed as they are specific to my building environment.

i50599 Build GNU Linux Sparc with gcj

The following describes how I build with gcj. I believe the work to make this possible was mostly done by Caolan and Rene showed me how to get Ant working.

Step 1: get a version of gcc with suitable gcj. 

I think that gcc >= 4.0 is necessary, in my case I get the latest preview gcc4.1 sources and build gcc into /usr/local because gcj was for some time not working on debian/unstable. And it is easier to see what is happening without the various workarounds to provide commands such as java that do not really exist.

Step 2: set up the required commands for build tools

Note that the required compiler can be specified by setting environment variables CC and CXX before running configure, but the same is not possible for some related programs. In just a few places the code expects these commands to be available, normally in /usr/bin: java javac jar

But building gcc provides instead the corresponding commands: gij gcj fastjar (gcc 4.1)

Some distributions will arrange for the java etc commands to be available, but the method to provide these varies between distributions and over time. In my opion it will be better to let these be defined by the configuration step, but I am a long way from knowing how that should be done!

With /usr/local/bin in my PATH the configuration finds /usr/local/bin/gjdoc without being asked. In anycase it is possible to define the following for the configurator: JAVADOC=/usr/local/bin/gjdoc

Configuration --with-java=gij and --with-jdk-home=/usr/local takes care of gij and gcj in most cases. Patches are needed to workaround one case of hardcoding for each of java and jar.

Ant is more complicated, the basic idea is to set up the required command line and parameters to invoke Ant in solenv/inc/ant.mk depending on how Ant is installed, and is better explained by reviewing the patches here i50599 Build GNU Linux Sparc with gcj


Step 3: configure

In my case the configure commands may be like this:

$ export CC="/usr/local/bin/gcc -m32"

$ export CXX="/usr/local/bin/g++ -m32"

$ ./configure --with-jdk-home=/usr/local --with-java=gij


For my patches to avoid using java and jar commands I will also define the following:

$ export JAR=/usr/local/bin/fastjar

$ export JAVA=/usr/local/bin/gij <-- needed for berkeleydb


Step 4: packaging

Finally the build fails when preregistering java components. A workaround for gcc4.1 has been provided here: preregistering java components

Installing from rpm without root access

The GNU Linux Sparc packages from contrib/linuxsparc should not interfere with installations provided by the various distribution packagers such as debian, gentoo etc. Therefore the supplied rpms can be installed in the user's home directory using the install_linux.sh script which is available on mirrors at pub/OpenOffice.org/developer/install_scripts/

The rpm command is required but root access is not required
Personal tools