Sunday, June 22, 2014

32-bit Firefox, 32-bit Adobe Flash, and 64 bit Linux.

I'm documenting my past two days of misery and torment so that if some other poor soul needs to do Flash development on Linux, they may be able to find this and be spared. I'll minimize the ranting and focus on the solution. This is a solution for the "grey box" or "Movie not loaded..." problem in 32-bit Flash on 64 bit Debian Linux. If you want the short answer, skip to the bottom.

My day-to-day work requires that I have the debugging Flash player installed. The Adobe Flash Debug Player for Linux/NPAPI is only available in 32-bit, unlike the production player which is available in 64-bit now. It is also not available for PPAPI yet. The problem is, it's not entirely obvious how to get this working on a fresh Debian amd64 install, and it's quite possible to accidentally have all the needed dependencies.

If you DON'T have all the dependencies, the plugin will still load and be recognized by Firefox, but will fail in a peculiar way: Flash elements in pages will load up the plugin context, but not draw anything at all. You'll wind up with a corrupted buffer which doesn't properly even rerender on expose events. You can still right-click the Flash element and get a right-click menu, but it is only populated with "Movie not loaded...", "Debugger", and "Show Redraw Regions" greyed out, and "About Adobe Flash $VERSION" not greyed out.

I had a few false starts, trying to install the exact same subset of packages that were on one of my working machines to the nonworking machine, which I never got working right but likely would have resolved my problem. I also sat there for several hours pouring over strace output to isolate the point at which a system call returned differently and caused Flash to fail, though this approach also bore no fruit.

There are very few instances I could find on The Internet of the "Movie not loaded..." error, and most of them turned out to be some combination of needing to clear the cache, or just a misconfiguration of the site. The closest I could find to what seemed to be my problem was posted by this gentleman. While his problem was very different in nature, and in fact the error message that brought me there seemingly entirely irrelevant to what the problem wound up being, his mention of a library that was not listed as part of the 'ldd' output from libflashplugin.so served provided me the crucial hint I needed to continue.

After searching the output of executing 'strings' on libflashplugin.so for libraries, I came across libcurl.  As it turns out, it depends on several libraries that aren't part of its list of dynamically linked libraries, presumably because it uses dlopen/dlsym to access them. So even if 'ldd ~/.mozilla/plugins/libflashplugin.so' doesn't show any missing libraries. As the link above shows, libsasl is one of them, and as I've discovered, libcurl is one of them. In retrospect, the latter should have been obvious, as libcurl3-gnutls is listed as a dependency of the flashplugin-nonfree package in Debian.

If you run into the same problem, 'apt-get install libcurl3:i386' should set you right. I hope this saves someone out there a few days of effort and frustration. As suggested by the link above, you may find you need to install the i386 libsasl package as well.