Gentoo Wiki




Basically, this HOWTO is about setting up Sun's Looking Glass 3D Desktop in Gentoo Linux. The goal of this HOWTO will not only be just a bunch of commands, but also provides just a little more background info. It can be skipped though, as you want.

Approach of this HOWTO

This HOWTO is written in the way that I'm also in the process of setting up Looking Glass on my computer. This approach is different then most HOWTO's, which are written after everything is done. Although the last way is more likely to render a success, my approach does offer a couple advantages as well; in the way of setting up the system, I probably will come across one (or more likely, several) pitfalls that I will need to resolve before continuing. This offers mostly first-hand support in this process.


Looking Glass was first developed indoors at Sun Microsystems. It was first shown at a conference in Berlin as far as I know. The reactions were so good that it suprised the Developers Team. Sun and the team made the decision to opensource Looking Glass. Things have gone fast since then. Several projects popped out of the blue, which can visited at following link.

Things to consider

Looking Glass is by no means a finished product.. Therefore, you cannot expect things from the desktop like you maybe would with other desktop environments. Looking Glass is a next gen desktop and has certain requirements before you will be able to run it. Let's take a look at following listing;

Other things that may come in handy is some experience with configuring your system, although everything listed here from commands could be defined as basic stuff.. General experience in solving your own problems is useful when you try more exotic things.

Some users report that the latest X.Org doesn't work with Looking Glass. Installing Xfree might resolve this, but as it is declared deprecated.. we'll see..

One of the best quotes I think that describes the current status is the following:

"The current iteration you are seeing is no more than proof-of-concept code. The goal is to get developers to think "what if I could ..." ~ unknown

Steps to follow

These steps are taken from the HOWTO from Prodigy44 because I'm not able to test it myself for the moment (important things that doesn't afford me to ruin my system ;-).

Make sure that you've got a Portage Overlay setup, and then download the appropriate files and place them in /usr/portage/distfiles: Though it may not be entirely a bad idea to get the Sun Download Manager first (requires RPM).

Note: If you skip this part for now (at least the jdk url version is old), emerge of the packages will tell you where to get the distfiles.
# jdk-1_5_0_04-linux-i586.bin

# Linux CLASSPATH Install
# jai-1_1_2_01-lib-linux-i586.tar.gz

# if you have updated portage recently, you may skip this
cd /usr/portage/distfiles

For more recent versions of Looking Glass, you will actually need a more recent version of java3d than the one present in Portage. Since no known overlay contains one, you will have to create manually the package for it. Here are the steps to follow:

mkdir -p /usr/local/portage/dev-java/sun-java3d-bin
cd /usr/local/portage/dev-java/sun-java3d-bin
nano -w sun-java3d-bin-1.5.0.ebuild
File: /usr/local/portage/dev-java/sun-java3d-bin/sun-java3d-bin-1.5.0.ebuild
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:  $

inherit java-pkg


        amd64? (
        x86? (
KEYWORDS="~amd64 ~x86 -*"
LICENSE="sun-jrl sun-jdl"


src_unpack() {
        unpack ${A}
        cd ${S}
        unzip -q || die

src_compile() { :; }

src_install() {
        dodoc COPYRIGHT.txt README.txt

        java-pkg_dojar lib/ext/*.jar
        java-pkg_doso lib/${ARCH/x86/i386}/*.so

pkg_postinst() {
        einfo "This ebuild installs into /opt/${PN} and /usr/share/${PN}"
        einfo 'To use you need to pass the following to java'
        einfo '-Djava.library.path=$(java-config -i sun-java3d-bin) -cp $(java-config -p sun-java3d-bin)'
ebuild sun-java3d-bin-1.5.0.ebuild digest

Then, following steps should be followed:

Warning: Don't follow these sun-jdk-1.5 unmasking steps blindly, read and follow java 1.5 faq instead!
echo "dev-java/sun-jdk" >> /etc/portage/package.unmask
echo "dev-java/sun-jdk ~x86" >> /etc/portage/package.keywords
echo dev-java/sun-java3d-bin >> /etc/portage/package.unmask
echo dev-java/sun-java3d-bin ~x86 >> /etc/portage/package.keywords
emerge -n dev-java/sun-jdk
emerge -n dev-java/sun-jai-bin
emerge -n dev-java/sun-java3d-bin
emerge -n app-shells/tcsh
emerge hsc
Note: Since the actual emerging could take over an hour you may rather do it all at once, go to bed, and play with it in the morning.

And type following commands:

mkdir -p /usr/local/portage/x11-lg3d/lookingglass
cat - >  /usr/local/portage/x11-lg3d/lookingglass/lookingglass-0.7.1.ebuild

Copy/Paste the following into that file (CTRL-D when finished):

File: /usr/local/portage/x11-lg3d/lookingglass/lookingglass-0.7.1.ebuild
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION="Looking Glass - 3D windows manager written in Java"

#dev-java/sun-java3d # does not exist jet, but dev-java/blackdown-java3d is in portage

src_install() {
   cd $P/work/
   dodir /usr/share
   cp -R lg3d ${D}/usr/share
   cd ${D}/usr/share/lg3d/bin
   dodir /bin
   echo "#!/bin/sh" >> ${D}/bin/lg3d-session
   echo "cd /usr/share/lg3d/bin" >> ${D}/bin/lg3d-dev
   echo "./lg3d-dev" >> ${D}/bin/lg3d-dev
   echo "#!/bin/sh" >> ${D}/bin/lg3d-session
   echo "cd /usr/share/lg3d/bin" >> ${D}/bin/lg3d-session
   echo "./lg3d-session" >> ${D}/bin/lg3d-session
   chmod +x ${D}/bin/lg3d-*
   dodir /etc/X11/Sessions
   dosym /bin/lg3d-session /etc/X11/Sessions/lookingglas

pkg_postinst() {
   echo ""
   echo "To run Looking Glass, the screen must be in 24-bit mode"
   echo "To run in window, run lg3d-dev"
   echo "To run as a session, run lg3d-session"
   echo ""

Let's make a new ebuild from that file, then install the ebuild and ignore warnings::

ebuild /usr/local/portage/x11-lg3d/lookingglass/lookingglass-0.7.1.ebuild digest
echo "x11-lg3d/lookingglass ~x86" >> /etc/portage/package.keywords
emerge -av x11-lg3d/lookingglass

Finally we must fix some linking problems. File /usr/share/lg3d/bin/setup is a generic setup file that is source'd at each execution of lg3d-dev and lg3d-session so we edit it with information about java3d:

echo setenv CLASSPATH \"\$\{CLASSPATH\}:\`java-config -p sun-java3d-bin\`\" >> /usr/share/lg3d/bin/setup
echo setenv LG_SETTINGS \"\$\{LG_SETTINGS\} -Djava.library.path=\`java-config -i sun-java3d-bin\`\" >> /usr/share/lg3d/bin/setup

Also check that /usr/share/lg3d/bin/check_no_x uses the correct path for the xdpyinfo program (do a whereis xdpyinfo to find its actual path). Otherwise lg3d-session will fail with an error about X being already started.

Starting Looking Glass

You have two options for starting Looking Glass. Either you fire lg3d-dev from a console to open it in window mode, or either you fire lg3d-session for fullscreen.

Be Warned

CoolAJ86: I attempted to run lg3d-dev as root (by mistake) and it only managed to put kswapd0 on the fritz and wrote garbage data to memory as fast as it could until I ran out of virtual memory and it froze the sytem - even after having killed lg3d-dev. I then tried again as a user with the same result, however, after lg3d-dev was killed the system sprung back to life. If you have a similar experience I would suggest trying out the LiveCD instead of crashing your system over and over again. :-D


Although I did my research, I must share credits. Previous (succesful) attempts were made in the forums to provide a good, working HOWTO. Various other people did as well, on other forums. That's why I want to list every single name I've seen talking about Looking Glass in any forum. This list is still incomplete, and if you think you should definitely be on the list.. contact me.

  • fedeliallalinea
  • Prodigy44
  • t0rn
  • uck2rok
  • high - updated this howto for lg3d-0.7.1


Last modified: Fri, 05 Sep 2008 11:36:00 +0000 Hits: 38,477