Native Java3D [Samples hang]

Andreas Kohn andreas.kohn at gmx.net
Fri Sep 3 02:38:19 PDT 2004


On Tue, 2004-08-31 at 23:07, Greg Lewis wrote:
> On Tue, Aug 31, 2004 at 10:52:25PM +0200, Andreas Kohn wrote:
> > On Mon, 2004-08-30 at 22:52, Greg Lewis wrote:
> > > On Mon, Aug 30, 2004 at 01:26:58PM -0600, Greg Lewis wrote:
> > > > On Mon, Aug 30, 2004 at 12:45:48PM -0600, Greg Lewis wrote:
> > > > > If anyone is interested, please grab the source code and apply the attached
> > > > > patch to the j3d-core sub-project.  Then just follow the build and use
> > > > > instructions as normal.
> > > > 
> > > > D'oh.  You also need the attached tarball unpacked in j3d-core.  These are
> > > > new files required for the build.  Sorry 'bout that...
> > > 
> > > Looks like the attachment was stripped.  You can get the diff and the
> > > tarball at
> > > 
> > > http://www.eyesbeyond.com/freebsddom/java/j3d-core.diff
> > > http://www.eyesbeyond.com/freebsddom/java/j3d-core.tar.gz
> > 
> > I can compile it without problems. But running sample applications gives
> > only a gray window.
> > 
> > I compiled vecmath, copied the jar to /usr/local/share/java/classes,
> > compiled j3d-core, copied both jar's to /usr/local/share/java/classes,
> > and the libj3dcore-ogl.so & libj3dutils.so from
> > build/freebsd-i586/opt/lib/i386 to /usr/local/lib.
> > 
> > I can see no errors when running the samples:
> > 
> > $java -cp
> > /usr/local/share/java/classes/j3dcore.jar:/usr/local/share/java/classes/j3dutils.jar:. HelloUniverse
> > 
> > Java 3D pre-release version: 1.3.2-build5-experimental 8/30/04 11:41:53
> > PM CEST
> > [program seem to hang, does not react on clicks or keypresses.]
> > 
> > 
> > The hung process is in state "RUN" according to top, it uses only
> > minimal amount of CPU. I need to kill -KILL the process to get rid of
> > it.
> > 
> > --
> > Machine information:
> > AMD Athlon 1200, 256M RAM, nVidia Geforce 2 MX (32M) with binary nvidia
> > 6113 drivers. X.Org 6.7.9.902 (compiled from sources). Two monitors
> > attached (TV-Out and CRT).
> > Direct Rendering is working, glxgears gives rotating accelerated gears.
> > A tomcat is running on the machine, no other java processes. Libmap.conf
> > maps -lpthread to -lc_r. 
> > 
> > FreeBSD klamath.ankon.de.eu.org 6.0-CURRENT FreeBSD 6.0-CURRENT #14: Mon
> > Aug 23 01:20:04 CEST 2004    
> > root at klamath.ankon.de.eu.org:/usr/obj/usr/src/sys/KLAMATH  i386
> > 
> > How can I help?
> 
> If you send it a SIGQUIT (I think) do you get a stack trace?  IIRC you can
> do this with Ctrl-\.  Alternatively, can you try running things with java_g
> under gdb and get a trace from there?
Didn't manage to get a trace with Ctrl-\. It looked like java ignored
that signal. (No reaction visible at all)
I didn't try the gdb/java_g thing, becuase I had a strong feeling the
using libpthread would perhaps work. If you like, I can try to do it.
(But read on, good things will happen)

> 
> Does using libkse change the behaviour at all?
Yes it does. With libpthread-threading (which now works after some
recompilation and the new nvidia-drivers) I have to change the command
line for running the samples to also include "vecmath.jar".

---8<---
[klamath] /storage/java3d/j3d-examples/src/HelloUniverse>java -cp
/usr/local/share/java/classes/j3dcore.jar:/usr/local/share/java/classes/j3dutils.jar:. HelloUniverse
Java 3D pre-release version: 1.3.2-build5-experimental 8/30/04 11:41:53
PM CEST

java.lang.NoClassDefFoundError: javax/vecmath/Tuple3d
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at javax.media.j3d.MasterControl.class$(Unknown Source)
        at javax.media.j3d.MasterControl.<init>(Unknown Source)
        at javax.media.j3d.VirtualUniverse.createMC(Unknown Source)
        at javax.media.j3d.VirtualUniverse.<clinit>(Unknown Source)
        at HelloUniverse.init(HelloUniverse.java:99)
        at com.sun.j3d.utils.applet.MainFrame.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:534)
-->8----

My *guess* would be that with libc_r it never came to the point of
loading vecmath-related classes. Strange.

The window still stays gray with vecmath.jar in the -cp.

*But* about 2 seconds after the window appeared, I get a Java VM fault.
See the attached log file for details.

It seems to be related to the nvidia driver, so I tried something from
the readme which helped for some linux apps. 

> export __GL_SINGLE_THREADED=1
> java -cp ... HelloUniverse

And now it worked! I saw a colored spinning cube.

So it might be good to include a pkg-message with the upcoming port to
refer people to this variable if they are using the nvidia drivers.

Here's an excerpt from nvidia's readme:

---
Known Issues: the Linux OpenGL library, when run in linux compatibility
mode on FreeBSD, may have difficulties determining if the application is
multithreaded.  As the resulting warning suggestions, it may help to set
the environment variable __GL_SINGLE_THREADED (eg: `setenv
__GL_SINGLE_THREADED 1`).  Please see the FAQ entry "Why can the Linux
compatibility libraries not correctly determine if they are used in a
multithreaded application?" for details and a better solution.
---

---
Q: Why can the Linux compatibility libraries not correctly determine if
   they are used in a multithreaded application?

A: The Linux compatibility libraries are not able to correctly determine
   if they are used in a multithreaded application because the %gs
segment
   register is not initialized correctly for Linux compatibility.

   The __GL_SINGLE_THREADED environment variable (set to "1") can be
   used to work around this issue, but at the cost of thread-safeness.
---
(the full readme is available at
http://download.nvidia.com/freebsd/1.0-6113/README.txt )


Thank you.


Best Regards,
--
Andreas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-java/attachments/20040903/4fc723ba/attachment.bin


More information about the freebsd-java mailing list