Bug 173505 - java/java3d does not compile
Summary: java/java3d does not compile
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Walter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-09 17:10 UTC by james.raynard
Modified: 2013-06-16 18:10 UTC (History)
0 users

See Also:


Attachments
java3d.txt (3.49 KB, text/plain)
2013-05-19 17:23 UTC, piotr.smyrak
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description james.raynard 2012-11-09 17:10:01 UTC
When attempting to build the port, the following output is observed:

compile-opt:
    [mkdir] Created dir: /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build/freebsd/opt/classes
    [mkdir] Created dir: /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build/freebsd/opt/gen/tools
    [mkdir] Created dir: /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build/freebsd/opt/gen/classes/javax/media/j3d
     [copy] Copying 1 file to /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build/freebsd/opt/gen/classes/javax/media/j3d
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/build.xml:102: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 760 source files to /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build/freebsd/opt/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:38: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac] import sun.awt.X11GraphicsDevice;
    [javac]               ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:39: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac] import sun.awt.X11GraphicsConfig;
    [javac]               ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeScreenInfo.java:35: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac] import sun.awt.X11GraphicsDevice;
    [javac]               ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:64: error: package com.sun.image.codec.jpeg does not exist
    [javac] import com.sun.image.codec.jpeg.JPEGImageEncoder;
    [javac]                                ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:65: error: package com.sun.image.codec.jpeg does not exist
    [javac] import com.sun.image.codec.jpeg.JPEGImageDecoder;
    [javac]                                ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:66: error: package com.sun.image.codec.jpeg does not exist
    [javac] import com.sun.image.codec.jpeg.JPEGCodec;
    [javac]                                ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:67: error: package com.sun.image.codec.jpeg does not exist
    [javac] import com.sun.image.codec.jpeg.JPEGEncodeParam;
    [javac]                                ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:75: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac]         X11GraphicsDevice gd =
    [javac]         ^
[javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:76: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac]             (X11GraphicsDevice)((X11GraphicsConfig)gc[0]).getDevice();
    [javac]              ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:76: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]             (X11GraphicsDevice)((X11GraphicsConfig)gc[0]).getDevice();
    [javac]                                  ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:91: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]                                ((X11GraphicsConfig)gc[i]).getVisual());
    [javac]                                  ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:140: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]         X11GraphicsConfig gc0 = null;
    [javac]         ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:142: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]             if (((X11GraphicsConfig)gc[i]).getVisual() == visID) {
    [javac]                   ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:143: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]                 gc0 = (X11GraphicsConfig)gc[i];
    [javac]                        ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:154: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]         X11GraphicsConfig gc1 =
    [javac]         ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:155: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]             X11GraphicsConfig.getConfig(gd, gc0.getVisual(),
    [javac]             ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:180: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac]         X11GraphicsDevice gd =
    [javac]         ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:181: warning: X11GraphicsDevice is internal proprietary API and may be removed in a future release
    [javac]             (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
    [javac]              ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/x11/javax/media/j3d/X11NativeConfigTemplate3D.java:181: warning: X11GraphicsConfig is internal proprietary API and may be removed in a future release
    [javac]             (X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
    [javac]                                  ^
(...)
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/applet/MainFrame.java:341: warning: AppletAudioClip is internal proprietary API and may be removed in a future release
    [javac]     return new sun.applet.AppletAudioClip( url );
    [javac]                          ^
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:206: error: cannot find symbol
    [javac]         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( byteStream );
    [javac]         ^
    [javac]   symbol:   class JPEGImageEncoder
    [javac]   location: class ImageComponentState
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:206: error: cannot find symbol
    [javac]         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( byteStream );
    [javac]                                    ^
    [javac]   symbol:   variable JPEGCodec
    [javac]   location: class ImageComponentState
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:265: error: cannot find symbol
    [javac]         JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( byteStream );
    [javac]         ^
    [javac]   symbol:   class JPEGImageDecoder
    [javac]   location: class ImageComponentState
    [javac] /usr/ports/java/java3d/work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java:265: error: cannot find symbol
    [javac]         JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( byteStream );
    [javac]                                    ^
    [javac]   symbol:   variable JPEGCodec
    [javac]   location: class ImageComponentState
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 8 errors
    [javac] 39 warnings

BUILD FAILED
/usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/build.xml:439: The following error occurred while executing this line:
/usr/ports/java/java3d/work/java3d-1.5.2/j3d-core/src/classes/build.xml:102: Compile failed; see the compiler error output for details.

Total time: 8 seconds
*** Error code 1

Stop in /usr/ports/java/java3d.

Fix: 

I know very little about Java, but according to discussions on stackoverflow.com this is caused by the JDK7 compiler using a symbol table that does not include all Sun-proprietary classes. The recommended solution is to compile with -XDignore.symbol.file

I have tried adding a line "JAVAC= ${JAVAC} -XDignore.symbol.file" to the Makefile, but this does not help.
How-To-Repeat: # cd /usr/ports/java/java3d
# make
Comment 1 Stefan Walter freebsd_committer 2013-04-28 10:57:18 UTC
Hello James,

are you still seeing this problem with compiling the java/java3d port with
an up-to-date ports tree? I tried building it here, and there wasn't any
problem.

Best regards,
Stefan
Comment 2 Stefan Walter freebsd_committer 2013-04-28 10:58:20 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Take.
Comment 3 Stefan Walter freebsd_committer 2013-04-28 11:03:31 UTC
State Changed
From-To: open->feedback

Awaiting submitter's feedback.
Comment 4 Stefan Walter freebsd_committer 2013-04-28 22:36:17 UTC
State Changed
From-To: feedback->closed

Problem cannot be reproduced with the submitter, so I'm closing this PR. Can be 
re-opened in case the problem still exists.
Comment 5 piotr.smyrak 2013-05-19 17:23:39 UTC
I had the same issue on FreeBSD 8.4-pre with installed openjdk-7.21.11.

I could overcome this with a patch supplied to Debian. See here:
https://launchpad.net/ubuntu/+source/java3d/1.5.2+dfsg-8

I imported this patch and slightly modified files/patch-freebsd of the  
port,
and this made the port compile cleanly. I have attached the patch.

I'm able to successfully use cad/sweethome3d that depends on java/java3d.

-- 
  Piotr Smyrak
  piotr.smyrak@gmail.com
Comment 6 Stefan Walter freebsd_committer 2013-05-26 13:17:34 UTC
State Changed
From-To: closed->open

Reopen, as there has been additional feedback and a patch.
Comment 7 dfilter service freebsd_committer 2013-06-16 18:06:03 UTC
Author: stefan
Date: Sun Jun 16 17:05:55 2013
New Revision: 321060
URL: http://svnweb.freebsd.org/changeset/ports/321060

Log:
  - Fix build with JDK 1.7. [1]
  - Propagate Make environment to Ant to use the correct JDK and not just the one
    that Ant was built with.
  
  PR:		173505 [1]
  Submitted by:	James Raynard <james.raynard@pobox.com> [1]
  Patch by:	Piotr Smyrak <piotr.smyrak@gmail.com> [1]
  Obtained from:	https://launchpad.net/ubuntu/+source/java3d/1.5.2+dfsg-8 [1]

Added:
  head/java/java3d/files/patch-ImageComponentState.java   (contents, props changed)
Modified:
  head/java/java3d/Makefile
  head/java/java3d/files/patch-freebsd

Modified: head/java/java3d/Makefile
==============================================================================
--- head/java/java3d/Makefile	Sun Jun 16 16:59:34 2013	(r321059)
+++ head/java/java3d/Makefile	Sun Jun 16 17:05:55 2013	(r321060)
@@ -3,7 +3,7 @@
 
 PORTNAME=	java3d
 PORTVERSION=	1.5.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	java graphics games devel
 MASTER_SITES=	https://sites.google.com/site/daemonwizard/
 DISTNAME=	java3d-${PORTVERSION}
@@ -29,10 +29,17 @@ PORTDOCS=	*
 .include <bsd.port.options.mk>
 
 do-build:
-	cd ${WRKSRC}/vecmath && ${ANT} dist
-	cd ${WRKSRC}/j3d-core && ${ANT} -Dbuild.type=fcs -Dis${OPSYS}=yes -Dports.localbase=${LOCALBASE} jar-opt
+	cd ${WRKSRC}/vecmath && ${SETENV} ${MAKE_ENV} ${ANT} dist
+	cd ${WRKSRC}/j3d-core \
+		&& ${SETENV} ${MAKE_ENV} ${ANT} -Dbuild.type=fcs \
+						-Dis${OPSYS}=yes \
+						-Dports.localbase=${LOCALBASE} \
+						jar-opt
 .if ${PORT_OPTIONS:MDOCS}
-	cd ${WRKSRC}/j3d-core && ${ANT} -Dbuild.type=fcs -Dis${OPSYS}=yes docs-public
+	cd ${WRKSRC}/j3d-core \
+		&& ${SETENV} ${MAKE_ENV} ${ANT} -Dbuild.type=fcs \
+						-Dis${OPSYS}=yes \
+						docs-public
 .endif
 
 do-install:

Added: head/java/java3d/files/patch-ImageComponentState.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/java3d/files/patch-ImageComponentState.java	Sun Jun 16 17:05:55 2013	(r321060)
@@ -0,0 +1,50 @@
+work/java3d-1.5.2/j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d
+--- j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java.orig
++++ j3d-core-utils/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java
+@@ -61,10 +61,7 @@ import com.sun.j3d.utils.scenegraph.io.r
+ import com.sun.j3d.utils.scenegraph.io.retained.SGIORuntimeException;
+ import java.awt.color.ColorSpace;
+ import java.awt.image.DataBuffer;
+-import com.sun.image.codec.jpeg.JPEGImageEncoder;
+-import com.sun.image.codec.jpeg.JPEGImageDecoder;
+-import com.sun.image.codec.jpeg.JPEGCodec;
+-import com.sun.image.codec.jpeg.JPEGEncodeParam;
++import javax.imageio.ImageIO;
+ 
+ public abstract class ImageComponentState extends NodeComponentState {
+ 
+@@ -203,10 +200,9 @@ public abstract class ImageComponentStat
+     
+     private void writeBufferedImageJpegCompression( DataOutput out, BufferedImage image ) throws IOException {
+         ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+-        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( byteStream );
+-
+-        encoder.encode( image );
+-        byteStream.close();
++        if (!ImageIO.write(image, "jpeg", byteStream)) {
++            throw new AssertionError("No JPEG encoder available");
++        }
+         
+         byte[] buffer = byteStream.toByteArray();
+         out.writeInt( buffer.length );
+@@ -261,11 +257,15 @@ public abstract class ImageComponentStat
+         byte[] buffer = new byte[ size ];
+         in.readFully( buffer );
+         ByteArrayInputStream byteStream = new ByteArrayInputStream( buffer );
+-        
+-        JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( byteStream );
+-        byteStream.close();
+-        
+-        return decoder.decodeAsBufferedImage();
++        try {
++            BufferedImage img = ImageIO.read(byteStream);
++            if (img == null) {
++                throw new AssertionError("No ImageReader available.");
++            }
++            return img;
++        } finally {
++            byteStream.close();
++        }
+     }
+     
+     private void writeColorModel( DataOutput out, ColorModel colorModel ) throws IOException {

Modified: head/java/java3d/files/patch-freebsd
==============================================================================
--- head/java/java3d/files/patch-freebsd	Sun Jun 16 16:59:34 2013	(r321059)
+++ head/java/java3d/files/patch-freebsd	Sun Jun 16 17:05:55 2013	(r321060)
@@ -88,6 +88,14 @@ diff -ruN ../java3d-1.5.2/j3d-core/src/n
  	<property name="bldType" value="opt"/>
  	<property name="javahCoreSrc"     
  	 location="${src}/classes/share/javax/media/j3d"/>
+@@ -347,6 +360,7 @@
+     <javah destdir="${javahCoreTarget}" force="yes">
+ 	<classpath>
+ 	    <pathelement path="${build}/${platform}/${bldType}/classes"/>
++	    <pathelement path="${vecmath_home}/build/opt/lib/ext/vecmath.jar"/>
+ 	</classpath>
+ 	
+ 	<class name="javax.media.j3d.Background"/>
 diff -ruN ../java3d-1.5.2/j3d-core/src/native/ogl/build-freebsd.xml ./j3d-core/src/native/ogl/build-freebsd.xml
 --- ../java3d-1.5.2/j3d-core/src/native/ogl/build-freebsd.xml	1970-01-01 12:00:00.000000000 +1200
 +++ ./j3d-core/src/native/ogl/build-freebsd.xml	2009-07-12 13:21:41.000000000 +1200
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Stefan Walter freebsd_committer 2013-06-16 18:07:05 UTC
State Changed
From-To: open->closed

Patch committed, thanks! (I didn't see the problem before because Ant was always 
using the JDK 1.6 it was built with, not the JDK 1.7. Fixed with the same 
commit, too.)