June 3, 2007

FreeBSD Firefox Flash Java

I’ve tried to get Flash working with Firefox on FreeBSD a number of times, but haven’t been able to get it just right until recently.

I’m using,
FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006
with
firefox-2.0_2,1.

The following worked for me (Thanks to a post from Lluis López: here).

1. First install linuxpluginwrapper from the ports tree:

cd usr/ports/www/linuxpluginwrapper
make
make install
make clean

2. Now go to /usr/src and get this patch and patch

cd /usr/src
patch < /home/work/rtld_dlsym_hack.diff
cd libexec/rtld-elf
make clean
make
make install

Substitute the correct path above !! (I downloaded the patch to /home/work/).

This assumes you have sources installed. If the tree under /usr/src is empty, then

sysinstall

[configure >> distributions >> src >> all ]

See The FreeBSD handbook if you’ve forgotten how to use sysinstall.

3. Install linux-flashplugin7

cd /usr/ports/www/linux-flashplugin7
make
make install
make clean

4. Copy /usr/local/share/examples/linuxpluginwrapper/libmap.conf-FreeBSD6 to /etc/libmap.conf

cp /usr/local/share/examples/linuxpluginwrapper/libmap.conf-FreeBSD6 /etc/libmap.conf

No need to edit /etc/libmap.conf.

5. Add symlinks in /usr/local/lib/browser_plugins to libflashplayer.so and flashplayer.xpt to

cd /usr/local/lib/browser_plugins
ln -s /usr/X11R6/lib/linux-mozilla/plugins/libflashplayer.so .
ln -s /usr/X11R6/lib/linux-mozilla/plugins/flashplayer.xpt .

6. Restart your browser, and navigate to about:plugins, you should see shockwave_flash listed:

Shockwave Flash

File name:
libflashplayer.so
Shockwave Flash 7.0 r69
MIME Type Description Suffixes Enabled
application/x-shockwave-flash Shockwave Flash swf Yes
application/futuresplash FutureSplash Player spl Yes

7. Install javavmwrapper

Before we can install Java (I’m using the diablo-jdk from the FreeBSD Foundation in this example) we need to install javavmwrapper from ports.

cd /usr/ports/java/javavmwrapper/
make
make install
make clean

8. Now we can install Java. Download the appropriate JDK package from The FreeBSD foundation and simply issue a pkg_add.

In my case,

pkg_add diablo-jdk-freebsd6.i386.1.5.0.07.01.tbz

8. We need to add a symlink in /usr/local/lib/browser to /usr/local/diablo-jdk1.5.0/jre/plugin/i386/ns7/libjavaplugin_oji.so

cd /usr/local/lib/browser_plugins
ln -s /usr/local/diablo-jdk1.5.0/jre/plugin/i386/ns7/libjavaplugin_oji.so .

9. Restart your browser and navigate to about:plugins you should see

Java(TM) Plug-in diablo-1.5.0-b01

File name:

libjavaplugin_oji.so

Java(TM) Plug-in 1.5.0
MIME Type Description Suffixes Enabled
application/x-java-vm Java Yes
application/x-java-applet Java Yes
application/x-java-applet;version=1.1 Java Yes
application/x-java-applet;version=1.1.1 Java Yes
application/x-java-applet;version=1.1.2 Java Yes
… snipped …
application/x-java-bean;jpi-version=1.5 Java Yes


I tested the Java install by trying the Rubik’s Cube Java Applet. It worked without problems.

Verifiying the Java installation at Sun’s site gives a (soft) error:

Oops! You don’t have the recommended Java installed.
Your Java version is 1.5.0. Please click the button below to get the recommended Java for your computer.

It does however verify that Java version 1.5.0 is installed.


Addendum: An alternative way to install Flash for Firefox, that bypasses the Linux compatibility layer altogether is to use the GNU Flash movie playergnash.

cd /usr/ports/graphics/gnash/
make
make install
make clean

Thanks to Matteo at Matteo’s Wasps’ Nest for this one. See his post for more details.