Bug 96845 - ant requires LOCALCLASSPATH
Summary: ant requires LOCALCLASSPATH
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Kim Moir CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 111607 112192 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-26 14:48 EDT by Billy Biggs CLA
Modified: 2005-10-31 13:29 EST (History)
3 users (show)

See Also:


Attachments
patch for build file to resolve debian issues (1.89 KB, patch)
2005-10-31 13:29 EST, Kim Moir CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Billy Biggs CLA 2005-05-26 14:48:09 EDT
From http://bugs.gentoo.org/show_bug.cgi?id=92606, apparently current versions
of ant want the classpath in LOCALCLASSPATH.

diff -ur eclipse.orig/build eclipse.amd64/build
--- eclipse.orig/build	2005-05-13 21:38:39.000000000 +0300
+++ eclipse.amd64/build	2005-05-23 21:50:52.000000000 +0300
@@ -56,9 +56,9 @@
 then
         ORIGCLASSPATH=$CLASSPATH;export ORIGCLASSPATH
         ant -q -buildfile jdtcoresrc/compilejdtcorewithjavac.xml
-        CLASSPATH=$PWD/jdtcoresrc/ecj.jar:$CLASSPATH;export CLASSPATH
+        LOCALCLASSPATH=$PWD/jdtcoresrc/ecj.jar:$CLASSPATH;export LOCALCLASSPATH
         ant -q -buildfile jdtcoresrc/compilejdtcore.xml
-        CLASSPATH=$PWD/ecj.jar:$ORIGCLASSPATH;export CLASSPATH
+        LOCALCLASSPATH=$PWD/ecj.jar:$ORIGCLASSPATH;export LOCALCLASSPATH
 		ant -q -buildfile build.xml $target -DinstallOs=$os -DinstallWs=$ws
-DinstallArch=$arch $compilelibs $bootclasspath 
 else
 	echo "The os-ws-arch combination of $os-$ws-$arch is not valid."
Comment 1 Kim Moir CLA 2005-05-26 17:03:42 EDT
This patch does not work, the ecj.jar is no longer on the classpath and the
compile fails.  Billy, can you get the person who originally commented on this
issue on the gentoo bugzilla to comment on the context of this change?  What
verson of ant are they using?
Comment 2 Karl Trygve Kalleberg CLA 2005-06-01 10:16:20 EDT
The latest stable Ant in Gentoo is 1.6.2.
Comment 3 Karl Trygve Kalleberg CLA 2005-06-01 10:23:50 EDT
This is our ant script:
http://www.gentoo.org/cgi-bin/viewcvs.cgi/dev-java/ant-core/files/1.6.2-ant?view=markup

As you can see, we entirely reconstruct a valid CLASSPATH so that we know ant
will run. Users invariably mess up their CLASSPATH to the point none of the
system utilities work.

If the user requires additions to ant's classpath, she must set the
LOCALCLASSPATH env var.

Debian does similar stuff, and also honour LOCALCLASSPATH in their ant, but I
cannot speak for the other distros.
Comment 4 Kim Moir CLA 2005-06-02 16:40:51 EDT
The reference platform for Eclipse 3.1 for Linux GTK is RH enterprise WS 3. 
Changing to script to use the LOCALCLASSPATH causes compilation to fail on this
platform.  Do you have any suggestions on how our scripts could accomodate your
change and not cause issues on other distros? For instance,  parsing
/etc/issue.net and using the results to set the appropriate classpath variable?
Comment 5 Kim Moir CLA 2005-06-02 16:41:54 EDT
please see previous comments
Comment 6 Karl Trygve Kalleberg CLA 2005-06-02 17:59:38 EDT
The dirty hack: Set both LOCALCLASSPATH and CLASSPATH. 

A less dirty hack:

--------- sketch -----------

if [ -f /etc/debian_version] || [ -f /etc/gentoo-release ] ; then 
  export LOCALCLASSPATH=...
elif [ -f /etc/redhat-release ] ; then
  export CLASSPATH=...
else
  echo "!!! Warning: Distro variant not recognized, assuming RHEL3 compatible."
  export CLASSPATH=...
fi

ant ...

--------- sketch end -----------

The least dirty (but most cooky) hack:

Bake muffins, bring to Billy's boss and persaude said person to let Billy hack
on an automake-based build system for Eclipse with us (Gentoo), RedHat and Debian:)
Comment 7 Kim Moir CLA 2005-06-02 22:48:35 EDT
I tried the setting both the CLASSPATH and LOCALCLASSPATH earlier today on 
RHEL. It failed with jdtcore compiler failed with an "interesting exception".  
Will talk to the jdtcore guys about what this means.

I'll implement your if statement and see how that goes, it should be fine.

It is definitely too hot to bake muffins. Beer and ice cream as bribes are 
definitely more in season. We want to keep the eclipse source build as close as 
possible to the real build process so the actual result mirrors that from the 
releng builds. But I understand your frustration with having to hack our 
scripts to create rpms etc.
Comment 8 Kim Moir CLA 2005-06-03 16:05:37 EDT
fixed in HEAD
Comment 9 Mikko Tiihonen CLA 2005-06-12 12:49:21 EDT
I'm the source of the patch that initiated this bug. Below is the link to the
official ant shell script (as seen from the tags it is the same for th
efollowing ant versions ANT_163, ANT_164, ANT_165).
http://cvs.apache.org/viewcvs.cgi/ant/src/script/ant?rev=1.38.2.9&only_with_tag=ANT_165&view=markup

When searching the word CLASSPATH from the script it is obvious that only
LOCALCLASSPATH is passed to the java when launching ant. The only place where
the plain CLASSPATH is ever touched is inside some strange rpm_mode section,
which can only be enabled if defined in ant.conf.

My conclusion would be that some rpm using distributions managed to get their
evil CLASSPATH hack into ant build scripts and now it's biting them back. For
and 1.6.3 and newer one can use the --noconfig option to make rpm_mode ant
behave like any other ant.
Comment 10 Kim Moir CLA 2005-06-13 09:24:20 EDT
I'm not sure how your comments indicate the need for changes to our build
script. Could you provide more detail?
Comment 11 Mikko Tiihonen CLA 2005-06-14 13:42:29 EDT
I do not think that futher changes to the build system are necessary. The fixes
proposed in comment #6 are good as they fix the problem without hurting
backwards compatibility.

I was just trying to explain why I think the LOCALCLASSPATH should be supported
by the build system (sorry for the delay, I was asked to do that 3 weeks ago). I
also tried explained why just using LOCALCLASSPATH doesn't work with some ant
installations (as suggested in my original patch in comment #1).

Anyway, now that I started writing this comment I will still propose one more
less hackish way to fix the LOCALCLASSPATH vs CLASSPATH problem:
1) document that ant 1.6.3 or newer is required for building eclipse
2) define only LOCALCLASSPATH
3) invoke ant with --noconfig option
Comment 12 Billy Biggs CLA 2005-06-26 23:14:29 EDT
Karl, your suggested change broke the source build on my debian machine at home.
 I had to hack the build script to stop setting LOCALCLASSPATH before the thing
would build.  Is there a safer way to fix this?
Comment 13 Karl Trygve Kalleberg CLA 2005-06-27 04:40:44 EDT
From reading the Debian ant file, Debian decided to invert the meaning of
CLASSPATH and LOCALCLASSPATH for ant.

On Debian, they collect autodetect the necessary packages for ant into
LOCALCLASSPATH, then append the CLASSPATH env var. If the env var
CLASSPATH_OVERRIDE is set, the CLASSPATH will be prepended.

If every distro had just used the upstream ant script, things would have worked
the same, but Debian apparently decided to write their own, which does not
preserve the original semantics.

The very best way for fixing this is having it solved upstream at apache, then
enforcing every distro not to break the apache way.
Comment 14 Karl Trygve Kalleberg CLA 2005-06-27 04:45:29 EDT
But waitasec! The case I described above with the inversion of CLASSPATH vs
LOCALCLASSPATH will only happen if $rpm_mode is set.

Do you have /etc/ant.conf, or ~/.ant/ant.conf or ~/.antrc? On my kubuntu system,
 I don't, so this should never happen.

(Note to self: Never reply to bugs before getting out of bed in the morning.)
Comment 15 Mikko Tiihonen CLA 2005-06-29 16:34:26 EDT
As I said in comment #9 the build should use the ant option --noconfig which
always disables the rpm_mode (which can only be enabled in configuration files).

The only downside of this one is that at least ant 1.6.3 is required for
building eclipse, but that shouldn't be a problem to anyone.
Comment 16 Billy Biggs CLA 2005-10-11 12:51:50 EDT
Reopening to address comment #12.
Comment 17 Billy Biggs CLA 2005-10-11 12:53:19 EDT
*** Bug 112192 has been marked as a duplicate of this bug. ***
Comment 18 Billy Biggs CLA 2005-10-11 12:54:16 EDT
*** Bug 111607 has been marked as a duplicate of this bug. ***
Comment 19 Kim Moir CLA 2005-10-11 13:38:29 EDT
reverted LOCALCLASSPATH  defintion in HEAD to address comment #12
Comment 20 Zorzella Mising name CLA 2005-10-28 11:54:22 EDT
Any way someone can post the new build as an attachment to this bug? I'm
downloading the 3.1.1 sourcebuild (not from CVS) and can't compile it on my Debian.

Wouldn't it also be wise to repackage the 3.1.1 sourcebuild that is downloadable
from eclipse.org to include this patch?

Zorzella
Comment 21 Kim Moir CLA 2005-10-28 13:42:47 EDT
Debian is not one of our reference platforms, so no, we will not be repackaging
this into a new zip.

http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_1.html#TargetOperatingEnvironments

If you replace the file named "build" with
org.eclipse.releng.eclipsebuilder/sdk/srcBuild/build in either the HEAD or
R3_1_maintenance streams, you shouldn't see this error. 

If there is a 3.1.2 release, this fix will be included. Also, this fix is
included in all current 3.2 stream builds.
Comment 22 Zorzella Mising name CLA 2005-10-31 13:13:48 EST
It would be simpler not to have to download the entire CVS build for just one
file. Isn't there, at least, a URL where you can leave the rectified "build"?

Thanks,

Z
Comment 23 Kim Moir CLA 2005-10-31 13:28:57 EST
I'm not saying that you should run the entire build from CVS again (src fetch)

What I am saying is that you should check out only the project
org.eclipse.releng.eclipsebuilder from R3_1_maintenance or the HEAD stream.

Copy this named build from 
org.eclipse.releng.eclipsebuilder/sdk/srcBuild/build
to the file named build in the root of your src build installation.

We do not provide rectified builds on a download site, only patches.

Comment 24 Kim Moir CLA 2005-10-31 13:29:55 EST
Created attachment 29009 [details]
patch for build file to resolve debian issues