From owner-freebsd-java@FreeBSD.ORG Fri Sep 3 09:38:19 2004 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D0D616A4CE for ; Fri, 3 Sep 2004 09:38:19 +0000 (GMT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 4993743D1F for ; Fri, 3 Sep 2004 09:38:18 +0000 (GMT) (envelope-from andreas.kohn@gmx.net) Received: (qmail 7243 invoked by uid 65534); 3 Sep 2004 09:38:16 -0000 Received: from unknown (EHLO [212.204.44.203]) (212.204.44.203) by mail.gmx.net (mp019) with SMTP; 03 Sep 2004 11:38:16 +0200 X-Authenticated: #2431876 From: Andreas Kohn To: Greg Lewis In-Reply-To: <20040831210718.GA78658@misty.eyesbeyond.com> References: <20040830184548.GA51796@misty.eyesbeyond.com> <20040830192658.GA52365@misty.eyesbeyond.com> <20040830205214.GA53027@misty.eyesbeyond.com> <1093985545.58059.14.camel@klamath.ankon.de.eu.org> <20040831210718.GA78658@misty.eyesbeyond.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-BBWRroCXx/aPEoSBSoZQ" Message-Id: <1094204294.1062.23.camel@klamath.ankon.de.eu.org> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 03 Sep 2004 11:38:14 +0200 cc: freebsd-java@freebsd.org Subject: Re: Native Java3D [Samples hang] X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2004 09:38:19 -0000 --=-BBWRroCXx/aPEoSBSoZQ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 th= e attached > > > > > patch to the j3d-core sub-project. Then just follow the build an= d use > > > > > instructions as normal. > > > >=20 > > > > D'oh. You also need the attached tarball unpacked in j3d-core. Th= ese are > > > > new files required for the build. Sorry 'bout that... > > >=20 > > > Looks like the attachment was stripped. You can get the diff and the > > > tarball at > > >=20 > > > http://www.eyesbeyond.com/freebsddom/java/j3d-core.diff > > > http://www.eyesbeyond.com/freebsddom/java/j3d-core.tar.gz > >=20 > > I can compile it without problems. But running sample applications give= s > > only a gray window. > >=20 > > 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. > >=20 > > I can see no errors when running the samples: > >=20 > > $java -cp > > /usr/local/share/java/classes/j3dcore.jar:/usr/local/share/java/classes= /j3dutils.jar:. HelloUniverse > >=20 > > 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.] > >=20 > >=20 > > 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. > >=20 > > -- > > 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.con= f > > maps -lpthread to -lc_r.=20 > >=20 > > FreeBSD klamath.ankon.de.eu.org 6.0-CURRENT FreeBSD 6.0-CURRENT #14: Mo= n > > Aug 23 01:20:04 CEST 2004 =20 > > root@klamath.ankon.de.eu.org:/usr/obj/usr/src/sys/KLAMATH i386 > >=20 > > How can I help? >=20 > If you send it a SIGQUIT (I think) do you get a stack trace? IIRC you ca= n > 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) >=20 > 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/j3d= utils.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.(Unknown Source) at javax.media.j3d.VirtualUniverse.createMC(Unknown Source) at javax.media.j3d.VirtualUniverse.(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.=20 > export __GL_SINGLE_THREADED=3D1 > 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 --=-BBWRroCXx/aPEoSBSoZQ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBBODuFYucd7Ow1ygwRAqueAJ41W7FRFX7o5Hcma/okC0UFWS4tyQCdFtn2 qikoMpYyKowZSbyF+6RyOCw= =22pd -----END PGP SIGNATURE----- --=-BBWRroCXx/aPEoSBSoZQ--