At the time of this writing, there’s no binary package ready to install on the Raspberry Pi 4 ‘Buster’ release. Also, I need to make sure I can run the VICE emulator on the console and not in X-Windows for my diorama project. That install isn’t difficult but isn’t a single line or two either, so we’ll start from scratch on a fresh Raspbian lite install. This article assumes some familiarity with how VICE works. Let’s install VICE on a Raspberry Pi 4!
Raspberry Pi 4 Version Log
This initially worked on the 2019-09-26 buster lite install and VICE 3.4. It seems some things have changed lately and I am unable to activate the emulator due to ‘SDL device not found’ errors.
To fix that, I’ve had to rework how SDL is utilized.
The original guide must evolve to support the latest developments from Raspberry Pi, SDL, and VICE as needed.
This guide has been updated to reference the following versions, and was last updated on 5/7/2020.
- Raspbian Buster Lite 2020-02-13
- SDL 2.0.10 (sourced from retropie’s github – they’ve made Pi specific modifications)
- VICE 3.4 (the latest released version)
To that end, the video below is no longer 100% accurate. It still covers the general setup tasks, but SDL’s compile has changed.
Step 0 – Hardware before the Software
This part is pretty simple – you’ll need:
- Raspberry Pi 4 Model B, or Raspberry Pi 3B+
- Micro SD Card (we’re generally at the days of 16GB or higher)
- Micro HDMI cable (or full HDMI if you’re using a Raspberry Pi 3B+)
- Keyboard / Mouse for initial setup, Wifi connectivity for later SSH connectivity.
Step 1 – Write The Raspberry Pi 4Image
We’ll start with a fresh SD Card and a Raspberry Pi 4. We’re going to burn Buster Lite (I’m not using a window environment) on to the SD Card using Balena Etcher.

Step 2 – Boot the Raspberry Pi and get connected.
We know our default password is raspberry and our default user name is pi. You should change these if you’re going to keep this install around. Regardless, we need to set just a couple of things before we start with VICE – such as my desire for SSH access so I could copy/paste commands more easily. Here are those steps after you give yourself a good old fashioned sudo raspi-config
:
- Set hostname to vice-pi-install (This makes it unique and through bonjour lets me access it from my Windows PC as vice-pi-install.local.)
- Set WIFI up to my access point (Country Code and SSID)
- Allow SPI interface access (my diorama is going to be controlling an LCD through SPI)
- Allow SSH interface access (so we can copy/paste from a Windows SSH client)
- Setup locale, keyboard, etc.
- Verify Internet Connectivity (ping google.com)
- Perform your normal
apt update / apt upgrade
commands to update your system.
sudo apt update sudo apt upgrade
Step 3 – Compiling SDL2 for console usage with the kmsdrm video driver
I’m not in a window environment, so we need to enable the kmsdrm video driver in SDL 2 for our VICE compile. Why? We want to run VICE from the console. Unfortunately, the SDL2 libraries from package repositories don’t have the kmsdrm driver piece enabled, so we’ll make our own. I’ll use a separate directory called sdl-work in my home directory.
In previous versions of this guide, we compiled SDL2, SDL2-image, and SDL2-ttf. We also used SDL directliy from libsdl.org. It seems that some things have changed with later versions of Raspbian possibly firmware – I am no longer able to follow my previous guide and have things work. I attempted numerous settings and rebuilds, and finally accepted a different solution:
We will build SDL2-2.0.10 from RetroPie’s fork that has Raspberry Pi specific modifications. Part of the compilation below is from RetroPie’s SDL 2.0 install script. To learn more about the excellent RetroPie project, head on over to their site here.
Keep in mind the browser page may hide text that is to the right for really long lines, so copy the next ‘blank’ line as well. You can see if it you drag your mouse over to the right when highlighting lines.
#install dependencies for how we'll compile SDL2 and install the output package sudo apt install lsb-release git dialog wget gcc g++ build-essential unzip xmlstarlet python3-pyudev ca-certificates libasound2-dev libudev-dev libibus-1.0-dev libdbus-1-dev fcitx-libs-dev libsndio-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libgl1-mesa-dev libglu1-mesa-dev libdrm-dev libgbm-dev devscripts debhelper dh-autoreconf libraspberrypi-dev libpulse-dev mkdir ~/sdl-work cd ~/sdl-work #Download SDL from RetroPie's SDL fork git clone --single-branch --branch retropie-2.0.10 https://github.com/RetroPie/SDL-mirror cd SDL-mirror #update debian package rules and control files, which update dependencies specific #to the raspberry pi and enables kmsdrm conf_depends="libasound2-dev, libudev-dev, libibus-1.0-dev, libdbus-1-dev, fcitx-libs-dev, libsndio-dev, libx11-dev, libxcursor-dev, libxext-dev, libxi-dev, libxinerama-dev, libxkbcommon-dev, libxrandr-dev, libxss-dev, libxt-dev, libxv-dev, libxxf86vm-dev, libgl1-mesa-dev, libegl1-mesa-dev, libgles2-mesa-dev, libgl1-mesa-dev, libglu1-mesa-dev, libdrm-dev, libgbm-dev," sed -i 's/libgl1-mesa-dev,/libgl1-mesa-dev, '"${conf_depends[*]}"'/' ./debian/control conf_flags="--disable-video-vulkan --enable-video-rpi --enable-video-kmsdrm" sed -i 's/confflags =/confflags = '"${conf_flags[*]}"' \\n/' ./debian/rules # move proprietary videocore headers sed -i -e 's/\"EGL/\"brcmEGL/g' -e 's/\"GLES/\"brcmGLES/g' ./src/video/raspberry/SDL_rpivideo.h sudo mv /opt/vc/include/EGL /opt/vc/include/brcmEGL sudo mv /opt/vc/include/GLES /opt/vc/include/brcmGLES sudo mv /opt/vc/include/GLES2 /opt/vc/include/brcmGLES2 #perform the build via dpkg-buildpackage PKG_CONFIG_PATH= dpkg-buildpackage -b
At this point, you should have the debian packages in the directory above SDL-mirror:

Continuing on, we’ll install the package and clean up.
# restore proprietary headers sudo mv /opt/vc/include/brcmEGL /opt/vc/include/EGL sudo mv /opt/vc/include/brcmGLES /opt/vc/include/GLES sudo mv /opt/vc/include/brcmGLES2 /opt/vc/include/GLES2 #remove any old installed library sudo dpkg --remove libsdl2 libsdl2-dev #Now we sudo login to do some of the install sudo su -l #as sudo in a shell... and move to where those .deb packages are cd /home/pi/sdl-work if ! dpkg -i libsdl2-2.0-0_2.0.10_armhf.deb libsdl2-dev_2.0.10_armhf.deb ; then apt-get -y -f --no-install-recommends install fi echo "libsdl2-dev hold" | dpkg --set-selections #exit sudo shell exit
You should now have your SDL2 custom library installed on your system. The last output of the package installation gave me no errors.

Step 4 – VICE Prerequisite Libraries and Build
We won’t be installing libsdl2-dev, as we just made our own of this, so the VICE libraries are everything normally required except libsdl2:
sudo apt install libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev \ libpcap-dev automake bison flex subversion libjpeg-dev portaudio19-dev texinfo xa65
We’re going to take the latest trunk of the VICE source code (3.4 as the time of this writing, so we’ll make a vice-src directory just to keep things separated. After we download the source (this is pure VICE, not my dioramma patching, that comes later) we’ll run the required build commands.
mkdir ~/vice-src cd ~/vice-src #if you want trunk, do this: #svn checkout svn://svn.code.sf.net/p/vice-emu/code/trunk/vice/ #3.4 is the latest VICE release svn checkout svn://svn.code.sf.net/p/vice-emu/code/tags/v3.4/ cd ./v3.4/vice ./autogen.sh ./configure --prefix=/home/pi/viceinstall --enable-sdlui2 --without-oss --enable-ethernet \ --disable-catweasel --without-pulse --enable-x64 make -j $(nproc) make install
Note the ‘prefix’ setting above – that’s where the make install command will put the binaries.
Step 5 – Setting the Video Driver in Raspi-Config
This step seems to no longer be necessary. We used to have to go into raspi-config and enable the ‘Fake KMSDRM’ driver, but with the changes in utilizing SDL from RetroPie’s fork, there doesn’t seem to be that need to change the driver configuration anymore.
Step 6 – Download a demo and test
I downloaded a simple demo from csdb.dk by Booze Design known as ‘The Elder Scrollers‘. Downloaded the .D64 file and uploaded that to the VICE Pi. Moving into the /home/pi/viceinstall/bin directory, I typed ./x64sc and was greeted with an old blue friend:

Now, depending on how this all comes together, you might have a really tiny C64 screen in the corner of your big monitor. Simply hit F12, scroll down to Video Settings -> Screen Settings -> Fullscreen.
After autostarting the demo image I donwloaded, I was able to sit back and enjoy classic SID sound from the Elder Scrollers demo:

With that, we finish the install of VICE on a Raspberry Pi 4 in console mode as the foundation of my Diorama 64 project. Any thoughts or concerns, things that didn’t work well for you with your install? Leave a comment down below or join the discord at https://discord.gg/wbngTy8 and we can chat. Next up: the Raspberry Pi 4 and the LCD display turned monitor.
Raspberry Pi 3B+ Instructions
Generally, the build is very similar. I’m going to skip all the discussion points and run down what I think seems to work on a Raspberry Pi 3B. The key differences are how we build SDL. I didn’t seem to need to change any graphic related driver setting to get this to work.
sudo apt update sudo apt upgrade #SDL for Raspi-3B dependencies sudo apt-get install libfontconfig-dev qt5-default automake mercurial \ libtool libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev \ libudev-dev libtiff5-dev libwebp-dev libasound2-dev libaudio-dev \ libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxss-dev \ libesd0-dev freeglut3-dev libmodplug-dev libsmpeg-dev libjpeg-dev mkdir ~/sdlwork cd ~/sdlwork hg clone http://hg.libsdl.org/SDL cd SDL ./autogen.sh ./configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland \ --disable-video-opengl --host=arm-raspberry-linux-gnueabihf make sudo make install cd ~/sdlwork wget http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz wget http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz wget http://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz wget http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.15.tar.gz tar zxvf SDL2_image-2.0.5.tar.gz tar zxvf SDL2_mixer-2.0.4.tar.gz tar zxvf SDL2_net-2.0.1.tar.gz tar zxvf SDL2_ttf-2.0.15.tar.gz cd SDL2_image-2.0.5 ./autogen.sh ./configure make sudo make install cd .. cd SDL2_mixer-2.0.4 ./autogen.sh ./configure make sudo make install cd .. cd SDL2_net-2.0.1 ./autogen.sh ./configure make sudo make install cd .. #Interestingly enough TTF builds just fine on the 3B. cd SDL2_ttf-2.0.15 ./autogen.sh ./configure make sudo make install cd .. #Now, on to VICE for the Raspi 3B sudo apt install libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev \ libpcap-dev automake bison flex subversion libjpeg-dev portaudio19-dev texinfo xa65 mkdir ~/vicework cd ~/vicework #3.4 is the latest VICE release svn checkout svn://svn.code.sf.net/p/vice-emu/code/tags/v3.4/ cd ./v3.4/vice ./autogen.sh ./configure --prefix=/home/pi/viceinstall --enable-sdlui2 --without-oss --enable-ethernet \ --disable-catweasel --without-pulse make -j $(nproc) # I got an error here for the running of make install - you may or may not need to do the sudo. sudo make install #after this point, I went directly to the vice install directory and ran it cd ~/viceinstall/bin ./x64sc
References:
- Balena Etcher
- Enabling Bonjour for your Raspberry Pi
- VICE Homepage
- Lemon 64 Thread on Custom SDL Build
- SDL on Raspi (for 3B compile)
- Compiling SDL2 from source
- x64 vs x64sc VICE binaries
- The Elder Scrollers Demo
Thank you for providing your guide. A couple of differences for my setup:
1). A Pi 3B+
2). Using the 7″ LCD
After following your guide and trying to launch x64sc, I get the SDL error that there is no available video device and that archdep_init failed.
I’m certain I followed your guide as I’m not a linux noob, so could these issues be related to the HW differences?
Hi Bill! Good question. I did *not* try this on a 3B+ yet. I do have one available though, let me run through it and see if I can update the article and respond back to you with my results.
Also – what LCD display is that – an HDMI display? Is it your primary?
Bill, looks like I figured a way to make this work – I created another section at the end of this article for the Raspberry Pi 3B+. Give it a shot and let me know if that works. I just tried it on a 3B+ and was able to get the C64 ready screen up. I didn’t do much testing beyond that.
Hi, thanks for this guide 🙂
I’ve tried to build vice on Raspbian Buster Lite.
i followed your instruction and tried to build on my Rasp 3B and on Rasp 4B the vice emulator.
Everything goes well, except it stops in the final make with aseries of “undefined reference” error:
make[3]: [Makefile:1862: c1541] error 1
make [2]: [Makefile:2008; all-recursive] error 1
make[1]: [Makefile:1763: all-recursive] error 2
make: [Makefile:506: all-recursive] error 1
Can you point me out what’s wrong?
Thanks,
Giuseppe
Giuseppe,
I’ve not seen that error – it’s possible something has been updated, either the VICE source code or something in Raspbian that’s changed.
When I get some time this weekend I’ll try rebuilding VICE on a fresh Pi 4B and see if I can reproduce the error!
Cheers,
Krystof
Thank you very much for your answer, yeah, i think too something has changed in the vice source 🙁
All the problems seem to come from “linenoise” lib.
If you have time and wish to recompile it, it will be fantastic 🙂
I really want to have a Vice Emu for my 3B and 4B.
Thanks once again,
Giuseppe
Giuseppe,
So far it’s been a bit ugly in two ways:
1. I can’t reproduce the error you’re seeing.
2. I can’t get a fresh install to work any longer.
So… I’m back trying to get it working again, perhaps through that work I’ll run into your issue!
Thank you for your reply Eric 🙂
If you can make it compile again, please update your post 🙂
Cheers,
Giuseppe
I was finally able to get a fresh recent install working, and it’s a bit of change to how SDL is utilized (I end up using RetroPie’s source)
I need to reformat the Pi again and start from scratch to make sure it’s a repeatable process. Once that’s done, in the next day or so, I’ll send an update out.
To that end, can you tell me if there’s anything unique to your Pi setup that you do or install? It might help me reproduce since even with all the changes I’ve made in the last few days, I still never saw the compile issue. Any software you also installed or other configuration tweaks you made?
Cheers,
Eric
Hi Eric,
glad you was able to compile it 🙂
I didn’t install anything else than just a fresh copy of Raspbian buster lite, then followed your instructions.
Everything worked well, every SDL2 lib compilation, Vice configuration worked too without any problem, only when i launched the command “Make” , after awhile it failed with the error i mentioned some day ago. the error seemed to refer to libLinenoise.
Please, when you have time and if you want, update your guides, they helped me very much 🙂
Cheers,
Giuseppe
Well, Giuseppe, I’ve updated the guide as best as I could. Feel free to give it a shot and see how it goes. The primary differences are going to be how SDL is compiled and installed (along with *not* rebuilding SDL-image and SLD-ttf), along with building VICE directly from the 3.4 tag instead of trunk. I hope it works for you! I’ve tried this on a 4 and 3B.
If that breaks in the same spot, see if maybe there’s a way you can turn up logging or debug (I’m not sure), perhaps there’s something more useful we can use to determine what’s going on.
Thank you very much for your work Eric 🙂
Yesterday i tried to compile SDL2 with your new guide, unfortunately i got some error :(( ( No luck at all)))
When i typed:
sed -i ‘s/libgl1-mesa-dev,/libgl1-mesa-dev, ‘”${conf_depends[*]}”‘/’ ./debian/control
I got error param s is not recognized…
Didn’t have any luck, anyway, i’ll try again, maybe i misprinted something 🙂
Thanks once again 🙂
Giuseppe
Hi Giuseppe,
It might help to copy that and paste it – if you’re typing it manually that could easily be a typo there. If you *did* copy and paste that, I may have an error on my end! 🙁
What I will do this weekend, which I should have a while back, is turn this into a script you can run. If I do that, I’ll update again and send you a link.
After many, many failures I finally was able to compile VICE for console on a RPi 3B. Thanks a lot for this tutorial! Great work!
Thank you very much, I’m glad it has worked out for you!
After running PKG_CONFIG_PATH= dpkg-buildpackage -b
I get the following errors (on Pi 4) 🙁
make[1]: *** [debian/rules:28: override_dh_auto_configure] Error 2
make[1]: Leaving directory ‘/home/pi/sdl-work/SDL-mirror’
make: *** [debian/rules:25: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
I wish Vice was straight forward to install, the Pi is such a great platform for C64 emulation.
Hi Ben, I share the same wishes. 🙂
Things change so often with libraries and system updates, I have a Raspi 4 I keep for nothing but build testing. So I’ll try and fire that up and do a fresh reinstall and recreate the issue. That whole dpkg-buildpackage bit was absolutely horrible to work through and document – that’s the first time I couldn’t just download source, build the custom library and utilize it in a straightforward fashion. The older method I had worked a bit better that way but later crapped out with the last raspberry pi buster update…. So I had to find an alternative working mechanism and landed on RetroPie’s solution.
Given that any of the above components, libraries, os, and retropie, can change independently, it’s going to be a never-ending struggle. So I’ll start from a fresh install and execute my grouping of commands on this page and see if I run into the same issue as you did.
I did get it working using libsdl2-dev instead of the compiled special version, which is brilliant! It’s very hmmm “interesting” compared to the Windows version which is comparatively simple to configure. I haven’t figured out how to get a gamepad to work. Also having a lot of “Sound: Warning – Buffer drained” although I’ve increased the buffer to 150ms and changed from reSID to sid Fast.
Ok the gamepad works after some further tinkering. Thanks for your hard work putting this all together.
Excellent, and you’re welcome!
That’s great to hear – the libsdl2-dev might have been updated some since I last tried it. Would you mind pointing me to the repo you pulled it from so I can try that out instead? I’ve not tried a gamepad on vice myself, but I have done a regular 9 pin joystick with a USB converter and that did work as a joystick.
The sound buffer drain error is something I also get – I’ve generally been ignoring it and in general I’ve not had many sound issues in the games I play – but some of the demoscene eye-candy I’ve tried do require some SID setting changes now and then.
It was just the standard old “apt install libsdl2-dev” that seemed to do the trick.
I’ve just tried the “PiKiss” script with a fresh image and that seemed to work really well too (PiKiss script link below). There were some differences in the dependencies which you may find interesting:-
Same in both: subversion flex bison xa65 texinfo libasound2-dev
Unique to Jose: libsdl2-dev (as we know) autoconf libglew-dev libieee1284-3-dev (parallel port why??)
Unique to Krystof: libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev
libpcap-dev automake libjpeg-dev portaudio19-dev
This script… https://github.com/jmcerrejon/PiKISS/blob/master/scripts/emus/commodore.sh
Beautiful, Ben. Thank you so much. This will definitely help me get some updates going for the install instructions.
Hi Eric,
I deeply appreciate that you are making this guide for compiling vice. Is there any news on when do you plan to provide an update to the instructions? Well, I have a Pi 3B and I added some wiringpi lines to vice source in order to emulate the drive led status into an actual led connected to the gpio. It was shown in on Perifractic’s Retro Recipies channel on Youtube. I contacted the author of this Idea and he gave me some guidelines on how to make this to work.
The only os that worked with compilation was combian. Of course, I wanted to do the compilation on a fresh raspberry os lite so i followed your instructions from above and I have the following error coming up while compiling:

Any ideas what is the problem? Maybe you could update your instructions for the rpi 3B in relation to the latest raspberry os version?
Thank you in advance
Hi Michal,
Thanks for the note. I’ve not done the build on the 3B in a while, so I can validate that with the latest raspberry OS version. However, while I half-expect it to work on my machine without issue, it still may not on yours, given your error. Sounds like, based on that picture, your compilation on combian is acting differently than your compilation on raspbian. If combian worked then it’s most likely ignoring your implicit function declaration.
Off the top of my head I think there’s two ways around your problem:
In my case, I decided to declare mine when I was creating my mini 1541 LED Drive in my diorama, if you’ve not seen that article it might help:
https://krystof.io/patching-the-vice-emulator-to-light-up-floppy-drive-leds/
Thanks for the feedback. Please, validate the installation with 3b and latest raspberry os lite. I would appreciate a small tutorial.
Thank you in advance
Hi Krystof,
I’ve tried the procedure for Raspberry Pi 4 with the new Vice 3.5 and unfortunately it’s broken. If you have time and wish, please update your guide for the new Vice.
Cheers,
Giuseppe
I’m going to work on that this holiday weekend! Happy New Year!