[kaffe] Using JAVAC_FLAGS for compilation

Mark Wielaard mark@klomp.org
Fri Jan 17 06:09:01 2003


--=-epCWqQ3lCrKHSJUJx8Pt
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

On Sat, 2003-01-11 at 21:25, Dalibor Topic wrote:
> In theory, you could also compile kaffe's class
> library with gcj now, by passing it JAVAC_FLAGS="-C"
> to compile to bytecodes. Unfortunately, all gcj
> version I tried before, up to 3.2, are not able to
> compile the class library. 
> 
> Maybe Mark Wielaard could supply some information on
> how the latest gcj from CVS fares on kaffe's sources.

No it doesn't. It fails as follows:
./java/lang/ClassNotFoundException.java:52: error: Class `java.lang.ClassNotFoundException' already defined in java/lang/ClassNotFoundException.java:52.
   public class ClassNotFoundException extends Exception
                ^
./java/lang/ClassNotFoundException.java:72: internal compiler error: tree check: expected class 'd', have 'x' (error_mark) in enter_block, at java/parse.y:12403

The problem is that gcj gets confused about the "./" at the front. One
of these files is loaded from the CLASSPATH the other is given on the
command line. You can partly work around this by explicitly giving an
classpath that only points to the javalib/lib dir. But then you get:

java/lang/Object.java: In class `java.lang.Object':
java/lang/Object.java: In constructor `()':
java/lang/Object.java:20: internal compiler error: Segmentation fault

gcj is known to not like foreign java.lang.Object classes.
And this is now bug java/9351.

But if you just take the java/lang/Object.java supplied with libgcj then
it does compile most of the classes. You have to make a few changes
though. java/lang/Thread should call Object wait() not wait0().
java/awt/Color.java has some non-ASCII characters (patch attached).

Then you get some more issues with java.util.prefs but then I gave up.
Unless some people really need to compile Klasses.jar with gcj -C I put
off debugging this until after gcc 3.3 is released since I think the
issues are a bit to complex to try to fix before 3.3

Cheers,

Mark

--=-epCWqQ3lCrKHSJUJx8Pt
Content-Disposition: inline; filename=Color.diff
Content-Type: text/x-patch; name=Color.diff; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

Index: libraries/javalib/java/awt/Color.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/awt/Color.java,v
retrieving revision 1.12
diff -u -r1.12 Color.java
--- libraries/javalib/java/awt/Color.java	16 Mar 2002 18:36:59 -0000	1.12
+++ libraries/javalib/java/awt/Color.java	17 Jan 2003 13:43:57 -0000
@@ -129,7 +129,7 @@
 	else {
 		hue *= 6.0f;                 // remove scaling
 		hi = (int) Math.floor( hue);
-		if ( hi == 6 ) hi = 0;       // 360ø == 0ø
+		if ( hi == 6 ) hi = 0;       // 360 == 0
 		
 		hfrac = hue - hi;
 		bri *= 255;
@@ -194,7 +194,7 @@
 			else
 				hsb[0] = (4.0f + (rf - gf)/dif) / 6.0f;
 			
-			if ( hsb[0] < 0 ) hsb[0] += 1.0f;            // wrap hue around 360ø
+			if ( hsb[0] < 0 ) hsb[0] += 1.0f;            // wrap hue around 360
 		}
 		else {                                         // we don't want NaNs
 			hsb[0] = 0.0f;

--=-epCWqQ3lCrKHSJUJx8Pt--