Build Suyu Emulator From Source Code

Hello all! I am proud to announce the good news that I have successfully built the Suyu Emulator on my computer. I am so thrilled that I decided to write this tutorial and document the process. The intent is to have a point of reference in case I have to start from scratch in the future. I do this a lot. Every time I re-install the PC, I have to restore my projects. A point of reference is always helpful.

First, let me describe the basic configuration for my PC. I have:

  • A Dell Latitude E7470. It is a refurbished office laptop from 2017. 512 GB of hard disk space and 32 GB of RAM. I like a lot of RAM.
  • Operating system for the labtop is Kubuntu 24.04.
  • The version of GIT is 2.43.0.

The first step I did is download the full source code o f Suyu in a compressed package. But this package cannot be used to build the application. The reason is that before the build we need to use GIT to acquire all the sub modules needed for the compilation. You cannot do that with the compressed source code package. The ideal approach is to use GIT to clone the project from remote repository, then use the GIT to fetch all the needed source code files for the needed sub modules. To do this, first, I ran the following commands to fetch the source code for Suyu:

mkdir suyu
cd suyu
git clone --recursive https://git.suyu.dev/suyu/suyu.git .

The next step will be setting up the bild tools. This can be done use Debian package installation tool "apt" or "apt-get". The Suyu team has done some fantastic job of documenting this step. Here is the command to do it:

sudo apt-get install autoconf cmake g++-11 gcc-11 git glslang-tools libasound2 libboost-context-dev libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qtbase5-dev qtbase5-private-dev qtwebengine5-dev qtmultimedia5-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev

I ran this command, but it failed. The error indicates that libasound2 is no longer a valid library in the APT repository. The error output would be similar to what is below:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libasound2 is a virtual package provided by:
  liboss4-salsa-asound2 4.2-build2020-1ubuntu3
  libasound2t64 1.2.11-1build2 (= 1.2.11-1build2)
You should explicitly select one to install.

E: Package 'libasound2' has no installation candidate

The best option is to remove this libasound2 from the command and try the install again, it will succeed. Then I tried install libasound2t64. It turned out that this library is already installed. Yay! If you get this far and met with success, you are one quarter completed with environment setup. The next step is to install a dependency management tool called vcpkg. This is used by the CMake toolkit for pulling needed build dependency for Suyu. The steps includes git clone the vcpkg repository to local, then I have to run a shell script in the source code to set it up. To git clone the source for vcpkg, I run the following commands:

mkdir vcpkg
cd vcpkg
git clone --recursive https://github.com/microsoft/vcpkg.git .

Once the git sync completed, in the same directory, I run the following command to set it up:

./bootstrap-vcpkg.sh

It took a little more than 1 second to complete. After it is done, I need to add the vcpkg directory into user profile's PATH variable so that it can be utilized by system self discovery. I just need to add it the my .bash_profile in my home directory. I used pico command to add it. This is the new content added in this file:

...
VCPKG_ROOT=/home/<UserName>/Projects/vcpkg
PATH=$PATH:$VCPKG_HOME

export PATH
...

After the new directory added to the path, I need to logout then log back in so that the change can take effect. Once I logged in, the build environment is ready. Before we can create the build script, I must run the git command to get all the needed sub modules. These are the commands to do it:

cd suyu/
git submodule update --init --recursive

I believe this command syncs all the source code for ffmpeg, SDL, the Vulcan libraries, etc. I am not 100% sure what it does, but this step is vital for the success of building the application. Now I am in the suyu directory, I can setup the build script. I need the following commands to run the setup:

cd CMakeModules
cmake .. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11

It will take a short while to complete. Once it is done, I can commence the build. The command to do it is the following, and I do it in the same CMakeModules directory:

ninja

The whole build will take about 25 to 35 minutes to complete. I was pretty nervous while the build is chewing out information. There were a few warnings, but nothing was serious. And the build completed without error. I got to hand it to the yuzu/suyu team. The whole project as complex as it is, they have done a great job of setting up a fantastic project that can be built successfully. The binary executable is available in the sub directory of CMakeModules called "bin". The executable file is called -- "suyu" (unsurprisingly).

I was able to open the executable by double clicking it. I tested with a old 2D RPG game Dragon Quest. At first, complained about the application cannot find the prod.key and the firm ware. I installed both. Then, the application started without any error. The music plays just as expected. I played the game for about 5 minutes. With such an old hardware, the game is running with 30 frames per second. I am pretty sure the PC cannot handle anything graphically intensive. It did prove that the build is working as expected. Hooray!

Your Comment


Required
Required
Required

All Related Comments

Loading, please wait...
{{cmntForm.errorMsg}}
{{cmnt.guestName}} commented on {{cmnt.createDate}}.

There is no comments to this post/article.