Finally, after a long long wait, a new version of the amazing PCSX2 emulator is out (version 1.6.0). It has a ton of improvements over the last stable version (1.4.0). What the developers have achieved is nothing but remarkable.
Unfortunately, PCSX2 only supports 32 bit architectures. I believe this is a drawback, but I am also aware that changing it to 64 bit is a huge task that would require a lot of time, time that instead could be used making improvements and developing new features.
At the writing of this post, there is no PPA to easily install PCSX2 1.6.0 in Ubuntu systems, so the emulator should be compiled from source.
If you are an Ubuntu user, you may know that Ubuntu support for compiling 32 bit executables is kind of broken. According to the PCSX2 guide to compile in Linux, in Ubuntu you should install these libraries:
sudo apt install libaio-dev:i386 libbz2-dev:i386 libcggl:i386 libegl1-mesa-dev:i386 libglew-dev:i386 libgles2-mesa-dev:i386 libgtk2.0-dev:i386 libjpeg-dev:i386 libsdl1.2-dev:i386 libwxgtk3.0-dev:i386 nvidia-cg-toolkit zlib1g-dev:i386 libsdl2-dev:i386 libjack-jackd2-dev:i386 libportaudiocpp0:i386 portaudio19-dev:i386 liblzma-dev:i386 libsoundtouch-dev:i386 libxml2-dev:i386 libpcap0.8-dev:i386
I ran that command in my system and I got this:
The following packages have unmet dependencies:
libgtk2.0-dev:i386 : Depends: libgdk-pixbuf2.0-dev:i386 (>= 2.21.0) but it is not going to be installed
Depends: libpango1.0-dev:i386 (>= 1.20) but it is not going to be installed
Recommends: python:i386 (>= 2.4) but it is not going to be installed
libxml2-dev:i386 : Depends: libicu-dev:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I may understand the incompatibility between the 32 bit version of libgtk2.0-dev and its 64 bit counterpart… But libxml2-dev… Really? It is a library for parsing text! It depends on libicu-dev, which is a library for locale and Unicode support… Why is it incompatible?
I have the 64 bit version of libxml2-dev installed, because I use it in one of my projects, which is in active development, and I do not want to break compatibility with it.
So I took the Wine approach for compiling 32 bit executables in Ubuntu, I used a container.
First I installed Linux Containers:
sudo apt install lxc lxctl lxc-templates
Then I created a container based on “Ubuntu”, named “pcsx2_container”, making my home directory the container’s home directory and using 32 bit architecture.
sudo lxc-create -t ubuntu -n pcsx2_container -- --bindhome $LOGNAME -a i386
Next, as root (to avoid any directory permission errors), I copied the software sources from the “real” Ubuntu system to the container:
cp -r /etc/apt/ /var/lib/lxc/pcsx2_container/rootfs/etc/
Finally, I started the container and logged in to it:
sudo lxc-start -n pcsx2_container
sudo lxc-attach -n pcsx2_container
At this point, I am in the pcsx2_container, logged in as root. The first step is to update the container packages.
apt update
apt upgrade
Then, I installed the required packages for compiling PCSX2:
apt install cmake gcc-multilib g++-multilib libaio-dev:i386 libbz2-dev:i386 libcggl:i386 libegl1-mesa-dev:i386 libglew-dev:i386 libgles2-mesa-dev:i386 libgtk2.0-dev:i386 libjpeg-dev:i386 libsdl1.2-dev:i386 libwxgtk3.0-dev:i386 nvidia-cg-toolkit zlib1g-dev:i386 libsdl2-dev:i386 libjack-jackd2-dev:i386 libportaudiocpp0:i386 portaudio19-dev:i386 liblzma-dev:i386 libsoundtouch-dev:i386 libxml2-dev:i386 libpcap0.8-dev:i386
Next I downloaded the PCSX2 1.6.0 source code and uncompressed it. The source code should be put somewhere in the home directory so it can be easily accessed from the “real” Ubuntu system.
Fortunately, the developers had made the compilation process almost trivial. Inside the source code directory is a build.sh script, so I just executed it:
./build.sh
When finished, a bin/ directory is created. Inside this directory are the PCSX2 executable and its plugins.
From the “real” Ubuntu system, I executed the binary.
./PCSX2
The program executed with no issues, but I could not configure the graphics plugin. It was ineligible:
This made the emulator unusable.
Inside the bin/ directory is the plugins/ directory, which contains the emulator plugins. These plugins are basically compiled libraries (.so files). The graphics plugin file is libGSdx.so. I executed ldd to that file, to view its dependencies.
ldd libGSdx.so
This was the output:
linux-gate.so.1 (0xf7f2c000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf7695000)
libOpenGL.so.0 => not found
libGLX.so.0 => /usr/lib/i386-linux-gnu/libGLX.so.0 (0xf7672000)
libglib-2.0.so.0 => /usr/lib/i386-linux-gnu/libglib-2.0.so.0 (0xf7541000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xf74e1000)
libgio-2.0.so.0 => /usr/lib/i386-linux-gnu/libgio-2.0.so.0 (0xf72fa000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0 (0xf72cf000)
libgdk-x11-2.0.so.0 => /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0 (0xf720e000)
libgtk-x11-2.0.so.0 => /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0 (0xf6d19000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf6d0f000)
libpng16.so.16 => /usr/lib/i386-linux-gnu/libpng16.so.16 (0xf6cd3000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xf6c16000)
liblzma.so.5 => /lib/i386-linux-gnu/liblzma.so.5 (0xf6bea000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf6a18000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf6916000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf68f8000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf68d9000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf66fd000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xf66d1000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf66cc000)
libGLdispatch.so.0 => /usr/lib/i386-linux-gnu/libGLdispatch.so.0 (0xf666d000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xf65f4000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xf65eb000)
libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 (0xf65e6000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf65c7000)
libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xf659b000)
libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xf6583000)
libmount.so.1 => /lib/i386-linux-gnu/libmount.so.1 (0xf6520000)
libpangocairo-1.0.so.0 => /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0 (0xf6511000)
libpango-1.0.so.0 => /usr/lib/i386-linux-gnu/libpango-1.0.so.0 (0xf64be000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xf6473000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xf6465000)
libXinerama.so.1 => /usr/lib/i386-linux-gnu/libXinerama.so.1 (0xf6461000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xf644e000)
libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xf6441000)
libXcursor.so.1 => /usr/lib/i386-linux-gnu/libXcursor.so.1 (0xf6435000)
libXcomposite.so.1 => /usr/lib/i386-linux-gnu/libXcomposite.so.1 (0xf6431000)
libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xf642d000)
libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xf6426000)
libcairo.so.2 => /usr/lib/i386-linux-gnu/libcairo.so.2 (0xf62d7000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xf62c2000)
libatk-1.0.so.0 => /usr/lib/i386-linux-gnu/libatk-1.0.so.0 (0xf6299000)
libpangoft2-1.0.so.0 => /usr/lib/i386-linux-gnu/libpangoft2-1.0.so.0 (0xf6281000)
/lib/ld-linux.so.2 (0xf7f2d000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xf627d000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xf6276000)
libblkid.so.1 => /lib/i386-linux-gnu/libblkid.so.1 (0xf621e000)
libthai.so.0 => /usr/lib/i386-linux-gnu/libthai.so.0 (0xf6213000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xf61e1000)
libpixman-1.so.0 => /usr/lib/i386-linux-gnu/libpixman-1.so.0 (0xf6132000)
libxcb-shm.so.0 => /usr/lib/i386-linux-gnu/libxcb-shm.so.0 (0xf612e000)
libxcb-render.so.0 => /usr/lib/i386-linux-gnu/libxcb-render.so.0 (0xf611f000)
libharfbuzz.so.0 => /usr/lib/i386-linux-gnu/libharfbuzz.so.0 (0xf6074000)
libbsd.so.0 => /lib/i386-linux-gnu/libbsd.so.0 (0xf6059000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xf6050000)
libdatrie.so.1 => /usr/lib/i386-linux-gnu/libdatrie.so.1 (0xf6047000)
libgraphite2.so.3 => /usr/lib/i386-linux-gnu/libgraphite2.so.3 (0xf6018000)
The problem was evident:
libOpenGL.so.0 => not found
The 32 bit version of libOpenGL.so.0 is not present in the “real” Ubuntu system. I tried to troubleshot it by installing additional 32 bit packages but I had no success.
So I went back to the pcsx2_container and copied the library to my home directory. In the container, the libOpenGL.so.0 is a simbolic link to libOpenGL.so.0.0.0.
cp /usr/lib/i386-linux-gnu/libOpenGL.so.0.0.0 somewhere_in_home/
Finally, in the “real” Ubuntu system, I created a symbolic link from the libOpenGL.so.0.0.0 library to the system 32 bit libraries directory.
sudo ln -s somewhere_in_home/libOpenGL.so.0.0.0 /usr/lib/i386-linux-gnu/libOpenGL.so.0
This solves the libGSdx.so dependency problem and now PCSX2 woks.
I hope someone finds this post useful.