xyproto / zsnes

A maintained fork of ZSNES, a Super Nintendo emulator. The original project needs patches to build and is not maintained anymore: https://sourceforge.net/projects/zsnes/

Home Page:https://zsnes.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support building on Ubuntu

jeffythedragonslayer opened this issue · comments

I have already installed gcc-multilib, g++-multilib, and lib32z1-dev, but I am still getting:

/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.a when searching for -lX11
/usr/bin/ld: cannot find -lX11: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.a when searching for -lSDL
/usr/bin/ld: cannot find -lSDL: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.a when searching for -lpng16
/usr/bin/ld: cannot find -lpng16: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng16.so when searching for -lpng16
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libGL.so when searching for -lGL
collect2: error: ld returned 1 exit status
make: *** [Makefile:346: zsnes] Error 1

Thanks for reporting!

I tried installing Ubuntu in a Docker container, and got a bit further.

The main problem right now is that the equivalent of an sdl12-compat package does not seem to be available for Ubuntu, or I could not figure out how to install it. Perhaps the compat package needs to be installed for x86_64 and the SDL2 library needs to be installed for x86_64? This is hard to tell, and neither apt nor dpkg is particularly helpful in this regard.

Here is an approximate list of what I have tried so far, copied from the command line history.

It did not end up working! But I think I got a bit further:


Install various packages:

apt update
apt upgrade
dpkg --add-architecture i386
apt install git golang make nasm libsdl1.2-compat libsdl1.2-compat-dev zlib1g zlib1g-dev libpng-dev libpng16-16 build-essential libc6-dev-i386 g++-multilib libgl-dev ia32-libs-dev gcc-multilib lib32z1-dev file

Add a symlink to the x86 / i386 version of libpng:

ln -s /usr/lib/i386-linux-gnu/libpng16.so.16 libpng16.so

Add these to the Makefile, around line 86:

CFLAGS += -I/usr/include/x86_64-linux-gnu -I /usr/include/X11
CXXFLAGS += -I/usr/include/x86_64-linux-gnu -I /usr/include/X11
LDFLAGS = -Wl,--as-needed -no-pie -L/usr/lib32 -L/usr/lib/i386-linux-gnu -Wl,--gc-sections -lz -lSDL12 -L. -lpng16 -lX11

Type make to see the compilation fail.

Try to install the x86 / i386 version of libpng:

apt install libpng16:i386 || apt install libpng16-16:i386

Try installing the Ubuntu equivalent of sdl12-compat for x86 / i386 and fail:

apt install libsdl1.2-compat libsdl1.2-compat-dev
apt install libsdl1.2-compat:i386 libsdl1.2-compat-dev:i386
apt install libsdl2-2.0-0:i386
apt install libsdl2-dev:i386
apt install libsdl2:i386

I wish something similar to apt install libsdl12-compat:i386 would work, but it currently does not, in the Docker container that I tried it with.

Suggestions are welcome.

I'd probably prefer to use whatever distro you are, so long as it's easy to install. What is it?

I am on Arch Linux. ZSNES has been tested on Arch and Fedora.

I want to make .deb for Debian/Ubuntu too, though.

Note to self: Debian sid has libsdl1.2-compat available, for different architectures:

https://packages.debian.org/sid/i386/libsdl1.2-compat/download

Thanks. Fedora is easier to install in my experience, so I'm probably going to go with that.

I updated the Makefile and it builds on Debian 12 now.

It does not currently cross-compile on aarch64, but it compiles in a x86_64 Debian 12 VM, with approximately these commands:

dpkg --add-architecture i386
apt update
apt install -y git make nasm file pkg-config zlib1g-dev pkg-config
apt install -y libpng-dev libgl-dev libsdl2-dev zlib1g-dev
apt install -y gcc-multilib g++-multilib
apt install -y zlib1g-dev:i386 libpng-dev:i386 libsdl1.2-compat-dev:i386 libgl-dev:i386
apt install -y build-essential
git clone https://github.com/xyproto/zsnes
cd zsnes
make

I see that Ubuntu can also use Flatpak, like Fedora, so that should be another way of installing ZSNES from this repository on Ubuntu:

https://flatpak.org/setup/Ubuntu
https://flathub.org/apps/io.github.xyproto.zsnes

I updated README.md to include notes about Ubuntu and Debian.