ZSNES + AMD64 + Debian + OpenGL = troubles?!

ZSNES is a GPL licensed emulator of the Super Famicom and Super Nintendo Entertainment System (SNES) video game systems. Large part of ZSNES is written in assembly. Fortunately it works under GNU/Linux. Debian has a zsnes package, but unfortunately only for i386. Binary package is not available for AMD64. So? Lets build one!

Single look at BTS reveal patch for building on AMD64 (bug #402104). There is another bug that prevent any builds (bug #459033) and it is related to RTTI. All those problem (and other minor issues) are fixed in package I have prepared.

Here comes installation instruction.

Download sources:

$ dget http://www.burghardt.pl/debian/zsnes_1.510-1.2.dsc

Unpack them:

$ dpkg-source -x zsnes_1.510-1.2.dsc

Go to zsnes-1.510 directory:

$ cd zsnes-1.510

Install dependences:

# apt-get build-dep zsnes

Build:

$ dpkg-buildpackage

Install:

# dpkg -i zsnes_1.510-1.2_amd64.deb

Now we are ready to run it. Beware software (“indirect”) rendering in OpenGL. It is a common problem with mixed 32/64-bit systems. Set environment variable LIBGL_DEBUG to verbose and run zsnes.

$ export LIBGL_DEBUG=verbose
$ zsnes

If you see error message like:

libGL error: dlopen /usr/lib/dri/r200_dri.so failed (/usr/lib/dri/r200_dri.so: wrong ELF class: ELFCLASS64)

Try to set LIBGL_DRIVERS_PATH:

$ export LIBGL_DEBUG=verbose
$ export LIBGL_DRIVERS_PATH=/emul/ia32-linux/usr/lib/dri
$ zsnes

Error should disappear and ZSNES should use OpenGL hardware rendering. Enjoy best SNES emulator on best PC architecture!

10 thoughts on “ZSNES + AMD64 + Debian + OpenGL = troubles?!”

  1. YEEEEEEEEEEE! You rule bro. GOD SAVE THE SNES. Great tutorial hey!

    I’m running AMD X2 3800-Gigabyte GAM55S-S3/ATI Radeon X550 (256 DDR)/2GB DDR II 800/Logitech Precision gamepad.

    I got zsnes to work in my Debian (Etch) following your guide and I had to even go through the fix. I think everyting went OK. I’m having quite a few issues though. Sound is never without a very naughty grrrrrrrrrrrrrrrrrrrrrrr so I went through every possibility between the available sound options inside the zsnes to get rid of it somehow. But I just couldn’t. The other issue is with video conf, I can’t play at 1280×1024 F coz it blacks out my screen and there’s no way I can go back from there to reboot safely or whatever.

    You must understand a lot more than I do…so the question is…

    How would you address those in this given scenario?

  2. Build problems here:

    checking for sdl-config… /usr/bin/sdl-config
    checking for SDL – version >= 1.2.0… no
    *** Could not run SDL test program, checking why…
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means SDL was incorrectly installed
    *** or that you have moved SDL since it was installed. In the latter case, you
    *** may want to edit the sdl-config script: /usr/bin/sdl-config
    configure: error: SDL >= 1.2.0 is required

    It complains about libsdl, but it is installed:

    >/usr/bin/sdl-config –version
    1.2.12

    I’m clueless in this situation. Any ideas?

  3. I’m getting the same error as daisqb. I also have SDL version 1.2.12 installed. Here’s the part of config.log which contains some details about the error:

    configure:3497: checking for sdl-config
    configure:3515: found /usr/bin/sdl-config
    configure:3528: result: /usr/bin/sdl-config
    configure:3537: checking for SDL – version >= 1.2.0
    configure:3634: gcc -o conftest -m32 -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -L../lib -L/usr/local/lib -L/usr/lib conftest.c -L/usr/lib -lSDL >&5
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: cannot find -lSDL
    collect2: ld returned 1 exit status
    configure:3637: $? = 1
    configure: program exited with status 1
    configure: failed program was:
    | /* confdefs.h. */
    | #define PACKAGE_NAME “”
    | #define PACKAGE_TARNAME “”
    | #define PACKAGE_VERSION “”
    | #define PACKAGE_STRING “”
    | #define PACKAGE_BUGREPORT “”
    | /* end confdefs.h. */
    |
    | #include
    | #include
    | #include
    | #include “SDL.h”
    |
    | char*
    | my_strdup (char *str)
    | {
    | char *new_str;
    |
    | if (str)
    | {
    | new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
    | strcpy (new_str, str);
    | }
    | else
    | new_str = NULL;
    |
    | return new_str;
    | }
    |
    | int main (int argc, char *argv[])
    | {
    | int major, minor, micro;
    | char *tmp_version;
    |
    | /* This hangs on some systems (?)
    | system (“touch conf.sdltest”);
    | */
    | { FILE *fp = fopen(“conf.sdltest”, “a”); if ( fp ) fclose(fp); }
    |
    | /* HP/UX 9 (%@#!) writes to sscanf strings */
    | tmp_version = my_strdup(“1.2.0”);
    | if (sscanf(tmp_version, “%d.%d.%d”, &major, &minor, &micro) != 3) {
    | printf(“%s, bad version string\n”, “1.2.0”);
    | exit(1);
    | }
    |
    | if ((1 > major) ||
    | ((1 == major) && (2 > minor)) ||
    | ((1 == major) && (2 == minor) && (12 >= micro)))
    | {
    | return 0;
    | }
    | else
    | {
    | printf(“\n*** ‘sdl-config –version’ returned %d.%d.%d, but the minimum version\n”, 1, 2, 12);
    | printf(“*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n”, major, minor, micro);
    | printf(“*** best to upgrade to the required version.\n”);
    | printf(“*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n”);
    | printf(“*** to point to the correct copy of sdl-config, and remove the file\n”);
    | printf(“*** config.cache before re-running configure\n”);
    | return 1;
    | }
    | }
    |
    |
    configure:3671: result: no
    configure:3715: gcc -o conftest -m32 -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -L../lib -L/usr/local/lib -L/usr/lib conftest.c -L/usr/lib -lSDL >&5
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
    /usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
    /usr/bin/ld: cannot find -lSDL
    collect2: ld returned 1 exit status
    configure:3721: $? = 1
    configure: failed program was:
    | /* confdefs.h. */
    | #define PACKAGE_NAME “”
    | #define PACKAGE_TARNAME “”
    | #define PACKAGE_VERSION “”
    | #define PACKAGE_STRING “”
    | #define PACKAGE_BUGREPORT “”
    | /* end confdefs.h. */
    |
    | #include
    | #include “SDL.h”
    |
    | int main(int argc, char *argv[])
    | { return 0; }
    | #undef main
    | #define main K_and_R_C_main
    |
    | int
    | main ()
    | {
    | return 0;
    | ;
    | return 0;
    | }
    configure:3755: error: SDL >= 1.2.0 is required

  4. Same issue as HK-47 daisqb: configure is complaining about incompatible libsdl. Have you got some idea how to fix this? A manually run configure does not complain by the way.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.