Archive for September, 2011

Getting ZSNES to work on 64-bit Ubuntu

Posted in Uncategorized on September 13, 2011 by voline

So I’ve been in the process of settling in to my new 64-bit home after a recent laptop purchase. On the old laptop I infrequently played the SNES emulator ZSNES, so I tried to install it through he ubuntu package manager. It turns out its not there. But how could the venerable ZSNES project not be provided at least in universe (which I knew was enabled)? A quick google confirmed that it was in universe, but wait… there’s only a 32-bit version, not 64-bit. Now I read some more and it seems like zsnes can not be compiled for 64-bit architectures, which upon reflection makes sense because I know a bit of it is in hand optimized assembly.

Now I’m trying to take the least hackish, but also least work approach. Apparently, the 32-bit deb can be modified to lie about its architecture to fool the package manager into installing it according to this post. I’ve taken a similar approach in a previous post, but its not really a long term solution.

In theory there’s 32-bit binaries should have no problem’s running on a 64-bit machine in compatibility code. So I figured there must be a way to install the 32-bit packages via the 32-bit repositories. Basically you setup a chrooted environment for installing a base 32-bit debian system and then install the package from inside there. I copied my source.list directly to the chroot so I didn’t need to recreate it.

After installing zsnes from the chroot, I decided to give it a test run. I tried to run it from within the chroot, but zsnes kept dying saying that it could not setup the video mode. Using strace I saw a lot of failed ioctl’s to the frame buffer using the FBIOPUT_VSCREENINFO ioctl. So then I tried running from outside the chroot, but I’d get a segfault. I used ldd to verify that the binary was linking with the correct libraries (32-bit, not 64-bit), and it was. So I googled and came across a zsnes forum thread giving a solution to the problem. I slightly modified the instructions for my version of libao, which was using the plugins-4 directory. I had noticed this when perusing the strace output.

This got zsnes up an running. I’m a little curious as to why it was failing to run with in the chroot environment (the fb device was opened fine), and what could be done to get it to work. And tangentially why I wasn’t able to run x11 programs from within the chroot either.

PS: Using strace with an x11 program from in the chroot, I see that it is connecting successfully to the unix domain socket successfully, but the X server sends “No protocol specified”. Then it tried to connect to port 6000 on localhost, which fails because the X server is not configured to listen there. So far google has found some answers, but none of them work in this case. Maybe I’ll revisit this when/if I need it.