Skip to content

Instantly share code, notes, and snippets.

@ematysek
Last active December 25, 2022 12:43
Show Gist options
  • Save ematysek/fc01a47c7d34f0ca4dad41226c53ff6e to your computer and use it in GitHub Desktop.
Save ematysek/fc01a47c7d34f0ca4dad41226c53ff6e to your computer and use it in GitHub Desktop.

Setting up RetroArch on Raspberry Pi 4 and building emulator cores

Guide for myself and others to get RetroArch running on the new Raspberry Pi 4 while projects like RetroPie get an image out for the rpi4.
Disclaimer: I am not an expert and this may not be the most optimal build possible, but it works.

Inspiration taken from:

1. Environment Setup

sudo raspi-config
Advanced Options -> GL Driver ->  G2 OpenGL desktop driver...
  • Update everything and restart - skip if you know this is done already
sudo apt update
sudo apt upgrade
shutdown -r now

2. Compile RetroArch

Install some needed packages - check the gist I linked for an explanation

sudo apt install build-essential libasound2-dev libudev-dev libgles2-mesa-dev libx11-xcb-dev libxxf86vm-dev

Download RetroArch source code - This guide will use the .tar.gz
https://github.com/libretro/RetroArch/releases

wget https://github.com/libretro/RetroArch/archive/v1.9.0.tar.gz
tar -xf v1.9.0.tar.gz
cd RetroArch-1.9.0

To fix undefined reference to XF86VidMode... errors change this line in Makefile:

#OLD line 24
LIBS :=
#New
LIBS := -lXxf86vm -lpthread

Configure with additional options to work with rpi4

CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --disable-opengl1 --enable-neon --enable-opengles3 --enable-opengles --disable-videocore

If no errors, build

make
sudo make install

3. Run/configure RetroArch

Launch RetroArch fullscreen

retroarch -f

Go ahead and update assets within RetroArch

Online Updater -> Update Assets

The gist for rpi 3b+ will tell you to update the retroarch.cfg file with a url, but those cores did not work for me so this guide will walk through building them.

4. Building Cores

All cores likely have multiple options to choose from but this will just go over what I've done so far.
Compiled core files end in .so and are kept in ~/.config/retroarch/cores/

Create directory to build our cores

cd ~
mkdir cores
cd cores

NES

libretro-fceumm

This could probably use optimized CFLAGS but it works as is

git clone --depth 1 https://github.com/libretro/libretro-fceumm.git
cd libretro-fceumm
make -j4

Move fceumm_libretro.so to cores dir

SNES

snes9x2010

This could probably use optimized CFLAGS but it works as is

git clone --depth 1 https://github.com/libretro/snes9x2010.git
cd snes9x2010
make -j4

N64

mupen64plus-libretro

This core is no longer being updated so you should use mupen64plus-libretro-next, but keeping this here just in case.

git clone --depth 1 https://github.com/libretro/mupen64plus-libretro.git
cd mupen64plus-libretro
platform=rpi4 make -j4

mupen64plus-libretro-next

git clone https://github.com/libretro/mupen64plus-libretro-nx.git
cd mupen64plus-libretro-nx
platform=rpi4 make -j4

PS1

git clone --depth 1 https://github.com/libretro/pcsx_rearmed.git
cd pcsx_rearmed
platform=rpi4 make -j4
@Unounited
Copy link

Unounited commented Jun 1, 2021

My bad, I should have tested the x86 cores before I posted them. And they did not work, so I guess someone might have all the cores for retroarch that work on arm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment