Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting up RetroArch on a Raspberry Pi

Setting up RetroArch on a Raspberry Pi

I just put the finishing touches on my Raspberry Pi 3 emulation machine running RetroArch. I was not a huge fan of RetroPie due to the reliance on Emulation Station - more moving parts meant that there were more things that could potentially break. I just wanted something that would run raw RetroArch, no frills.

This tutorial is mostly recreated from memory and was most recently tested with a Raspberry Pi 3 running Raspbian Stretch and RetroArch 1.7.7. If there is a mistake or a broken link, PLEASE message me and I will fix it.

Step 1: Install Raspbian

I used Raspbian Stretch Lite from this page. Write the image to your SD card using something like Win32 Disk Imager, or if you're using OSX/Linux follow a tutorial on how to write the image using dd.

Step 2: Get Comfortable

First things first, you're going to need to get Wi-Fi set up. Follow this tutorial. You will also need to give the GPU at least 128 megabytes of memory in order to properly run the more advanced interfaces, see this tutorial for instructions on how to do that.

After that, make sure your system is totally up to date:

sudo apt update
sudo apt upgrade

Unless you live in Great Britain, you will probably not be happy with some of the defaults. Use this to fix your keyboard:

sudo dpkg-reconfigure keyboard-configuration

Use this to fix your locale (choose en_US.UTF-8 if you live in the US):

sudo dpkg-reconfigure locales

Use this to fix your timezone:

sudo dpkg-reconfigure tzdata

It's probably a good idea to reboot at this point.

3. Compile RetroArch

Unlike some other tutorials, I believe in keeping things simple, explaining what flags I'm enabling and why, and not going overboard on bells and whistles or disabling things. So let's get started:

sudo apt install build-essential libasound2-dev libudev-dev

Okay, time out - what are we installing and why?

  • build-essential is a meta-package that depends on GCC, libc development libraries, and GNU Make. Essentially it contains the bare minimum needed to compile software on Debian.
  • libasound2-dev is ALSA. This library ensures that RetroArch will have sound - kind of important.
  • libudev-dev is udev. This library is necessary to ensure compatibility with a wider range of input devices. Without this, my DualShock 3 could be detected, but didn't actually work.

Now that we have libraries, grab the source for the latest stable version of RetroArch. You can find the latest source of RetroArch on the Releases page of the official RetroArch github - you want to copy the link labeled "Source code (tar.gz)". From now on, we are going to assume use of 1.7.7, but this is more than likely not the latest release, so please do check the releases page for the latest version.

curl -LO 'https://github.com/libretro/RetroArch/archive/v1.7.7.tar.gz'
tar -zxvf v1.7.7.tar.gz
cd RetroArch-1.7.7

Now to configure it:

CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1

Okay, time out again - why are we passing these parameters to configure?

  • CFLAGS='-mfpu=neon' ensures that the --enable-neon option works, specified later.
  • --enable-alsa ensures that we're compiling with ALSA support. If the library isn't installed, the configure script will die screaming instead of disabling the feature.
  • --enable-udev ensures that we're compiling with udev support.
  • --enable-floathard ensures that RetroArch uses the Pi's built-in hardware Floating Point Unit. Without this, there is the possibility that floating point calculations might be emulated in software, which is much slower.
  • --enable-neon ensures that RetroArch can use the Pi's SIMD CPU instructions (called NEON) for extra speed. Some cores take advantage of this.
  • --enable-dispmanx ensures RetroArch can use the Pi's Dispmanx support for rendering graphics. Dispmanx is a low-level 2D graphics API unique to the Raspberry Pi's video core which you can use as an efficient alternative to OpenGL. Some emulators run faster with Dispmanx, but the downside is that it is not as featureful as OpenGL (for one, the OSD text at the bottom of the screen won't render), and comes with ugly bilnear filtering enabled by default, though this can be turned off. So we compile with support for both GL and Dispmanx, and you can decide for yourself which one you prefer.
  • --disable-opengl1 ensures RetroArch does not attempt to compile support for the legacy OpenGL 1.x standard, which the Pi does not support.

And that's it. Disabling 20 different options is pointless - all you're really saving is binary size. If the configure script completes without errors, you can then:

make
sudo make install

4. Configure RetroArch

Now that RetroArch is installed, run it:

retroarch

You will be presented with the GUI front-end. You can use the arrow keys to navigate the UI, x to select an option, z to back out, and esc to quit RetroArch completely. We still have a little ways to go, however, until we're completely up and running.

Quit out of RetroArch and edit the ~/.config/retroarch/retroarch.cfg file with your editor of choice - nano is good if you don't have a preference. Look for the line that mentions core_updater_buildbot_url and set it to http://buildbot.libretro.com/nightly/linux/armhf/latest/.

Next, unless you are incredibly lucky your controller probably is not working. Navigate to Online Updater, then Update Autoconfig Profiles and wait for the OSD text to stop flashing. Quit and restart RetroArch to see if your controller was found. If your controller still isn't configured, you might need to go to Settings, then Input, then Input User 1 Binds. It should be self-explanatory from here.

Now, let's test our updated settings. From the main menu, navigate to Online Updater, then Core Updater, and select 2048. Once it's installed, from the main menu, select Load Core then 2048. Finally, select Start Core. If everything went smoothly, you should be able to play a simple game of 2048 to prove that everything is set up correctly. To exit the game, press escape or use the button on your controller that you bound to said functionality.

At this point, you are now ready to follow other RetroArch tutorials that concern importing and playing your games.

5. Other Stuff

Does it bug you that sometimes your Pi will show a blank screen after a period of inactivity, which can only be undone by touching the keyboard? Use your editor of choice to modify /etc/rc.local and put the line setterm -blank 0 before the last line that says exit 0.

If you remember from earlier, we compiled RetroArch with Dispmanx support. To give it a spin and see if you prefer it to the default GL implementation, first ensure that you are using the default rgui menu driver - if you haven't changed your menu driver, you're fine. Next, at the Main Menu select Settings, Driver, then Video Driver and select dispmanx. You must then quit and relaunch RetroArch. If you ever want to go back, go to the same place and select gl instead.

RetroArch gives you many different choices for cores. Sometimes it's a little confusing trying to figure out which core is the best. Here is my suggestions based both on personal experience and other people giving me advice:

  • NES: FCEUmm.
  • Genesis: Genesis Plus GX. If you get slowdown, try PicoDrive.
  • 32X: PicoDrive.
  • SNES: Snes9x Next. If you get slowdown, try CATSFC.
@y4my4my4m

This comment has been minimized.

Copy link

commented May 29, 2018

Thank you, this worked for me.

@agentgerbil

This comment has been minimized.

Copy link

commented Nov 25, 2018

I'm getting error message - * failed to add service - already in use?
when i try to run retroarch

@thegreatestminer

This comment has been minimized.

Copy link

commented Apr 1, 2019

I'm getting error message - * failed to add service - already in use?
when i try to run retroarch

Ancient reply, but did you check if the GL Desktop is disabled? That should fix it.

@tonytech17

This comment has been minimized.

Copy link

commented Apr 5, 2019

Help! after running the make command I get this error.

CC menu/menu_setting.c
menu/menu_setting.c: In function ‘setting_append_list’:
menu/menu_setting.c:6928:19: error: ‘menu_shader_pipeline’ undeclared (first use in this function)
menu_shader_pipeline,
^~~~~~~~~~~~~~~~~~~~
menu/menu_setting.c:6928:19: note: each undeclared identifier is reported only once for each function it appears in
Makefile:137: recipe for target 'obj-unix/menu/menu_setting.o' failed
make: *** [obj-unix/menu/menu_setting.o] Error 1
pi@raspberrypi:~/RetroArch-1.3.6 $

@AlexMax

This comment has been minimized.

Copy link
Owner Author

commented May 17, 2019

@tonytech17 Hi there, my apologies, but the installation instructions were old and out of date. I just updated them for a more modern version of RetroArch and Raspbian, please try again.

@xlar54

This comment has been minimized.

Copy link

commented May 22, 2019

worked great!

@helyton

This comment has been minimized.

Copy link

commented May 26, 2019

Yesterday, I had the following problem when I tryed configure CFLAGS:
"dynamic loading of libretro is enabled, but your platform does not appear to have dlopen()"
What could i do?

@molul

This comment has been minimized.

Copy link

commented May 30, 2019

UPDATE: I was able to fix it by getting into the configure scripts and putting some debug messages. The problem was exactly here:

In file included from /usr/include/stdio.h:27:0, from .tmp.c:1: /usr/include/features.h:364:25: fatal error: sys/cdefs.h: No such file or directory include <sys/cdefs.h> ^ compilation terminated.
Googling a bit I found the solution would be
sudo apt-get --reinstall install libc6 libc6-dev

It finished configuring without a problem after that :)

ORIGINAL REPLY:

@tonytech17 Hi there, my apologies, but the installation instructions were old and out of date. I just updated them for a more modern version of RetroArch and Raspbian, please try again.

Hi there! I tried your command but I get this output:

Checking operating system ... Linux Checking for suitable working C compiler ... not found Error: Cannot proceed without a working C compiler.

I have these in /usr/bin:
gcc gcc-6 gcc-ar gcc-ar-6 gcc-nm gcc-nm-6 gcc-ranlib gcc-ranlib-6

Any ideas? Thanks in advance :)

@AlexMax

This comment has been minimized.

Copy link
Owner Author

commented Jun 6, 2019

@molul Thank you for putting in the legwork here. I've updated my instructions to make sure a baseline compilation environment is included (build-essential). @helyton could you give that a shot?

@molul

This comment has been minimized.

Copy link

commented Jun 6, 2019

My pleasure.

If you want to take a look, your tutorial has been key to make Blast16, a new Mega Drive inspired emulator frontend that people seem to enjoy since it was released last week:

http://www.blast16project.com/

Thanks a lot for your work :)

@danpowpow

This comment has been minimized.

Copy link

commented Jun 27, 2019

thanks for this guide - i've installed on a pi4 with buster lite. all goes well, but when I try to launch retrorarch i just get a flashing cursor... any ideas why?
fwiw i had to disable experimental GL driver, i was getting the 'failed to add service' error before that.

@molul

This comment has been minimized.

Copy link

commented Jun 27, 2019

Oh, did it work for you, danpowpow? I just followed the guide on Raspberry pi4 with Buster Lite and got some opengl errors that stopped the build. Is that what you fixed by disabling the experimental GL drivers?

@danpowpow

This comment has been minimized.

Copy link

commented Jun 27, 2019

yeah the guide worked for me - insofar as no errors at compile time. just no gui launch. running verbose mode it hangs at:
[INFO] [Font]: Using font rendering backend: freetype.

@kevingoh

This comment has been minimized.

Copy link

commented Jun 28, 2019

Hi,
I ran into errors when compiling gl_core, please help:
CC gfx/drivers/gl_core.c
In file included from gfx/drivers/gl_core.c:26:0:
gfx/drivers/../common/gl_core_common.h:126:4: error: unknown type name ‘GLsync’
GLsync fences[GL_CORE_NUM_FENCES];
^~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_deinit_fences’:
gfx/drivers/gl_core.c:62:10: warning: implicit declaration of function ‘glDeleteSync’ [-Wimplicit-function-declaration]
glDeleteSync(gl->fences[i]);
^~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_init_pbo_readback’:
gfx/drivers/gl_core.c:77:20: error: ‘GL_PIXEL_PACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[i]);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:77:20: note: each undeclared identifier is reported only once for each function it appears in
gfx/drivers/gl_core.c:78:97: error: ‘GL_STREAM_READ’ undeclared (first use in this function)
lBufferData(GL_PIXEL_PACK_BUFFER, gl->vp.width * gl->vp.height * sizeof(uint32_t), NULL, GL_STREAM_READ);
^~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_slow_readback’:
gfx/drivers/gl_core.c:144:18: error: ‘GL_PACK_ROW_LENGTH’ undeclared (first use in this function)
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:145:17: error: ‘GL_PIXEL_PACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_pbo_async_readback’:
gfx/drivers/gl_core.c:157:17: error: ‘GL_PIXEL_PACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index++]);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:159:18: error: ‘GL_PACK_ROW_LENGTH’ undeclared (first use in this function)
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
^~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_fence_iterate’:
gfx/drivers/gl_core.c:187:39: warning: implicit declaration of function ‘glFenceSync’ [-Wimplicit-function-declaration]
gl->fences[gl->fence_count++] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
^~~~~~~~~~~
gfx/drivers/gl_core.c:187:51: error: ‘GL_SYNC_GPU_COMMANDS_COMPLETE’ undeclared (first use in this function)
gl->fences[gl->fence_count++] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:192:7: warning: implicit declaration of function ‘glClientWaitSync’ [-Wimplicit-function-declaration]
glClientWaitSync(gl->fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
^~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:192:39: error: ‘GL_SYNC_FLUSH_COMMANDS_BIT’ undeclared (first use in this function)
glClientWaitSync(gl->fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
^~~~~~~~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:195:68: error: ‘GLsync’ undeclared (first use in this function)
memmove(gl->fences, gl->fences + 1, gl->fence_count * sizeof(GLsync));
^~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_destroy_resources’:
gfx/drivers/gl_core.c:351:4: warning: implicit declaration of function ‘glBindVertexArray’ [-Wimplicit-function-declaration]
glBindVertexArray(0);
^~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:353:7: warning: implicit declaration of function ‘glDeleteVertexArrays’ [-Wimplicit-function-declaration]
glDeleteVertexArrays(1, &gl->vao);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_init_hw_render’:
gfx/drivers/gl_core.c:416:4: warning: implicit declaration of function ‘glTexStorage2D’ [-Wimplicit-function-declaration]
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, width, height);
^~~~~~~~~~~~~~
gfx/drivers/gl_core.c:416:37: error: ‘GL_RGBA8’ undeclared (first use in this function)
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, width, height);
^~~~~~~~
gfx/drivers/gl_core.c:425:61: error: ‘GL_DEPTH24_STENCIL8’ undeclared (first use in this function)
glRenderbufferStorage(GL_RENDERBUFFER, hwr->stencil ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT16,
^~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:430:52: error: ‘GL_DEPTH_STENCIL_ATTACHMENT’ undeclared (first use in this function)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, gl->hw_render_rb_ds);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_init’:
gfx/drivers/gl_core.c:1091:4: warning: implicit declaration of function ‘glGenVertexArrays’ [-Wimplicit-function-declaration]
glGenVertexArrays(1, &gl->vao);
^~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘video_texture_load_gl_core’:
gfx/drivers/gl_core.c:1135:42: error: ‘GL_RGBA8’ undeclared (first use in this function)
glTexStorage2D(GL_TEXTURE_2D, levels, GL_RGBA8, ti->width, ti->height);
^~~~~~~~
gfx/drivers/gl_core.c:1172:35: error: ‘GL_TEXTURE_SWIZZLE_R’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1172:57: error: ‘GL_BLUE’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~
gfx/drivers/gl_core.c:1173:35: error: ‘GL_TEXTURE_SWIZZLE_B’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1173:57: error: ‘GL_RED’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_read_viewport’:
gfx/drivers/gl_core.c:1442:20: error: ‘GL_PIXEL_PACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index]);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1444:13: warning: implicit declaration of function ‘glMapBufferRange’ [-Wimplicit-function-declaration]
ptr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, num_pixels * sizeof(uint32_t), GL_MAP_READ_BIT);
^~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1444:86: error: ‘GL_MAP_READ_BIT’ undeclared (first use in this function)
ptr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, num_pixels * sizeof(uint32_t), GL_MAP_READ_BIT);
^~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1446:7: warning: implicit declaration of function ‘glUnmapBuffer’ [-Wimplicit-function-declaration]
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
^~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_update_cpu_texture’:
gfx/drivers/gl_core.c:1498:63: error: ‘GL_RGBA8’ undeclared (first use in this function)
glTexStorage2D(GL_TEXTURE_2D, 1, gl->video_info.rgb32 ? GL_RGBA8 : GL_RGB565,
^~~~~~~~
gfx/drivers/gl_core.c:1505:41: error: ‘GL_TEXTURE_SWIZZLE_R’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1505:63: error: ‘GL_BLUE’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~
gfx/drivers/gl_core.c:1506:41: error: ‘GL_TEXTURE_SWIZZLE_B’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1506:63: error: ‘GL_RED’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~
gfx/drivers/gl_core.c:1512:17: error: ‘GL_PIXEL_UNPACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
^~~~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_frame’:
gfx/drivers/gl_core.c:1617:24: error: ‘GL_RGBA8’ undeclared (first use in this function)
texture.format = GL_RGBA8;
^~~~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_set_texture_frame’:
gfx/drivers/gl_core.c:1898:45: error: ‘GL_RGBA8’ undeclared (first use in this function)
glTexStorage2D(GL_TEXTURE_2D, 1, rgb32 ? GL_RGBA8 : GL_RGBA4, width, height);
^~~~~~~~
gfx/drivers/gl_core.c:1901:17: error: ‘GL_PIXEL_UNPACK_BUFFER’ undeclared (first use in this function)
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
^~~~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1912:38: error: ‘GL_TEXTURE_SWIZZLE_R’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1912:60: error: ‘GL_BLUE’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
^~~~~~~
gfx/drivers/gl_core.c:1913:38: error: ‘GL_TEXTURE_SWIZZLE_B’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~~~~~~~~~~~~~~~
gfx/drivers/gl_core.c:1913:60: error: ‘GL_RED’ undeclared (first use in this function)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
^~~~~~
gfx/drivers/gl_core.c: In function ‘gl_core_wrap_type_to_enum’:
gfx/drivers/gl_core.c:2017:17: error: ‘GL_CLAMP_TO_BORDER’ undeclared (first use in this function)
return GL_CLAMP_TO_BORDER;
^~~~~~~~~~~~~~~~~~
Makefile:199: recipe for target 'obj-unix/release/gfx/drivers/gl_core.o' failed

@kevingoh

This comment has been minimized.

Copy link

commented Jun 28, 2019

I have just found out the problem I reported was due to fact that GL driver is not enabled. I tried to build with GL core disabled, ended successfully, am just not sure how will emulation run in this mode.

@kevingoh

This comment has been minimized.

Copy link

commented Jun 28, 2019

"I tried to build with GL core disabled"

How do you do this? I've tried following the guide step by step and still get errors -_-U

Add --disable-opengl_core

My CFLAGS in the end:
CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1 --disable-opengl_core

I have installed the service but could not see any GUI frontend when running it. Not sure how to troubleshoot from that...

@molul

This comment has been minimized.

Copy link

commented Jun 28, 2019

Ok, I thought I could start from scratch just in case I messed something up with other projects I was building. I re-flashed Raspbian Buster and directly followed this guide. I was able to build retroarch, but when I launch it I get this error:

"* failed to add service - already in use?"

I tried adding your flag, kevingoh, and still get that error -_-

@kevingoh

This comment has been minimized.

Copy link

commented Jun 28, 2019

That's because you have the GL Driver enabled. You have to run Raspbian with Legacy GL Driver.
But mind you, I am not seeing the GUI front-end at the moment :D

@molul

This comment has been minimized.

Copy link

commented Jun 28, 2019

@AlexMax

This comment has been minimized.

Copy link
Owner Author

commented Jun 28, 2019

I do not have a Pi 4 yet, so I'm not sure how much help I can be at this point.

@c0d3h4x0r

This comment has been minimized.

Copy link

commented Jul 1, 2019

You need to also pass --disable-x11 to configure to produce a build suitable for RetroPie (which does not have/use x11).

@molul

This comment has been minimized.

Copy link

commented Jul 1, 2019

Thanks c0d3h4x0r! Did you try this yourself? Added --disable-x11, but unfortunately no image is displayed when running Retroarch :(

This is my config:

CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1 --disable-x11

Also tried:

CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1 --disable-x11 --disable-opengl_core

No image as well. If I launch retroarch -v, I get this:

[INFO] === Build =======================================
[INFO] Capabilities: NEON VFPv3 VFPv4
[INFO] Built: Jul 1 2019
[INFO] Version: 1.7.7
[INFO] =================================================
[INFO] Environ SET_PIXEL_FORMAT: RGB565.
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 30000.00 Hz.
[INFO] [Video]: Video @ 960x720
[INFO] [EGL] Falling back to eglGetDisplay
[INFO] [EGL]: EGL version: 1.4

@danpowpow

This comment has been minimized.

Copy link

commented Jul 1, 2019

@molul try rebooting and running the verbose command - i found that on a clean boot i got further, alhough never to a gui.
i noticed a line referring to the VideoCore IV in my logs, and the pi 4 features VC VI, which makes me think all this is down to the upgraded GPU on the pi4 not fully being supported yet.

@molul

This comment has been minimized.

Copy link

commented Jul 1, 2019

@c0d3h4x0r

This comment has been minimized.

Copy link

commented Jul 2, 2019

Thanks c0d3h4x0r! Did you try this yourself? Added --disable-x11, but unfortunately no image is displayed when running Retroarch :(

Yes. I had to add a bunch more CFLAGS and configuration options to finally produce a reasonable build of 1.7.7 for use on my Raspberry Pi 3B+ w/ RetroPie. The additional CFLAGS provide noticeably better perf optimization for this hardware (on par with the original retroarch binary supplied w/ RetroPie... actually, slightly better performance in my initial testing of NeoGeo games w/ lr-mame2010). Here's what I used:

CFLAGS='-march=armv8-a+crc -mtune=cortex-a53 -O2 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations' ./configure --disable-ffmpeg --disable-networking --disable-sdl --disable-sdl2 --disable-x11 --disable-freetype --disable-debug --disable-opengl1 --disable-opengl_core --enable-opengles --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx

@molul

This comment has been minimized.

Copy link

commented Jul 2, 2019

@squidrpi

This comment has been minimized.

Copy link

commented Jul 3, 2019

For raspberry pi 4 you need to disable dispmanx/videocore as that is no longer used. Make sure you don't enable legacy GL driver on the Pi4 as that is broken.

Compile and use on Pi4 as above but with the following compile options:
CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --disable-opengl1 --enable-neon --enable-udev --enable-floathard --enable-opengles3 --enable-opengles --disable-videocore --disable-pulse --disable-oss

This works fine in X11 and console mode.

@molul

This comment has been minimized.

Copy link

commented Jul 4, 2019

Hi squidrpi! I used your "CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --disable-opengl1 --enable-neon --enable-udev --enable-floathard --enable-opengles3 --enable-opengles --disable-videocore --disable-pulse --disable-oss"

and got a Segmentation fault when launching Retroarch. Then I realized I was still using legacy GL driver, went back to the Fake KMS, typed "retroarch" and nothing happens.

It's getting tough building Retroarch in RPi4...

@MrRKernelPanic

This comment has been minimized.

Copy link

commented Jul 14, 2019

I get this error, anyone got any suggestions.

ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM CARD=ALSA

@MrRKernelPanic

This comment has been minimized.

Copy link

commented Jul 14, 2019

Hmm, I noticed going back through the instruction that it was in there to install, must have missed it on the first run.
Got the sound working, switched it to 'tinyalsa' and sound under Gensis Emulator.

Might be worth making a note that if you botch your install (change a setting that messes it up) simply rename the config to go back to defaults.

sudo mv ~/.config/retroarch/retroarch.cfg ~/.config/retroarch/retroarch.cfg.old

@brimur

This comment has been minimized.

Copy link

commented Jul 19, 2019

Compilation failed. Using a Pi4 running Raspbian Buster CLI only. Nothing else installed other than that mentioned above.

image

@alphanu1

This comment has been minimized.

Copy link

commented Jul 19, 2019

There are many libraries missing in Buster. These need to be installed. The following is pretty much everything RA needs.

sudo apt install build-essential libxkbcommon-dev zlib1g-dev libfreetype6-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libavcodec-dev libsdl2-dev libsdl-image1.2-dev libxml2-dev yasm libavformat-dev libavdevice-dev libswresample-dev libavresample-dev libswscale-dev libv4l-dev libgl*-mesa-dev

@UlitmateCro

This comment has been minimized.

Copy link

commented Jul 20, 2019

Has anyone managed to actually get the retroarch on the raspberry pi 4 if so can you post your steps.

@alphanu1

This comment has been minimized.

Copy link

commented Jul 21, 2019

Yes I have. Install the libraries above.

Configure as follows.

CFLAGS="-mfpu=neon" ./configure --enable-alsa --enable-udev --enable-neon --disable-videocore --disable-opengl1

Them make.

This method requires fkms-v3d to be enabled in the boot config.txt

If you want to use videocore and gles3 instead you need to disable fkms-v3d. You also need x11 windowing enviroment to use gles3. Use openbox and lightdm. Configure auto login with raspi-config.

Load terminal once in openbox configure

CFLAGS="-mfpu=neon" ./configure --enable-alsa --enable-udev --enable-neon --disable-videocore --enable-opengles --enable-opengles3 --disable-opengl1 --enable-x11

nd compile the same as above.

@UlitmateCro

This comment has been minimized.

Copy link

commented Jul 21, 2019

@seven-lynx

This comment has been minimized.

Copy link

commented Jul 31, 2019

The main issue I'm having is that even when I get retroarch to compile and install without errors, the Core Updater doesn't work. When I click on it, the screen goes black for a split second but nothing else happens.

If I run '$ retroarch --verbose', when I click Core Updater the log says

[INFO] [GL]: VSync => on
[INFO] [EGL]: eglSwapInterval(1)

I tried downloading cores manually and extracting them to the cores folders, but they don't register within retroarch.

I'm using a Raspberry Pi 4 4gb. I've reformatted and recompiled several times, and it's always the same result.

My first attempt followed this guide:

https://gist.github.com/AlexMax/32e5d038a66ce57253e740ea75736805

The first configuration I tried that resulted in a usable retroarch was:

$ sudo apt install build-essential libasound2-dev libudev-dev libxkbcommon-dev zlib1g-dev libfreetype6-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libavcodec-dev libsdl2-dev libsdl-image1.2-dev libxml2-dev yasm libavformat-dev libavdevice-dev libswresample-dev libavresample-dev libswscale-dev libv4l-dev libgl*-mesa-dev

$ CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1 --disable-videocore

$ make

$ sudo make install

Core Updater doesn't work, and tweaking settings accomplishes nothing.

Next was:

$ CFLAGS='-mfpu=neon' ./configure --enable-alsa --enable-udev --enable-floathard --enable-neon --enable-dispmanx --disable-opengl1 --disable-videocore --enable opengles --enable-opengles3

Same result.

After that I tried:

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

Same result.

It might be worth nothing that with the first two builds, dispmanx doesn't show up as an option for the video driver.

After these 2 tries, I reformatted again and repeated both methods, just to make sure I hadn't made an error somewhere. This time I got compiler errors related to dispmanx, so I tried leaving --enable-dispmanx out and got no compiler errors, but still Core Updater wasn't working, nor was manually copying cores over.

After a lot of google-fu, I've come across the method directly above:

"CFLAGS="-mfpu=neon" ./configure --enable-alsa --enable-udev --enable-neon --disable-videocore --disable-opengl1

Then make.

This method requires fkms-v3d to be enabled in the boot config.txt

But I'm not sure what fkms-v3d is or how to install it.

I've been playing with the rpi for years, and my habit on getting a new one is to install retropie (with berryboot) or retroarch without, then kodi, then the rest of my projects. It's driving me nuts that I've had the rpi4 for a few days and still can't figure out how to play my old ps1 games on it.

What am I missing here? I made sure to edit retroarch.cfg to point core_updater_buildbot_url to http://buildbot.libretro.com/nightly/linux/armhf/latest/

Some semi-related noobish questions:

How do I format my post so that I can present the commands I've tried the same way everyone else seems to?

What is fkms-v3d? What is x11? These relate to how Raspbian displays windows?

If I want to change the CLFAGS portion of my install, how should I go about recompiling? Should I just delete the RetroArch-1.7.7 folder and start over at $ tar -zxvf v1.7.7.tar.gz, or is there a better way to remove the previous installation and start over?

Has anyone figured out a berryboot type method of dual booting the rpi4? If so, I'd like to try RetroPie and see if I have the same issue.

Save me, you guys. I'm getting frustrated. Also I apologize if this isn't the correct place to post this.

@MrRKernelPanic

This comment has been minimized.

Copy link

commented Jul 31, 2019

Firstly are you using Buster or BusterLite? Command prompt or GUI (Desktop).

I have built this and have it installed using Raspbian Buster (Desktop) not CLI on a Pi4b.

Tried BerryBoot ages ago, but never really got on with it. I now run Buster Desktop as a Desktop, but still have Retroarch and Kodi as Apps I can run. This is not my main Media PC, just watch bits on it.

Some answers (I think to your questions).

Fkms-v3d is to with the experimental 3D drivers that came out a while ago. I did not use this setting so I think is disabled, X11 is just a posh way of saying the Desktop (rather than CLI) as the Pi by default in Raspbian uses X, there are other desktops you can run if you desire! See above posts for some suggestions.

Every time you alter the CFLAGS you will need to make and make install again as the CFLAGS is basically setting up the configuration you want to build (using the make command), this will overwrite what it did before.

If you’re not sure go to where you built the software, but run sudo make uninstall. Then set CFLAGS and make (to build your new version) the make install.

I understamd having 3 different boots / systems? But it is possible to run them all through Buster Desktop, X11)

@seven-lynx

This comment has been minimized.

Copy link

commented Jul 31, 2019

I'm using Buster desktop, the full installation, also on a Pi4.

I take your point about multibooting. It's not (and won't be) necessary if I can just get retroarch to run in Raspbian.

So why isn't the core updater working? Why isn't it recognizing the cores I manually add to the folder? What am I missing?

@karbinunit

This comment has been minimized.

Copy link

commented Aug 5, 2019

Hi there, ok guys I gleaned all the information to get RetroArch compiled, installed and running on the full buster installation on a PI4
Steps taken....
Installed the Raspbian Buster with desktop and recommended software : “2019-06-20-raspbian-buster-full.img”
https://www.raspberrypi.org/downloads/raspbian/

Once your all logged in and working,

Get the updates
open the Terminal and type:

sudo apt-get update --allow-releaseinfo-change
sudo apt upgrade

Now install everything we need for RetroArch
open the Terminal and type:

sudo apt install build-essential libasound2-dev libudev-dev libxkbcommon-dev zlib1g-dev libfreetype6-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libavcodec-dev libsdl2-dev libsdl-image1.2-dev libxml2-dev yasm libavformat-dev libavdevice-dev libswresample-dev libavresample-dev libswscale-dev libv4l-dev libgl*-mesa-dev

Download the source and expand it:
open the Terminal and type:

curl -LO 'https://github.com/libretro/RetroArch/archive/v1.7.7.tar.gz'
tar -zxvf v1.7.7.tar.gz
cd RetroArch-1.7.7

Set the Flags required:
now type:

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

Now let’s build the code
now type:

make
sudo make install

now in the Terminal type retroarch and press return, the GUI should load, follow the instructions from step 4 at the top of this thread!

Next steps:
Setup a Samba share, and add files etc,

Have fun!

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 6, 2019

What you're describing is the exact steps I've taken, except I've just been using the Raspbian Buster image available through the NOOBS, while it appears you grabbed the img file and mounted and installed yourself.

I can't think of any reason that would make a difference, but in my experience the pi and raspbian are finicky bastards, so I will try your exact steps when I get home.

A few questions: You've verified that the Core Updater works with this setup?

I keep running up against this issue. I've had no problems setting up samba shares to copy over my ROMs, but without a core that step is pointless because a scan will not recognize ROMs. My point being, I havent had any success focusing on other aspects of the installed because it always comes back to needing the core updater to function.

If I follow your steps and still have the same issue, would you be willing to give me a copy of your img after you've gotten it working? Sometimes I have better luck going over someone's work, than trying to extrapolate a solution based on a description.

Anyway, thanks for your answer, I'll try your exact steps and let you know if it works for me.

@MrRKernelPanic

This comment has been minimized.

Copy link

commented Aug 6, 2019

I can verify this works on mine. Scanned a folder and sorted the games into systems. Also with the change made above it grabs and updates the cores. I need some tweaking to get PS1 games working, but they load at least. Genesis / Megaddive games work a treat.

@karbinunit

This comment has been minimized.

Copy link

commented Aug 7, 2019

What you're describing is the exact steps I've taken, except I've just been using the Raspbian Buster image available through the NOOBS, while it appears you grabbed the img file and mounted and installed yourself.

I can't think of any reason that would make a difference, but in my experience the pi and raspbian are finicky bastards, so I will try your exact steps when I get home.

A few questions: You've verified that the Core Updater works with this setup?

I keep running up against this issue. I've had no problems setting up samba shares to copy over my ROMs, but without a core that step is pointless because a scan will not recognize ROMs. My point being, I havent had any success focusing on other aspects of the installed because it always comes back to needing the core updater to function.

If I follow your steps and still have the same issue, would you be willing to give me a copy of your img after you've gotten it working? Sometimes I have better luck going over someone's work, than trying to extrapolate a solution based on a description.

Anyway, thanks for your answer, I'll try your exact steps and let you know if it works for me.

Yup it works

@Kegg1701

This comment has been minimized.

Copy link

commented Aug 8, 2019

Also have compiled a working version of retroarch 1.7.7 for Buster Desktop... The only thing that's not working for me is the Core Updater, and what I've been doing instead is compiling the Cores myself using libretro-super git. Are you guys saying the Core Updater is working for you? I thought as the Pi4 is still fresh out of the oven they may have not got round to having the cores for the updater out there as yet.

The only cores I'm having problems compiling are PCSX (run into floating point problems) and N64 cores. Was hoping to have reicast_lr compiled but do not see an entry for it. Mighty impressed with reicast on Lakka and like to see how well it runs on the V3d Desktop and the pi overclocled to 2.0ghz.

any suggestions welcome

UPDATE :: All sorted... saw the above post for the nightly core buildbot for armhf.. cheers to seven-lynx
As is I pretty much compiled everything they've got on the buildbot except the PCSX core.. sad to see no sign of N64/Reicast

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 20, 2019

Even following your steps EXACTLY, I still get a retroarch with no cores installed, and core updater not working.

Makes no sense. No matter what I do, I always end up with a non-functioning retroarch. No version of Lakka will even boot on my rpi4. I always get a black screen.

I can get retroarch to run on the pi4, but no cores, no updater, so it's pointless.

I even tried a 32gb img file for lakka that is confirmed to work on rpi4. Black screen, no boot.

All I can think to do at this point is buy another rpi4 and try again. Maybe this is some bizarre hardware fault? I seem to be the only person with this issue. Even following guides and videos that appear to work, always yields the same result for me.

Considering that 90% of what I do with a pi is retro gaming, I'm tempted to just throw this thing in the trash and go back to using my pi3s. This has been the single most frustrating issue I've ever tried to troubleshoot. This is something so damned simple, and I seem to be the only person alive who can't crack it.

Ugh.

@UlitmateCro

This comment has been minimized.

Copy link

commented Aug 20, 2019

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 20, 2019

@UltimateCro

Yes.

@brimur

This comment has been minimized.

Copy link

commented Aug 20, 2019

@seven-lynx Not sure which image you used but I use the nightly lakka build from here and everything works except the updater. All cores working, at least those that work on ARM.

http://nightly.builds.lakka.tv/2019-08-15/RPi2.RPi4.arm/

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 20, 2019

@brimur

That's what has me puzzled. I've tried every lakka build from 7-27 onwards at least once, and it never boots. Yet it takes me less than 10 minutes to get lakka up and running on the rpi3, but on the pi4 I haven't gotten lakka to boot once, even using images that I know work for everyone else.

I've been using win32 disk imager to burn to sd card, while most people seem to use Etcher. Could that be the issue?

Even using the NOOBS version of lakka, I only ever get a black screen and no boot.

Couple questions. You said the core updater doesn't work for you, but I infer you've had no problem copying cores over manually?

Assume I'm an idiot and walk me through your exact process for manually adding cores, please? When I try it, They never show up in retroarch.

I'll compile each core myself if i have to.

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 20, 2019

Also, when you install lakka, does it have cores already installed by default?

Because on my rpi3, it does, but on the pi4 I always get a core-less, unusable version of lakka.

@brimur

This comment has been minimized.

Copy link

commented Aug 20, 2019

Yes all the ARM cores are there when I install it. Try etcher maybe that will help. Also try a different sd card. I assume you are not trying to use a USB dinner because the Pi4 can't boot from them yet.

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 21, 2019

I'll try etcher, but I've already tried three different sd cards, two of them brand new. Also I've verified the write on the last few attempts, so I'm reasonably sure the write isn't the problem.

@seven-lynx

This comment has been minimized.

Copy link

commented Aug 21, 2019

Also, that was a mistype earlier. I meant to ask if your version of RetroArch has cores already installed, not lakka. I haven't gotten Lakka to boot even once on rpi4, but I have no problems getting retroarch to run, with gui in raspbian, on the rpi4. Just no cores, and it doesn't recognize cores I manually copy over.

@karbinunit

This comment has been minimized.

Copy link

commented Aug 21, 2019

Hi all,
I tried Lakka, got that working too, but you have to use the nightly build, it has the cores.
find it here:
http://nightly.builds.lakka.tv/
I used the image with the date stamp 2019-08-03 02:03, but will try the latest soon currently 2019-08-15 02:05 or later and report.
Extract the image file then write the image to your SD card (I know Etcher lets you skip this step but had better results with a different SD write program.)

To write the image onto the SD card I use Win32DiskImager, don't let the name put you off, works fine under 64 bit windows OS's.
find it here:
https://sourceforge.net/projects/win32diskimager/

Also tried an over-clock on Lakka, and so far so good. I do have a heat-sink and fan installed.

Give it a go guys.

@jholloway

This comment has been minimized.

Copy link

commented Sep 4, 2019

I've also tried following @karbinunit's exact instructions from this post and RetroArch fails to run. I get video errors including "Failed to export dumb buffer: permission denied". I've been able to get the Lakka nightlies running but I'm having some Bluetooth controller issues.

@askotx

This comment has been minimized.

Copy link

commented Sep 18, 2019

Thank you, works well on retropie rpi3, outdated version (4.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.