Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Adobe flash browser plugin under qemu
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 96
Location: Wenatchee, WA

PostPosted: Mon Mar 28, 2011 11:47 am    Post subject: Adobe flash browser plugin under qemu Reply with quote

So a while ago I decided to explore the feasibility of running adobe's flash browser plugin on Gentoo/PPC under Qemu usermode. I was surprised nspluginwrapper already supported PPC using Qemu. Using one or two Google links, I set out for adventure. I'm putting this post online to both inform others and remind myself exactly what I did.

This is a work in progress -- I have not yet been entirely successful. Also, the paths are not formatted nicely for simple copy/paste of commands. You have to know somewhat what you're doing and adapt things for your own system.

First, Qemu needed installing. The portage situation with qemu was baffling. I opted to avoid that entirely and simply download the source from qemu.org. However, version 14.0 ended up being broken in regard to usermode path prefixing, and i686 executables would try to load libs from /lib or /usr/lib instead of /usr/gnemul/qemu-i386/lib. There wasn't much feedback on what was going on with that; qemu would appear to halt until the process allocated too much memory and died. The latest git sources worked like a charm, though.

Next, I installed nspluginwrapper. The www-plugins/nspluginwrapper ebuilds are not ppc keyworded at all so again I pulled the source (version 1.3.0 in this case) and compiled it myself. Not really sure why it lacks at least a ~ppc keyword; someone should file a keyword request bug when it's not 3:43 in the morning. ;) edit: /usr/local/lib/nspluginwrapper/i386/linux/{libnoxshm.so,libxpcom.so,npviewer.bin} all need to be compiled for x86. I accomplished this by compiling nspluginwrapper on an x86 without installing it, then manually copying libnoxshm.so, libxpcom.so, and npviewer.bin from the build directory to the PPC.

Now to cobble together shared libraries required by libflashplayer.so from a handy x86 system:
Code:
readelf -d /usr/gnemul/qemu-i386/browser-plugins/libflashplayer.so | grep 'Shared library'

Walking the dependency tree took a bit of time, so here's what I came up with:
Code:
dobbs@vertigo /usr/gnemul/qemu-i386 $ ls -R
.:
browser-plugins  lib

./browser-plugins:
libflashplayer.so

./lib:
ld-linux.so.2              libgobject-2.0.so.0     libSM.so.6
libatk-1.0.so.0            libgthread-2.0.so.0     libssl3.so
libcairo.so.2              libgtk-x11-2.0.so.0     libuuid.so.1
libcanberra-gtk-module.so  libICE.so.6             libX11.so.6
libc.so.6                  libm.so.6               libXau.so.6
libdirect-1.4.so.5         libnspr4.so             libxcb.so.1
libdirectfb-1.4.so.5       libnss3.so              libXcomposite.so.1
libdl.so.2                 libnssutil3.so          libXcursor.so.1
libexpat.so.1              libpango-1.0.so.0       libXdamage.so.1
libfontconfig.so.1         libpangocairo-1.0.so.0  libXdmcp.so.6
libfreetype.so.6           libpangoft2-1.0.so.0    libXext.so.6
libfusion-1.4.so.5         libpixman-1.so.0        libXfixes.so.3
libgcc_s.so.1              libplc4.so              libXi.so.6
libgdk_pixbuf-2.0.so.0     libplds4.so             libXrandr.so.2
libgdk-x11-2.0.so.0        libpng14.so.14          libXrender.so.1
libgio-2.0.so.0            libpthread.so.0         libXt.so.6
libglib-2.0.so.0           libresolv.so.2          libz.so.1
libgmodule-2.0.so.0        librt.so.1
libgnomebreakpad.so        libsmime3.so


And finally install the nspluginwrapped flash plugin to Firefox:
Code:
/usr/local/lib/nspluginwrapper/ppc/linux/npconfig -v -i /usr/gnemul/qemu-i386/browser-plugins/libflashplayer.so

Fire up Firefox and browse to about:plugins to verify everything went smoothly.

Now you you're all set to browse to your favorite flash site and watch it spin and crash, because at this point it starts linking to GTK libs using absolute paths or something. I dunno how that works, but it keeps trying to load GTK engine libs not referenced in the .so ELF headers. Copying an x86 branch of /usr/lib/gtk-2.0/ into /usr/gnemul/qemu-i386/ doesn't help either; it still loads the PPC libs. Something to do with GTK engine preferences maybe?

I believe an x86 chroot would work here, but the time and space needed to compile a non-native chroot discourages me. Perhaps a static version of these libs would work as well. Or maybe even tweaking USE flags on the x86 system. note: If a full chroot is to be used, the qemu-user executable needs to be statically compiled and placed within the chroot (see online guides for chrooting qemu-user with binfmt).

It's probably a good idea to not leave the plugin active in Firefox all the time. To remove:
Code:
/usr/lib/nspluginwrapper/ppc/linux/npconfig -r ~/.mozilla/plugins/npwrapper.libflashplayer.so


As always, comments are welcome and encouraged. :)
Back to top
View user's profile Send private message
JoseJX
Developer
Developer


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Tue Mar 29, 2011 2:23 pm    Post subject: Reply with quote

That's ... ambitious! Good luck and let us know how it goes!
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 96
Location: Wenatchee, WA

PostPosted: Wed Mar 30, 2011 8:00 am    Post subject: Reply with quote

I solved the GTK issues by adding the GTK_PATH variable to /usr/local/lib/nspluginwrapper/i386/linux/npviewer:
Code:
#!/bin/sh
TARGET_OS=linux
TARGET_ARCH=i386
export GTK_PATH="/usr/gnemul/qemu-i386/lib/gtk-2.0"
. /usr/local/lib/nspluginwrapper/noarch/npviewer.sh

And of course included the libraries it kept referencing. My gnemul tree now looks like:
Code:
dobbs@vertigo /usr/gnemul/qemu-i386 $ ls -RF /usr/gnemul/qemu-i386/
/usr/gnemul/qemu-i386/:
browser-plugins/  lib/

/usr/gnemul/qemu-i386/browser-plugins:
libflashplayer.so

/usr/gnemul/qemu-i386/lib:
gtk-2.0/                 libgthread-2.0.so.0*     libssl3.so*
ld-linux.so.2*           libgtk-x11-2.0.so.0*     libstdc++.so.6*
libatk-1.0.so.0*         libICE.so.6*             libuuid.so.1*
libcairo.so.2*           libltdl.so.7*            libvorbisfile.so.3*
libcanberra-gtk.so.0*    libm.so.6*               libvorbis.so.0*
libcanberra.so.0*        libnspr4.so*             libX11.so.6*
libc.so.6*               libnss3.so*              libXau.so.6*
libcurl.so*              libnssutil3.so*          libxcb.so.1*
libdl.so.2*              libogg.so.0*             libXcomposite.so.1*
libelf.so.1*             libpango-1.0.so.0*       libXcursor.so.1*
libexpat.so.1*           libpangocairo-1.0.so.0*  libXdamage.so.1*
libfontconfig.so.1*      libpangoft2-1.0.so.0*    libXdmcp.so.6*
libfreetype.so.6*        libpixman-1.so.0*        libXext.so.6*
libgailutil.so.18*       libplc4.so*              libXfixes.so.3*
libgcc_s.so.1            libplds4.so*             libXi.so.6*
libgdk_pixbuf-2.0.so.0*  libpng14.so.14*          libXrandr.so.2*
libgdk-x11-2.0.so.0*     libpthread.so.0*         libXrender.so.1*
libgio-2.0.so.0*         libresolv.so.2*          libXt.so.6*
libglib-2.0.so.0*        librt.so.1*              libz.so.1*
libgmodule-2.0.so.0*     libsmime3.so*
libgobject-2.0.so.0*     libSM.so.6*

/usr/gnemul/qemu-i386/lib/gtk-2.0:
2.10.0/  include/  modules/

/usr/gnemul/qemu-i386/lib/gtk-2.0/2.10.0:
engines/  immodules/  printbackends/

/usr/gnemul/qemu-i386/lib/gtk-2.0/2.10.0/engines:
libclearlooks.so*   libglide.so*       libmist.so*    libredmond95.so*
libcrux-engine.so*  libindustrial.so*  libpixmap.so*  libthinice.so*

/usr/gnemul/qemu-i386/lib/gtk-2.0/2.10.0/immodules:
im-am-et.so*              im-inuktitut.so*   im-thai.so*   im-viqr.so*
im-cedilla.so*            im-ipa.so*         im-ti-er.so*  im-xim.so*
im-cyrillic-translit.so*  im-multipress.so*  im-ti-et.so*

/usr/gnemul/qemu-i386/lib/gtk-2.0/2.10.0/printbackends:
libprintbackend-file.so*  libprintbackend-lpr.so*

/usr/gnemul/qemu-i386/lib/gtk-2.0/include:
gdkconfig.h

/usr/gnemul/qemu-i386/lib/gtk-2.0/modules:
libcanberra-gtk-module.la*  libferret.so*  libgnomebreakpad.la*
libcanberra-gtk-module.so*  libgail.so*    libgnomebreakpad.so*


This doesn't really improve Firefox's behavior when browsing to a flash site -- it still spins. I'll let it run overnight to see what all it does, but for now, its output is thus:
Code:
dobbs@vertigo ~/qemu $ firefox
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240

(process:6653): Gtk-WARNING **: Locale not supported by C library.
   Using the fallback 'C' locale.

(npviewer.bin:6653): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (1000)
Adobe Flash Player error: could not load cURL library
*** NSPlugin Viewer  *** WARNING: unhandled variable 18 (<unknown variable>) in NPN_GetValue()
*** NSPlugin Wrapper *** ERROR: NPP_GetValue() wait for reply: Message timeout
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:1927):invoke_NPP_SetWindow: assertion failed: (rpc_method_invoke_possible(plugin->connection))
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:1858):invoke_NPP_Destroy: assertion failed: (rpc_method_invoke_possible(plugin->connection))
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240

(process:6676): Gtk-WARNING **: Locale not supported by C library.
   Using the fallback 'C' locale.

(npviewer.bin:6676): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (1000)
Adobe Flash Player error: could not load cURL library
*** NSPlugin Viewer  *** WARNING: unhandled variable 18 (<unknown variable>) in NPN_GetValue()
*** NSPlugin Wrapper *** ERROR: NPP_GetValue() wait for reply: Message timeout
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:1927):invoke_NPP_SetWindow: assertion failed: (rpc_method_invoke_possible(plugin->connection))
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:2167):invoke_NPP_NewStream: assertion failed: (rpc_method_invoke_possible(plugin->connection))

The locale warning is due to the absolute bare-bones chroot I built the libraries in; I didn't bother to set up the locale. Not one of my greater worries at the moment. ;)

As can be seen in the above filesystem, I included libcurls as well, but the flash plugin still complains. The various straces I've run show no attempt to load that particular module either. No ideas on that error.

The rpc_method_invoke_possible warnings look interesting, but I don't know anything about those functions. Anyone else have any ideas?

Beyond that, I'm pouring over strace logs without much success. A bit of a needle-in-a-haystack situation. Spirits are low; heading to sleep. Tomorrow I'll try playing a locally stored swf file to remove Firefox from the debugging equation.
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 96
Location: Wenatchee, WA

PostPosted: Thu Mar 31, 2011 3:47 am    Post subject: Reply with quote

Ok... I left it running and when I came back I had a FlashBlock icon. Doh. :) However, Firefox does eventually begin responding again. nspluginwrapper restarts a couple times, but eventually exits and control is returned to Firefox. Loading a local swf file illustrates this more quickly than a complex site such as YouTube, though the results are (eventually) the same.

Running npplayer on the command line brings up a blank window, runs qemu for a bit, then exits:
Code:
dobbs@vertigo ~/qemu $ npplayer SRC="foo.swf"
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240
qemu: Unsupported syscall: 240

(process:25166): Gtk-WARNING **: Locale not supported by C library.
   Using the fallback 'C' locale.

(npviewer.bin:25166): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (1000)
Adobe Flash Player error: could not load cURL library
*** NSPlugin Player  *** WARNING: unhandled variable 15 in NPN_GetValue()
*** NSPlugin Player  *** WARNING: unhandled variable 15 in NPN_GetValue()
*** NSPlugin Viewer  *** WARNING: unhandled variable 18 (<unknown variable>) in NPN_GetValue()
*** NSPlugin Wrapper *** ERROR: NPP_NewStream() wait for reply: Message timeout
*** NSPlugin Player  *** ERROR: could not create NPP stream from 'file:///home/dobbs/qemu/foo.swf'
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:1927):invoke_NPP_SetWindow: assertion failed: (rpc_method_invoke_possible(plugin->connection))
*** NSPlugin Wrapper *** WARNING:(/home/dobbs/qemu/nspluginwrapper-1.3.0/src/npw-wrapper.c:1858):invoke_NPP_Destroy: assertion failed: (rpc_method_invoke_possible(plugin->connection))
dobbs@vertigo ~/qemu $
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 96
Location: Wenatchee, WA

PostPosted: Sat Apr 16, 2011 2:01 pm    Post subject: Reply with quote

EDIT: I should warn that this post is rife with uninformed speculation and (very) late-night ramblings. I refuse to be held responsible for any damages, brain or otherwise. :P

Yeah, I haven't done much with this recently, but I wanted to give a parting (for now) comment.

That flash results in a black window/box and no real graphics output left me feeling that libraries running under Qemu (i.e. libX11) are segregated from accessing graphics. Like... the flash plugin is actually drawing, but to a virtual surface I can't see while the real one remains blank. That doesn't make much sense, and there's evidence against it, but dropping the idea is proving difficult. It's probably not drawing at all, but failing when trying to initialize X things. This whole paragraph illustrates how little I understand about interaction between dynamically linked libraries. It's entirely possible the emulation is just too slow.

My ultimate wish is a set of libraries bridging the platform barrier. Meaning native libraries that can be linked to by libflashplayer.so. Sort of a translation layer at the dynamic linking stage. The libraries would need only to mangle data structures and endianness, then pass on the call to a native library. As discussed on the qemu-devel list (a few times actually), this is "complicated" and unlikely to happen, yet the wish remains. And after all, this is exactly what nsluginwrapper does (albeit with a trivial case). Some sort of framework (cataloguing library data structures, calls, dependencies...) to facilitate creating these bridging libraries would be invaluable to usermode emulation. Ah, to dream. :)

Another fun thought experiment is to consider network abstraction: run the flash code on native hardware but link the graphics over an X or RPC network connection. Some issues would be user interface latency and audio transport & synchronization (X does not handle audio at all, no?). Might be faster than emulation, though.

Something that may actually see progress is porting lightspark. Reports of a PPC porting effort exist, but are spotty and uninformative at best.

Maybe I'll come back to this in a few years and try it with a full emulated chroot that more closely mirrors my native environment. Or maybe I won't. :P
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3744

PostPosted: Mon Apr 18, 2011 7:27 am    Post subject: Reply with quote

lightspark is supposed to work already on ppc, but it didnt work for me on my pb. I have been following it for a while and there is f.ex. no altivec support ( yet) IIRC.

cheers
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum