Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Feb 2008 13:52:50 -0500
From:      drgerlists@gmail.com (Dr. Gary E. RAFE)
To:        freebsd-java@freebsd.org
Subject:   Building Java3D-1.5.1 on FreeBSD 6.2-R/i386
Message-ID:  <47a60d82.0OKq/4a7ZBRRW7zg4LprbyTa@lmrmac.uhw.utoledo.edu>

next in thread | raw e-mail | index | archive | help
In case anyone else might be interested in this,
building and installing a native Java 3D is not difficult.

This procedure was developed and tested on a Toshiba Satellite Pro 6100
running FreeBSD 6.2-R, XFree86-4.7.0, NVIDIA-96.43.01 OpenGL 1.3,
JDK-1.5.0_13p7, Ant-1.6.5, and GCC-3.4.6

0. Fetch the source code from CVS at java.net (registration/login required):

   $ mkdir J3D_WRKDIR
   $ cd J3D_WRKDIR
   $ cvs -d :pserver:MYLOGIN@cvs.dev.java.net:/cvs login
   $ cvs -d :pserver:MYLOGIN@cvs.dev.java.net:/cvs checkout -r rel-1_5_1-fcs \
         j3d-core j3d-core-utils vecmath

1. Build and install vecmath package:

   $ cd vecmath
   $ ant jar-opt

   # mkdir -p /PATH_TO/java3d/lib/ext
   # cd build/opt/lib/ext
   # install -m 0644 -o root -g wheel vecmath.jar /PATH_TO/java3d/lib/ext
   # cd /PATH_TO/j2se/jre/lib/ext
   # ln -s ../../../../java3d/lib/ext/vecmath.jar vecmath.jar

2. Patch, build, and install j3d-core/j3d-utils packages and
   native OpenGL connection shared library:

   $ cd J3D_WRKDIR/j3d-core
   $ fetch http://drgerlists.googlepages.com/patches-j3dcore-151-fbsd-i386.tbz
   $ tar xjf patches-j3dcore-151-fbsd-i386.tbz
   $ patch -p0 < patches-j3d-core-1.5.1
   $ ant -Dbuild.type=fcs jar-opt

   # cd build/freebsd-i386/opt/lib/ext
   # install -m 0644 -o root -g wheel j3dcore.jar /PATH_TO/java3d/lib/ext
   # install -m 0644 -o root -g wheel j3dutils.jar /PATH_TO/java3d/lib/ext
   # cd ../i386
   # mkdir -p /PATH_TO/java3d/lib/i386
   # install -m 0755 -o root -g wheel libj3dcore-ogl.so /PATH_TO/java3d/lib/i386
   # cd /PATH_TO/j2se/jre/lib/ext
   # ln -s ../../../../java3d/lib/ext/j3dcore.jar j3dcore.jar
   # ln -s ../../../../java3d/lib/ext/j3dutils.jar j3dutils.jar
   # cd ../i386
   # ln -s ../../../../java3d/lib/ext/libj3dcore-ogl.so libj3dcore-ogl.so

Some additional observations:

Additional optimizations to the native shared library may be included
in the ANT build file J3D_WRKDIR/j3d-core/src/native/build.xml.
Check out the "value" for the property "bldFlag" under the target
"nativeSetup-opt-freebsd".  Currently, only "-O" is specified here,
though my build uses "-O2 -march=pentium4m".

The shared object libj3dcore-ogl.so is linked dynamically to libjawt.so,
which lives in JDK_HOME/jre/lib/i386/.  The shared object libjawt.so,
in turn, requires libmawt.so, which, on my system, resides in
either JDK_HOME/jre/lib/i386/headless/, .../i386/motif21/,
or .../i386/xawt/.  Perhaps a method is available to configure this
in the JRE directly -- if so, this would be useful information.
For initial testing of the j3d-example applications, I used
LD_LIBRARY_PATH=JDK_HOME/jre/lib/i386/motif21 to pick the appropriate
shared library.  Once Java 3D looked like it was working OK,
I put a symbolic link in JDK_HOME/jre/lib/i386/ to this library:
   # ln -s ./motif21/libmawt.so libmawt.so
which allows it to get picked up when testing Java 3D applets
from Firefox.

I couldn't test the Shading Language (Cg or GLSL) examples in j3d-example,
as the video device in this (old) notebook doesn't have these
capabilities.  Further research into this in NVIDIA documents
related to their FreeBSD/Linux drivers suggest that more recent
devices can do GLSL.  I'd be interested to hear about successes
in this area, when it comes time to replace this old Toshiba.

I didn't add any capability to build a distribution here
(see J3D_WRKDIR/j3d-core/build-tools/).
I expect to follow-up on this with the Java 3D project itself
to see whether they would entertain an "official" FreeBSD-x86
port/distribution.

Comments, corrections, and improvements to any of this
are encouraged and welcome.
--
Dr Gary E RAFE: drgerlists at gmail dot com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47a60d82.0OKq/4a7ZBRRW7zg4LprbyTa>