Making Gnash: a well-deserved name?

Making Gnash: a well-deserved name?


Gnash is the Free Software Foundation’s alternative Adobe Flash player. Version 0.8 is the third alpha release, and frankly, it rocks! It is also one of the first projects to be covered by the GPLv3.

About Gnash

Some history

Originally based on GameSWF, it is a reimplementation of Macromedia/Adobe Flash version 7, with some stuff from Flash 8/9 added. It is, right now, the most advanced free software implementation of Flash. And, as a matter of fact, it actually works well in many cases.

GNASH 0.8 is out. It is officially the third alpha release of the GNU Flash player. What’s cool about it:

  • x86-32, x86-64, PPC (and others) systems are supported
  • Mozilla and Konqueror browsers both have a plugin (it follows the Netscape plugin specification, so it should work with any other compatible browser)
  • an integrated debugger has appeared in this version; you can see its output with the -v command line option for the standalone player
  • OpenGL is the preferred rendering platform (hardware acceleration supported) for desktop systems
  • it has close to full support for Flash 1 to 7, and lots of support for Flash 8.5 (Flash 9, actually)

About version 0.8 (overall, alpha 3 of Gnash)

What’s new over Gnash 0.7.2 (alpha 2):

  • it can be compiled with ffmpeg+SDL support
  • many Flash 8.5 (now called Flash 9) methods have been added (better compatibility)
  • Cygnal: a media server that can handle Flash streams (however, I can’t see if it is actually developed)

What does it mean? Well, basically, users of PPC Debian can now watch YouTube without a virtual machine :D

Jokes aside, Gnash is, right now, the best third-party Flash player and debugger one can get. Coupled with Adobe Flash’s tentative opening (the ActiveScript Virtual Machine 2.0 has actually been freed by Adobe and is now hosted by Mozilla as an ECMAScript 4.0 ongoing implementation, which should come final for Firefox 4.0) this may bring some renewal for Flash, which it needs now that Microsoft is getting serious about hijacking the Web vector authoring market with Silverlight.

Figure 1: Mozinor's 007 hijacking on YouTube on Firefox 64-bit, Sambakza's Cake Dance on the standalone player, version information in terminal window: Gnash is compiled to use OpenGL and GtkFigure 1: Mozinor's 007 hijacking on YouTube on Firefox 64-bit, Sambakza's Cake Dance on the standalone player, version information in terminal window: Gnash is compiled to use OpenGL and Gtk

What you need

Get the source

Download the latest Gnash tarball in here or you can try a CVS extract if you want the very latest version of the code (but then you probably won’t need this article) with

export CVS_RSH="ssh"

cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/gnash

co gnash

Be aware that in that case you’ll need to create ./configure yourself. I won’t cover that in this article though!

The dependencies

The following libraries and headers (more may be necessary, but those are the ones I’ve noticed as missing from my build machine) are needed; for a more complete list, merely run ./configure and check its output, missing/wrong dependencies are explicitly given with their consequences.

The most prominent dependencies are here:

  • boost 1.32+ - essential, as Gnash relies heavily on Boost
  • A media decoder’s development files: either ffmpeg + SDL 1.2 or libMAD
  • A renderer’s development files: either OpenGL, AGG (2.4+) or Cairo

What decoder should you use?

  • ffmpeg+SDL can decode both audio (mp3) and video (flv, On2) in a Flash file
  • libMAD decodes MP3 (and other formats) audio only, but it is lighter than ffmpeg

What renderer should you use?

  • OpenGL is default and hardware-accelerated (use it for casual browsing with little CPU use) - requires SDL
  • AGG is software only but more correct (best for authoring and tests, but heavy on CPU) - may use SDL or FLTK
  • Cairo can do either hardware or software rendering, but isn’t well supported (useful for integrating Gnash in Cairo applications)

And about the GUI...?

  • Gtk - required if you use Cairo, best supported option
  • GtkGlExt - required if you want to use OpenGL with Gtk. If you build with AGG or Cairo, it is unnecessary
  • SDL- recommended for sound support, and to provide a GUI (not the best option though)
  • FLTK - Fast Light ToolKit for Cairo and AGG renderers
  • KDE - may be used in place of Gtk, is required for Konqueror plugin

Other dependencies are (complete list):

  • libxml
  • wxGtkwidgets
  • atk
  • JPEG
  • Glib
  • curl
  • pango
  • libcurl
  • dejagnu (for debugging)
  • Ming (for test suite)
  • MTASC (for test suite)
  • swfmill (for test suite)

Since I want to meet a very selfish goal, that of having a standalone player and a video-enabled Firefox plugin without debugger, I built the player with the following options:

./configure --disable-debugger --enable-media=ffmpeg

However, due to my use of a Mandriva 64-bit system, it choked on the 32/64 bit OpenGL dual installation. Thus I first tried pointing configure towards /usr/lib64 with

--with-opengl-lib=/usr/lib64

without success. Then I tried

LDFLAGS="-L/usr/lib64"

which should force ld into looking for all libraries and headers in a single directory. It didn’t work either.

So I moved those offending files away and restarted make which resumed from the point it choked on before.

The next step is building Gnash; when configure is successful, it requires a simple make.

The build takes a little while, depending on how fast your system is. If you want to build the test suite too, type: make test

You’d better enable the debugger for such a build. Once all is done, just type (as root) make install.

Please note that this will put the Firefox plugin in an invalid location (such as root's local Firefox directory); you may prefer putting it somewhere else, so that every account on your system can reach it, or merely create symbolic links in user accounts’ local firefox settings.

Personally I put it in /usr/lib64/mozilla/plugins.

Conclusion

Rejoice AMD64 and PPC owners! If you didn’t want to switch to GNU/Linux full-time because you missed your daily shot of YouTube, now you can have your cake and eat it too.

Bibliography

GNASH Development site

GNASH at GNU’s Savannah

GNASH at the GNU project

Category: 

Comments

Andrew Min's picture
Submitted by Andrew Min on

Great article!

Just a note: Gnash is in the Ubuntu repos for AMD64, I386, and PowerPC. Unfortunately, only Gutsy users can use 0.8. Debian has it as unstable for a lot more platforms, but it's only 0.7. There are also 0.7 RPMs available.

--
Andrew Min
http://andrew.timstown.net/dock.htm

Anonymous visitor's picture
Submitted by Anonymous visitor (not verified) on

Hmm,

So I'm very interested in trying Gnash out and seeing how well it works and following the progress. However, my siblings play flash games all the time and I occasionally need to use flash for things. So, I can't remove or break Adobe's flash on my computer. Sadly. :(

Is there a way to have both Gnash and Adobe's player installed (or maybe having the former installed as a user) and be able to easily switch between the two plugins? Preferably on a per-user basis so that other accounts are not effected.

Thanks!

Mitch Meyran's picture

you merely need to install the plugins locally:
Adobe Flash plugin:
~/.mozilla/plugins/flashplayerplugin.so
Gnash plugin (other user):
~/.mozilla/plugins/libgnashplugin.so

That should do the trick.
---
A computer is like air conditioning: it becomes useless when you open windows.

Terry Hancock's picture

Wouldn't that mean that "it's such a frustrating program, you would gnash your teeth and wail while attempting to use it"!?

Hopefully, it doesn't deserve that kind of name!

:-)

Seriously, though, I'm happy to know that it is doing so well. The appearance of free tools for flash generation and viewing make the technology much more interesting to me now. I might actually stop boycotting flash websites. :-)

The news about Adobe opening up their flash runtime is interesting, too. Though, somehow, I get a certain irritation from hearing about lots of work going into a free, from-scratch implementation of something, and then, just when it's getting good, the commercial one is freed and somehow automatically trumps the free code. I mean, it makes practical sense, but there's something bad for the spirit about it.

Mitch Meyran's picture

They may have considered it more sensible than maintaining two implementations of ECMAscript in parallel: I mean, since they are using Kscript (modified) which is under the GPL in Safari, the different licensing forced them into maintaining both repositories, for what is essentially the same language, completely separated.
If you consider that Adobe has decided to enter the browser market (Safari 3 beta is available on Windows, and parts of it are already widely used in iTunes), it does make sense that they'd consolidate their code bases and licensing - by freeing ActionScript 2.0 (now Tamarin), they can now merge it with Kscript (or suppress Kscript completely), by making the Mozilla Foundation the host for Tamarin they ensure some recognition for the engine by the heirs of Javascript's inventor (Netscape), essentially doing this consolidates the Free Javascript market (using Tamarin in Konqueror?). As a small-time JS coder, I must say that the less different versions, the better.
Now GNU can keep their own JSVM, or decide to scrap it altogether and use Tamarin; they feel like doing the former, that's the power of Free software. Who knows, their implementation may end up being better than the original...
---
A computer is like air conditioning: it becomes useless when you open windows.

Minthos's picture
Submitted by Minthos (not verified) on

To me, the name signifies the end of gnashing my teeth over Adobe's linux-unfriendly implementation.

rekaya's picture
Submitted by rekaya on

There is an existing issue that the Adobe flash will not utilize in Apple products. Why won't Apple want to do something that many of its consumers want? Well according to Apple adobe flash crashes OS systems too often to put into their products. They also feel how the flash player has an excessive amount of potential to deplete the batteries to their gadgets quiet easily; and will wear down their batteries life span. I can't figure out if Apple is just trying to prove a point and stand by their values, or if they really want to give their buyers the very best products available. I will leave that for you to determine.

Author information

Mitch Meyran's picture

Biography

Have you ever fixed a computer with a hammer, glue and a soldering iron? Why not? It's fun!