Project

Profile

Help

Compile 8.9 for jre 1.4, build enhancements

Added by Anonymous over 16 years ago

Legacy ID: #5098071 Legacy Poster: Peter Büttner (buetp000)

I need a saxon-B 8.9.x to run under jre 1.4.2. (I know the lifetime ends soon) Since i didn't found one (maybe that this will be available in the future) and also found no howto compile i tried to compile it by myself. I got some problems, solved them, and hope someone (the author:-) my take a look at my actions to enshure they are correct. A first question: the jar that we can download is version 8-9-0-4j, but the buildfile is 8.9.0.3, so which one is outdated: *.java or build.xml? I hope to help others to compile the source with the ant build. I am only for saxon-b-j-8.9, maybe some enhancements can be transfered. 1) missing directories breaks targets ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some of the tasks fail with no or misleading errors if depending directories are missing, some more <mkdir dir="..."/> may help: $build.xml-Dir/libs <<<< for target download $build.xml-Dir/temp/j/source <<<< for target copysource-patch $root/saxon-89-patch <<<< for target copysource-patch I created $root/saxon-svn2/latest8.9 and put sources from svn here 2) compile failed: ~~~~~~~~~~~~~~~~~~ in "net.sf.saxon.event.SerializerFactory" add: import net.sf.saxon.om.ExternalObjectModel; I wondered why this is missing, did i made a mistake? 3) Task 'copysource-patch' failed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since a target breaks the moment the first contained task fails i didn't get the files patched: <replace file="${temp-src-j.dir}/com/saxonica/validate/SchemaAwareConfiguration.java" <<<<<<<<<< file missing <replace file="${temp-src-j.dir}/net/sf/saxon/Configuration.java" <<<<<<<<<< file exists As i only create saxon-b the second patch is never executed and so i can't compile (fixed that by hand) The simple workaround to exchange those tasks will break the following tasks. One may add a condition, but there is better stuff: --- Change this ---------------------- <replace file="${temp-src-j.dir}/net/sf/saxon/Configuration.java" token="/DOTNETONLY/" value="//" summary="yes"/> <replace file="${temp-src-j.dir}/com/saxonica/validate/SchemaAwareConfiguration.java" token="/DOTNETONLY/" value="//" summary="yes"/> --- to ------------------------------- <replace dir="${temp-src-j.dir}" includes="com/saxonica/validate/SchemaAwareConfiguration.java net/sf/saxon/Configuration.java" token="/DOTNETONLY/" value="//" summary="yes"/> -------------------------------------- this doesn't fail since it just does nothing on missing files. Well, there is a better one, use a 'function' in ant: -------------------------------------------------------------------------------------------------- <target name="patch-dotnet-java" ><!-- patch.token, patch.dir --> <replace dir="${patch.dir}" includes="com/saxonica/validate/SchemaAwareConfiguration.java net/sf/saxon/Configuration.java" token="${patch.token}" value="//" summary="yes"/> </target> ... Usage ... <antcall target="patch-dotnet-java"> <param name="patch.dir" value="${temp-src-j.dir}"/> <param name="patch.token" value="/DOTNETONLY/"/> </antcall> -------------------------------------------------------------------------------------------------- Or even shorter: -------------------------------------------------------------------------------------------------- <macrodef name="patch-dotnet-java"> <attribute name="dir"/> <attribute name="token"/> <sequential> <replace dir="@{dir}" includes="com/saxonica/validate/SchemaAwareConfiguration.java net/sf/saxon/Configuration.java" token="@{token}" value="//" summary="yes"/> </sequential> </macrodef> Use it this way (note only 1 short line but 8 ones before): <patch-dotnet-java dir="${temp-src-j.dir}" token="/DOTNETONLY/"/> ... <patch-dotnet-java dir="${temp-src-nj.dir}" token="/JAVAONLY/"/> -------------------------------------------------------------------------------------------------- 4) Now to build the whole stuff for jre 1.4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [you have read 1) .. 3) above and changed/added what is needed] (Note: i use windows) a) Change build.xml Change target 'compile-bj' in '<javac ...' add these attributes: fork="true" executable="V:/jdk1.4/bin/javac.exe" bootclasspath="E:\saxonBuild\libs\dom.jar;V:\jdk1.4\jre\lib\rt.jar" (change your paths:-) we need updated jars(Dom level3, Jaxp 1.3): dom.jar <<<<<<<<< since older dom api is the rt.jar, note the bootclasspath above. and also jaxp-api.jar put them into ${lib.dir} b) do the build (using ant 1.7 and jre 1.5) open a cmd window set JAVA_HOME=V:\jdk1.5 ant download ant copysource-patch ant create-meta-inf ant compile-bj ant jar-bj ... done. jars seem to work with 1.4 (i didn't run much test on them.


Replies (5)

Please register to reply

RE: Compile 8.9 for jre 1.4, build enhancemen - Added by Anonymous over 16 years ago

Legacy ID: #5098112 Legacy Poster: Peter Büttner (buetp000)

Sorry, i noted this some days before, now i can't find any problem, the source in svn is completely correct, the import is already there: > 2) compile failed: > ~~~~~~~~~~~~~~~~~~ > in "net.sf.saxon.event.SerializerFactory" add: > import net.sf.saxon.om.ExternalObjectModel; > I wondered why this is missing, did i made a mistake? Peter

RE: Compile 8.9 for jre 1.4, build enhancemen - Added by Anonymous over 16 years ago

Legacy ID: #5098158 Legacy Poster: Michael Kay (mhkay)

Firstly, Saxon 8.9 as issued is compiled to run on JDK 1.4, you should not need to recompile it. Secondly, I don't really support the build process. I've occasionally issued an Ant build file to help people get started, but it's not productized, maintained, or supported. I'm surprised that a compile should fail - you don't actually say where you got the source that you are compiling. If it's from Subversion then the likelihood is that I retrofitted a patch from a later release carelessly. Have a look at the Subversion log. If this were a current release I'd take it seriously, but I'm no longer actively maintaining 8.9. I'm not a very advanced Ant user, as you can tell. I'll take a look at your suggestions to see if they give any ideas. However, the build scripts have moved on since 8.9. Michael Kay

RE: Compile 8.9 for jre 1.4, build enhancemen - Added by Anonymous over 16 years ago

Legacy ID: #5098254 Legacy Poster: Peter Büttner (buetp000)

That was fast... > Firstly, Saxon 8.9 as issued is compiled to run on JDK 1.4, you should not need to recompile it. Well, i get an Exception with the jars downloaded from sf: > --- Info--- > Timestamp of the *.class in the jar: > All but 3: "26.6.2007 22:37" > net.sf.saxon.Comtroller.class and MANIFEST.MF "26.6.2007 23:11" > META-INF/services/javax.xml.transform.TransformerFactory "15.2.2007 18:58" > ----------- > java.lang.NoSuchMethodError: java.lang.StringBuffer.append(Ljava/lang/CharSequence;)Ljava/lang/StringBuffer; >at net.sf.saxon.functions.FormatNumber2$SubPicture.formatDecimal(FormatNumber2.java:685) http://saxon.svn.sourceforge.net/viewvc/saxon/latest8.9/bj/net/sf/saxon/functions/FormatNumber2.java?revision=148&amp;view=markup Line 685: sb.append(DecimalValue.decimalToString(dval).toString()); // for JDK 1.4 - see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6409414 I think you have commented this. The (1.5) compiler chooses sb.append( CharSequence). What about the Version difference i noted: 8.9.0.3 <-> 8.9.0.4 > Secondly, I don't really support the build process. I've occasionally issued an Ant build file to help > people get started, but it's not productized, maintained, or supported. > ... > I'm not a very advanced Ant user, as you can tell. I'll take a look at your suggestions to see if > they give any ideas. However, the build scripts have moved on since 8.9. I just try to help enhance it, maybe someday it can be compiled out of the box. An easy build process may help others to work on the source and send patches? I could have send a new build.xml, but i didn't want to mess up your work >I'm surprised that a compile should fail - you don't actually say where you got the source that you are compiling. From svn. Some days ago, the logs doesn't tell about any changes since then. As i noted in the second post i made a mistake. I will Check it out again right now: checkout -r HEAD https://saxon.svn.sourceforge.net/svnroot/saxon/latest8.9 ... Checked out revision 279. I compared it to the part i used: is identic [*1] Now compiling the fresh parts (cleand all dirs before) with the changes in the build file (to get the patch run mostly, the dot-net part won't) I get: [javac] E:\saxonBuild\temp\j\source\net\sf\saxon\event\SerializerFactory.java:199: cannot find symbol [javac] symbol : variable NamespaceConstant [javac] location: class net.sf.saxon.event.SerializerFactory [javac] pipe.getConfiguration().getNamePool().allocateCodeForURI(NamespaceConstant.XHTML); [javac] ^ I remember this, probably i mangled something as i wrote it down some weeks ago and the missing import in my first posting was this: import net.sf.saxon.om.NamespaceConstant; last change in: > http://saxon.svn.sourceforge.net/viewvc/saxon/latest8.9/bj/net/sf/saxon/event/SerializerFactory.java?revision=154&amp;view=markup it is 8 Month ago. [*1] I changed the code (the import) some weeks ago, compiled it. Some days later i checked it out again, not cleaning the classfiles. So the comipled classes were not in sync with the code, but this doesn't matter, now it is all fresh. Now i patched the import in ...latest8.9/.../SerializerFactory: > import net.sf.saxon.om.NamespaceConstant; startig ant again (deleted the classes, source dir in $temp) > ant copysource-patch > ant compile-bj and it compiled. So i think the import is needed. > If it's from Subversion then the likelihood is that I retrofitted a patch from a later release carelessly. > Have a look at the Subversion log. If this were a current release I'd take it seriously, but I'm no longer > actively maintaining 8.9. The people i write code for using 8.9, so i have to. Some companies are not so fast in using newer software:-) Peter

RE: Compile 8.9 for jre 1.4, build enhancemen - Added by Anonymous over 16 years ago

Legacy ID: #5098841 Legacy Poster: Michael Kay (mhkay)

  1. Yes, you're correct, 8.9.0.4 was compiled using the JDK 5 compiler in 1.4 mode, and this cause format-number() to fail: see buf=g https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1765568&amp;group_id=29872&amp;atid=397617 which was fixed in Subversion but has not been fixed in any issued maintenance release. 2. The missing import in SerializerFactory appears to be due to an incomplete patch in fixing bug 1815211. 3. "Some companies are not so fast in using newer software". Indeed. Let them know that if they want support, I'm happy to provide it for a fee. Michael Kay Saxonica

RE: Compile 8.9 for jre 1.4, build enhancemen - Added by Anonymous over 16 years ago

Legacy ID: #5100265 Legacy Poster: Peter Büttner (buetp000)

>1. Yes, you're correct, 8.9.0.4 was compiled using the JDK 5 compiler in 1.4 mode, and this cause format-number() to fail: see buf=g >https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1765568&amp;group_id=29872&amp;atid=397617 which was fixed in Subversion but has not been fixed in any >issued maintenance release. Ok, if this is the only place where a CharSequence is appended to a StringBuffer: > http://saxon.svn.sourceforge.net/viewvc/saxon/latest8.9/bj/net/sf/saxon/functions/FormatNumber2.java?r1=122&amp;r2=138 then there maybe no other similar problems. So one may compile against 1.5-runtime with the 1.4 target switches and get no probs? (Some days ago i thought about a 'checker' that verifies a jar against a jre-rt.jar, Retroweaver does something in that direction, but it silently changes those calls) As you mentioned 'Version 8.9.0.4'. Again: Why the svn version is 8.9.0.3, the jars to download are labeled as 8.9.0.4? > 2. The missing import in SerializerFactory appears to be due to an incomplete patch in fixing bug 1815211. > 3. "Some companies are not so fast in using newer software". Indeed. Let them know that if they want support, I'm happy to provide it for a fee. If there is need for support they will ask you. I will ask them why using 8.9. But probably we won't change quickly, there is much more in that project, i think there will be a small/medium change in the next release in some weeks, it is are developed and tested in the last year, so one don't want to change to much right now. Also saxon runs in an oracle database, and i don't know if there are issues 'cause of that. We just use the xslt part with jaxp, so the only thing is if 8.9 and 9.1 transform with the same results, i read the changes from 8.9->9.0 and found nothing that affect us. One question arised a year ago (where payed support maybe interesting): Do you have anything that may help to 'obfuscate' the xslt-source? We give a client with some xslt to the users, and competitors may extract the xslts. I thought about xalans precompiled xslt - they may stop the simple spy to recreate the xslts. There is not much one can do since with a debugger/decompiler one easily hooks the Transformer building process and save the xslts directly. Peter

    (1-5/5)

    Please register to reply