Building Vice emulator – NO black magic needed!

Building Vice emulator – NO black magic needed!

Being rather tech savvy but still not working with software, the entire field of source repos and management of them has been a field where I felt my competence was really blurry. Adding to this, I hear from many sources that building VICE from source seemed like it included elements of black magic to pull off. So I didn’t even try. Then Pokefinder nightly build stopped working at new year 2018/19 (and much to my surprise it seems up again since a few days). So in short, if I wanted to keep up, I had to learn to build myself.

So I was ready to dig deep and start learning black magic. I’m not really sure if I was disappointed, surprised or happy when I realised that all it took was following a guide and then I was done. There was absolutely nothing strange about it. Nothing.

There is a guide in the source package so the only part one can have views on is that you need to download the package just to get the guide. It would be a lot easier if the guide was online directly. Below you will find the guide as provided in the source package, after my rather extensive modifications.

PLEASE MIND THAT THIS IS THE GUIDE – with my comments – THAT WAS VALID AT THE POINT OF WRITING THE POST. IT COULD VERY WELL HAVE CHANGED. Given how the project evolves, this happens A LOT.

ALSO: the switches in “$ ./configure -C –enable-native-tools –enable-native-gtk3ui” begins with double minus characters. It seems copy + paste can fail … (Thanks to tNG for this)

VICE (GTK) on Windows

Setup MSYS2

These are some instructions about getting VICE with the GTK3 GUI
compiled on Windows under MinGW.

  1. Get MSys2 (includes mingw):
    http://www.msys2.org/
    Install as per that webpage. You can skip the GIT part if you don’t want that.
  2. Install the stuff that you actually need to build VICE:
    Launch either the MSYS2 MinGW 64-bit shell or the MSYS2 MinGW 32-bit shell (use the one that matches the version of MSYS2 that you installed).

You first need to install a number of libraries, and here things changed since the original text I wrote. (Please mind that I have identified no libs that will handle the pdf generation so in the following I will disable the pdf docs). If you don’t, the later building will fail as it depends on them being in place. Do install all the development items – just press resturn and do not select a subset.

$ pacman -Syu
$ pacman -S base-devel
$ pacman -S mingw-w64-x86_64-{toolchain,libvorbis,flac,mpg123,icoutils}

And optionally also (skip if you don’t want Git or already installed in the earlier step)

$ pacman -S git

Setup XA6502

  1. Then you need the xa 6502 cross-assembler, which is used to assemble the “driver” program for vsid (the SID player that comes with VICE). It can be found here:
    http://www.floodgap.com/retrotech/xa/

    Check this link for a reference to the most recent version. Below URL to the download assumes 2.4.1 which was current at the time of writing this.

    Download to where you want it by placing yourself in a directory of your choice – here I make one in the Home where you should be now.
$ mkdir -p Download
$ cd Download
$ wget http://www.floodgap.com/retrotech/xa/dists/xa-2.4.1.tar.gz

Make the directory “/usr/local/src/”.
Use tar to unpack xa (use the MSys2 path to where you downloaded it):

$ cd /usr/local
$ mkdir -p src
$ cd src
$ tar -xzf ~/Download/xa-2.4.1.tar.gz

Then, build and install it:

$ cd xa-2.4.1
$ make mingw install
$ mv ../../bin/xa.exe ../../bin/xa65.exe

Download the VICE source

  1. Get VICE’s source code.
    To checkout the source with Subversion (to “~/vice/”, for example),
    you could type:
$ cd ~
$ svn checkout http://svn.code.sf.net/p/vice-emu/code/trunk/vice

Build VICE

Now, you can try to build VICE (Basic set-up):

$ cd ~/vice 
$ ./autogen.sh
$ ./configure -C --enable-native-tools --enable-native-gtk3ui --enable-cpuhistory --disable-catweasel --disable-lame --disable-rs232 --disable-hardsid --disable-parsid --enable-ethernet --enable-x64 --disable-debug --disable-pdf-docs --without-ogg-vorbis --without-flac 
$ make all bindist

Also, the parameters might look a bit different than in other examples you find. This is due to recent changes. Docs suddenly built as PDF (but there is no TeX that would work for me on windows) and they also recently fiddled with the supported codecs, so I had to disable ogg-vorbis, flac and lame support to make it build.

In all fairness, doing this again as an update to the MSYS2 installation failed me, I had to follow the procedure and install things again. Doing so I ran into several issues with the environment and had to install several mosuled manuallt. These I recall needing to add:

$ pacman -S mingw-w64-x86_64-glew
$ pacman -S mingw-w64-x86_64-curl
$ pacman -S mingw-w64-x86_64-gtk3

There are aspects of VICE I really want (CPU history being the main one) and there are a number of features I can live without, that only risk slowing down the emulator and making the payload bigger. The general recommendation is to disable anything you don’t need. So my first build looks like this:

$ cd ~/vice
$ ./autogen.sh
$ ./configure -C --enable-cpuhistory --disable-catweasel --disable-lame --disable-rs232 --disable-hardsid --disable-parsid --disable-ethernet --enable-x64 --disable-debug --disable-pdf-docs --disable-platformdox --without-flac --enable-hwscale --with-png --disable-libieee1284 --disable-realdevice --disable-ffmpeg
$ make all bindist
  1. If it got through all those steps, you should have some executables to play

    with in “GTK3VICE-3.?-win??-*/” (the “win??” part of that name tells you which

    type [32-bit or 64-bit] you built).
  2. You can build the 32-bit version of VICE and/or the 64-bit version. You

    make the choice by choosing to run a particular one of the MSYS2 MinGW shells

    (its environment variables control VICE’s configuration).

If you build one version, then want to build the other version, you must clean away some object files first. Then, you must configure VICE again.

$ make clean
$ rm config.cache
$ ./configure -C --enable-native-tools --enable-native-gtk3ui
$ make all bindist

NOTE: The above alternative configure lines should be used if you want the alternative configurations.

  1. If you want the distribution in a ZIP archive instead of a subdirectory,

    then use the command
$ make bindistzip

instead of

$ make bindist

Pontus: Updating VICE is then easy. Open the MSYS2 shell and write:

$ cd vice 
$ svn update
$ make all bindist

One thing I haven’t tried, but which was confirmed on the bug reporting mailing list recently was that if you don’t want to build the entire package (and that takes a lot of time), you can build just one of the emulators by using for example:

$ make x64sc

Also, if the build fails as there has been changes to the build process, or you had to install new components required, the process for refreshing the ability to build is this:

$ $ rm config.cache
$ ./config.status --recheck
$ make -s all bindist

2 Comments on “Building Vice emulator – NO black magic needed!

  1. Hi. I’ve tried these steps and while most of them work I get errors with the ./configure line. If I use this instead:

    # ./configure -C –disable-arch –enable-cpuhistory –disable-hardsid –disable-parsid –enable-x64 –disable-debug –disable-pdf-docs –without-flac

    then it builds successfully but I can’t run any of the exe’s on any Windows because it’s missing a bunch of dll files. I already tried adding –Do I have to copy the dll’s after compiling each time or can I set them statically somehow?

  2. I think this is very outdated and as a result doesn’t quite work. I did follow your instructions a few years ago and it worked but I had to copy some dll’s from another version to make it work.

    However this one I just can’t get to work at all on my Win’11 laptop. Possibly because I’m compiling it on another pc with Win’10. I have notes from when I was able to compile it successfully but for whatever reason whenever I try to run vice (x64sc.exe) on my laptop it gives me an error (after copying the lib dll’s from an older version): “The application was unable to start correctly (0xc0000007b).”

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.