The latest version of the openMSX manual can be found on the openMSX home page:
You can also use this URL to get up-to-date versions of the hyperlinks if you printed out this manual.
This guide is about openMSX, the open source MSX emulator that tries to achieve near-perfect emulation by using a novel emulation model. You can find more information about openMSX on the openMSX home page.
If you just want to use openMSX, there is likely a pre-packaged version you can use. This document describes how you can compile openMSX from source, which is useful if:
If you need help compiling openMSX, please contact us. If you needed any modifications to make openMSX compile, please send those modifications to us, so we can make openMSX ever more portable.
The following people contributed to this document in one way or another:
Thanks to all of them!
For the revision history, please refer to the commit log.
Before you can start compiling openMSX, you have to make sure your system has all the necessary build tools installed, as well as the libraries openMSX depends upon. The following sections tell you how you can prepare your system.
Every section starts with generic instructions, that apply to all platforms and compilers. At the end of each section, platform specific notes cover differences or additional steps for certain platforms or compilers.
For compilation, you need Python, a C++ compiler, and some compiler-specific programs. If you have compiled packages from source before, you probably have some of these installed already.
C:\Python
) to your PATH
manually.For compilation with GCC, you need GNU Make and g++:
You need to install MinGW (with MSYS).
You can download the latest version of mingw-get-inst
from the download page of the MinGW project (it's the default download if you're on Windows). Double click on this installer after downloading. Click Next, Next, select "Download latest repository catalogues" and click Next again. Accept the license agreement and click Next. Use the default installation directory (C:\MinGW
), or at least a clean and empty (e.g. non-existing) directory without spaces and not a network folder (i.e. shared folder on another computer) and click Next. Click Next again. In the "Select Components" step, make sure to check "C++ Compiler" and "MSYS Basic System" and click Next. Then click Install. This will then update the package repositories first, which takes a while. After this, it will download all the MinGW packages and install them.
For compilation for OpenDingux to run on GCW Zero, you need to install the GCW Zero toolchain. This toolchain is for x86 Linux; if you have an x86 machine but no Linux, you can install Linux in a virtual machine. You can find the toolchain and installation instructions in the development section of the GCW Zero web site.
Install Xcode from Apple, which you can find in the Mac App Store. The openMSX build is not done inside the Xcode IDE, but it uses the SDK and command line tools that are provided by Xcode.
To build with Visual C++ you need to have the latest version of it installed. Currently, this is 2019.
Use this way to obtain the Visual C++ compiler:
To generate an MSI installation package, you also need:
Warning: the build instructions here are only valid for openMSX 0.15.0!
Warning: the build of the Android version is only supported on a Linux or Unix host platform. If you want to build the Android version on a Windows host, then you must install a virtual machine with a Linux distribution on it. This is because the Android build depends on the "commandergenius" SDL Android port, which can only be build on Linux and Unix platforms.
The Android build depends on the following toolkits and libraries that must first be installed:
${ANDROID_NDK_HOME}
. It is advisable to do this in your ~/.profile
script so that the setting remains available on each login. Note that ${ANDROID_NDK_HOME}
stands for the
directory in which you installed the Android NDK, for example /opt/android/android-ndk-r18b
. We currently only support Android NDK 18b! On top of that, it is also necessary to create a stand-alone toolchain from this NDK. The following works: $ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py --arch arm --api 16 --install-dir /opt/Android_NDK/r18b-android16-arm-standalone-toolchain
. The destination dir here is just an example. You must add the bin
subdir to your PATH
environment variable, e.g.: /opt/Android_NDK/r18b-android16-arm-standalone-toolchain/bin/
git clone https://github.com/pelya/commandergenius.git
. Once that is done, you must set-up an environment variable called SDL_ANDROID_PORT_PATH with the location
of the SDL android port. For example /opt/android/commandergenius
. You must also make sure to put it on to the revision that we are currently supporting. Set it to 61c5b7352b22be464487d559df5cb0d50bfbc605. You also need a to make a little change to it... in project/jni/Application.mk
in the line with APP_STL :=
replace c++_static
with c++_shared
.openjdk-8-jdk
(Debian), java-1.7.0-openjdk
(SuSE 12.2).ant
(Debian), ant-1.8.2-11.1.1.noarch
(SuSE 12.2).ant-optional
(Debian). Note that this seems to be not applicable for SuSE 12.2; apparently everything is bundled in the ant package.zip
(Debian Squeeze/6.0), zip
(SuSE 12.2).lib32z1
(Debian), zlib-32bit
(SuSE 12.2).lib32stdc++6
(Debian), libstdc++47-32bit
(SuSE 12.2).
After you installed the Android SDK, you actually only installed the "Android SDK Manager". You'll have to use this manager to install the proper Android SDK packages. Start up this tool by running android
in a terminal (it is located in the tools
folder of the SDK manager you downloaded). This works for the above mentioned older SDK Tools, but it doesn't for the new ones, so you should check these instructions which packages to install with the newer SDK managers. The old SDK manager opens a new window. You should first get some messages in the status bar that it is fetching the repositories. After that, you should get a list of all possible SDK API versions. If you get errors like HttpHostConnect Connection to http://dl-ssl.google.com refused
, you are hitting this bug: IPv4/6 Related Network Problems. You'll have to solve this to proceed.
Once you have the list of packages, you must select the following options for installation:
It may be possible that by default another version of the Android API is pre-selected. We're at least trying to target API 16 with this build. You may unselect other APIs in order to save download time and diskspace. (You also don't need the Android Support Package, so if it gets selected, you can also unselect that one.) Next step is to click the "Install N packages" button (N seems to vary a bit... it may be like 12) to install the packages (accept the license terms). After downloading and installing, you can close the Android SDK Manager. When you are trying to execute a build later on, and it stops with "license not accepted for package XYZ", then start the SDK Manager again to install the requested package.
Finally, add following Android SDK directories to your PATH environment
variable: ${ANDROID_SDK}/tools:${ANDROID_SDK}/platform-tools:${ANDROID_SDK}/build-tools/${ANDROID_SDK_VERSION}
. The first one only exists for older SDK managers, as explained earlier.
It is advisable to do this in your ~/.profile
script so that the setting remains available on each login. Note that ${ANDROID_SDK}
stands for the
directory in which you installed the Android SDK, for example /opt/android/android-sdk-linux
and ${ANDROID_SDK_VERSION}
stands for the version of the Android SDK Build-tools you installed with the SDK manager, for example 28.0.2
(see above).
openMSX depends on the following libraries:
You can install the required libraries systemwide, or you can use the "3rd party libraries" support in the openMSX build system and build a stand-alone binary. Systemwide is recommended if you run a modular operating system (such as Linux, BSD or macOS with MacPorts, Homebrew or Fink) and you intend to only use the openMSX binary on your computer. The 3rd party library system is recommended if you build for other operating systems (Windows, plain macOS or embedded systems) or if you want to build a binary that can be used on other computers besides your own. If you choose the latter, please skip to the Stand-alone Binary chapter.
For Android, the required SDL library is built in the SDL Android port that you downloaded in the "Build Tools" section. The rest of the libraries are arranged by the "3rd party libraries" support in the openMSX build system. If you want to build openMSX for Android, you can immediately jump to the Getting the source code chapter.
You can easily install all required packages using the "build dependencies" feature of the APT package manager (if you have source packages in your package sources list):
Do note that if the Debian/Ubuntu package that is in the version of the distribution you are currently running is older than the openMSX version you are trying to compile (which is typically so), you might miss some dependencies that were added in the newer version. The build system will complain and you will have to install the remaining (missing) packages manually. Read on to get some tips about that.
Typical dependending packages are: libsdl2-ttf-dev
libogg-dev
tcl-dev
libogg-dev
libpng-dev
libtheora-dev
libvorbis-dev
libsdl2-dev
. The complete list for Debian (which will be very very similar) is here.
We only support the Stand-alone Binary method, which means the openMSX build system will download and compile all libraries automatically.
Most Linux distributions have libraries split over two packages: a runtime package and a development package.
The runtime package for the "Foo" library is typically called
libfoo
, the development package is typically named
libfoo-dev
or libfoo-devel
.
Applications that use a library only require the runtime package to be installed, but compilation requires both the runtime package and the development package to be installed.
The easiest thing to do is to use the stand-alone binary method, which will get the libraries automatically.
If you want to do things manually, you can get the libraries from MacPorts, Homebrew or Fink. These are tools to give you access to a large collection of software packages (or ports). You can use them to install those packages (or ports). The manual approach is not regularly tested by the openMSX developers; unless you enjoy tinkering with builds we suggest you use the stand-alone binary approach instead.
We strongly recommend using the Stand-alone Binary method, which means the openMSX build system will download and compile all libraries automatically.
When building with Visual C++, the optional libraries mentioned above are arranged as follows:
Also, when building with Visual C++, the "3rd party libraries" support in the openMSX build system must be used. The resulting binary statically links in all dependencies, including the C runtime. For more details, please see the Stand-alone Binary chapter.
openMSX is developed using the tools GitHub freely offers to open source projects. The code is stored in Git, an open source version management system. Once in a while an openMSX release is made.
There are several options for getting the source code:
Releases are intended for general users, Git Clone is intended for (would be) developers, heavy testers and people who want to follow new developments closely. It might be a good idea to play with a release first. If you like what you see and want to get in deeper, you can switch to a Git Clone later. A Git Clone is very comfortable, because then you can do efficient incremental updates, saving network bandwidth and compile time.
If you downloaded a version that is either a lot older or a lot newer than
this guide, it is a good idea to read the guide included in your downloaded
version instead of the version you're reading right now.
You can find the Compilation Guide in the directory
doc/manual
.
You can download a released version of openMSX from the releases page on GitHub. The latest version is probably the best one. This guide assumes that you are using the latest release.
After downloading, type the following in a UNIX or MinGW Shell (in your start menu), or use another decompression tool:
in which VERSION
is the openMSX version you downloaded, or use the
file name you saved the tar.gz file with. The directory that is created by uncompressing the tar.gz
file
is called the top of the source tree.
Getting a Git clone means you use Git to retrieve the latest version
of the source code of openMSX.
This means you will need to install a Git client.
This package is usually named git
.
There are graphical front-ends for Git,
but this guide will tell you how to use Git from the command line. More information about Git can be found on the Git Documentation site.
Windows users might want to look at msysGit for a command line tool, TortoiseGit for Windows Explorer integration, or Git Extensions, which also includes Visual Studio integration.
With the following line (which is also displayed when you browse an openMSX git repository) you can retrieve the latest sources (also works on Windows when using msysGit):
In this line you specified where you want to retrieve the files from (host name of the Git server), what project you want to retrieve (openMSX in this case), what module you want to get (openMSX.git in this case, which is the module that contains the sources of the main openMSX program) and what directory it should be cloned to (we chose openMSX in this example).
When compiling openMSX on Windows with GCC, it's often convenient to use C:\MinGW\msys\1.0\home\<username>\openMSX
as the target directory, as this is easy to reach from your MinGW Shell - it's
your MinGW home directory.
If you're a developer, it makes sense to use this git commandline:
For this to work smoothly, without having to type your password all the time, it's probably a good idea to read the GitHub docs about SSH keys.
The Git command creates a directory called openMSX
for you
in the current directory (or in the directory you specified in TortoiseGit).
This directory is what we call in this manual the top
of the source tree.
In addition to the openMSX code, you will see a hidden
Git administration directory called .git
.
Do not mess with it (nor move contents of this directory around), otherwise Git will get confused.
If you want to update your source tree later, go to the top of the source tree and type:
or right click on the openMSX directory in Windows Explorer and select "TortoiseGit -> Pull...".
This section explains how to build openMSX for a local system. If you want to build openMSX for Android, you can skip this section and use the Android build method. If you want to create a binary that runs everywhere, we recommend to skip this chapter and use the stand-alone binary method. We also recommend to do that for macOS and especially for Microsoft Windows systems.
Now that all the necessary tools and libraries are installed, you are almost ready to start the actual compilation of openMSX.
The first thing you may want to know is that you can build openMSX in different flavours. The default flavour depends on the CPU, but is always one that is optimized for performance. For example for x86 processors the default flavour is "i686": i.e., with optimisations for Pentium II and higher, without any debugging stuff. The generic optimized flavour "opt" should work for all CPUs.
If you are testing new openMSX developments or making changes in openMSX, you can benefit from asserts and debug symbols. To get those, you should select the "devel" flavour, like this:
Although the default flavours will probably be OK for most cases, you may want to write a specific flavour for your particular wishes. The flavour files are all named build/flavour-*.mk
.
You can select the C++ compiler to be used by setting the CXX
environment variable like this:
or:
This can be useful if the default compiler on your system is an old version which is either not capable of compiling openMSX, or generates less efficient code.
Now we can let a script check if you have indeed all necessary libraries and headers installed. Go to the top of your openMSX source tree and run the following script:
This script will report what versions of libraries you have installed. It also reports which components can be built with those libraries. If the script reports that it can't build the openMSX core component, you should install the missing ones before you can continue. Otherwise, you can decide to install the libraries needed for the optional components, or to continue without building some components (e.g. the OpenGL based renderers).
If installing the correct libraries doesn't help,
contact the openMSX developers.
If you file a bug report, please attach the probe.log
file
that is written by the configure
script in the directory
derived/<cpu>-<os>-<flavour>/config/
.
You can customise the build process by editing the file
build/custom.mk
.
The most likely thing you might want to customise is the installation directory (INSTALL_BASE
).
If you are installing openMSX on a system on which you do not have
superuser (root) privileges, you can set the installation directory
to a subdirectory of your home directory.
After successfully running configure
,
it's time to compile everything.
To start compilation, type:
Depending on how fast your system is, this may take several minutes to half an hour.
If you get errors during compilation, there may be something wrong that was not detected by configure. Verify that you installed all required libraries, both the run time and development packages. If that doesn't help, or we forgot to list a library openMSX depends on, contact the openMSX developers. Make sure you provide us with the error message you got.
If you want to debug openMSX compilation problems yourself, you can add V=1
(verbose) to the Make command line to see all build commands as they are executed.
Since openMSX 0.10.0, the minimum required macOS release to build openMSX out of the box is 10.7. This implies that only x86_64 CPUs (64-bit Intel) are supported.
Building for older macOS releases should be possible in theory, but it requires a lot of effort to set up the compiler and SDK (C++11 support is required), adjust the openMSX build (build/platform-darwin.mk
) etc. It's easier to try an older openMSX release instead.
While it is possible to configure the supplied Visual C++ project files to dynamically link against import libraries, this is not currently supported.
To install openMSX, run the following command:
This installs openMSX, by default in /opt/openMSX
.
Note that only root has rights to write to system-wide directories such as
/opt
,
so you may have to do su
before make install
, or use sudo
.
On macOS, the build creates an application folder. You can "install" this by copying it to a different location. The application folder will depend on systemwide installed libraries, so it will not work on Macs without those libraries.
You can run openMSX from the application folder with the following command:
If you want to see the messages openMSX prints to stdout and stderr, start openMSX like this:
This chapter describes how to build a binary of openMSX that does not depend on any libraries except those that are available on the platform by default. This procedure is highly recommended on Microsoft Windows. It is also recommended on macOS.
The stand-alone binary is made by linking statically against all libraries which are not available as part of the basic platform. The build system will automatically download the sources for these libraries and build them in the minimal configuration needed by openMSX.
If you want to change something about this process, for example switch to a newer library release, edit the build/3rdparty.mk
Makefile.
Just like for normal compilation, you can set environment variables such as OPENMSX_FLAVOUR
, CXX
, OPENMSX_TARGET_CPU
and OPENMSX_TARGET_OS
.
To build a stand-alone binary, run the following command at the top of the source tree:
The final output files will be produced in derived/<cpu>-<os>-<flavour>-3rd/bindist
.
The final output is a DMG file (Mac disk image) containing the openMSX application folder and documentation. This file is internet-enabled, which means it will be automatically mounted after it is downloaded.
If you have a Apple Developers ID, you can automatically sign the app bundle by providing the following environment variable in your shell, before building the app bundle:
export CODE_SIGN_IDENTITY=<your Apple Application Developer ID here> make staticbindist
To find the exact string, needed for the CODE_SIGN_IDENTITY, you can use the command:
Check if the code signing was successful with:
Here's the very short version if you want quick results on Microsoft Windows with GCC:
cd openMSX
if you chose the MinGW home directory as target directory)make staticbindist
A complete package will be created in derived\x86-mingw32-i686-3rd\bindist\install
.
If you additionally want to build an (by current developers unused) openMSX installer, you should refer to the package-windows
module in our Git repository. It contains a README file with a short manual.
Note: on a 64-bit Windows system, MinGW will pretend to have built 64-bit binaries (target directory is derived\x86_64-mingw32-opt-3rd\bindist\install
), but they're actually just 32-bit.
After having the toolchain installed, you can simply compile openMSX with this command:
When this is done, you have a ready to use OPK file for distribution in the folder derived/mipsel-dingux-opt-3rd/
.
When building with Visual C++, the result is a static executable with minimal dynamic library dependencies. Two platforms are supported:
Three different configurations are supported:
When building with Visual C++, you can either use the IDE or build from the command line using msbuild
. To do the latter, you need to open a Visual Studio command prompt. A shortcut to a Visual Studio command prompt can usually be found in your start menu. For Visual Studio Community 2017, it will be in "Microsoft Visual Studio 2017\Visual Studio Tools" as the "Visual Studio Command Prompt".
In order to build openMSX, the libraries it depends on need to be downloaded and unpacked:
python build\thirdparty_download.py windows
The following steps can then be used to build openMSX:
msbuild -p:Configuration=Release;Platform=Win32 build\3rdparty\3rdparty.sln
msbuild -p:Configuration=Release;Platform=Win32 build\msvc\openmsx.sln
The openMSX executable will be generated in derived\Win32-VC-Release\install
.
To build for other platforms or configurations, simply replace "Release" and "Win32" in the command lines above with the desired options.
To build using the Visual C++ IDE, simply open the aforementioned solution files and from the Build menu select "Build Solution". This is exactly equivalent to building from the command line using msbuild
.
The following step creates .zip and .msi installation packages for openMSX on Windows using WiX:
build\package-windows\package.cmd platform configuration
catapult_source_path
:An example command line would be (for 64 bit):
The resulting package files can be found in derived\x64-VC-Release\package-windows.
Just copy the OPK file into the apps
directory.
Warning: the build instructions here are only valid for openMSX 0.15.0!
This chapter describes how to build an Android APK package of openMSX for Android and install it on an Android device.
Once you have downloaded the openMSX source (see Getting the Source Code chapter) and the toolkits and libraries (see Preparation chapter), you must integrate the openMSX build system with the SDL Android port build system.
Basically, the build will be driven by the build system of the SDL Android port and
you must set that one up in order to be able to build openMSX. In order to do that, you must execute the following
commands, whereby OPENMSX_SRC_HOME
stands for the directory into which the openMSX source has been loaded:
cd $OPENMSX_SRC_HOME/build/android ./setup_anddev.sh
In order to build the Android version, you must enter the following commands:
cd $OPENMSX_SRC_HOME/build/android/openmsx ./launch_anddev_build.sh
If this gives an error like "Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK.", you may have to set the environment variable JAVA_HOME
manually. E.g. if javac
is actually installed in /usr/lib/jvm/java-6-openjdk-amd64/bin
, make sure to export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
before running this command.
In order to install the Android version, you must connect the Android device with a USB cable to the computer, enable the "Developer options" in the settings menu and within the "Developers options" enable the "USB debugging" option. Once that is done, you can install the APK that was build in the previous step with the following commands:
cd $SDL_ANDROID_PORT_PATH adb install -r project/app/build/outputs/apk/app-release.apk
Alternatively, you can put this file on a place where you can access it with your device (e.g. on a webserver or sending an e-mail). Then you can download and install it like any APK file.
In order to build and directly install the Android version, you must enter the following commands:
cd $OPENMSX_SRC_HOME/build/android/openmsx ./launch_anddev_build.sh -i
Note that this only works when the "Developer options" -> "USB debugging" setting has been enabled on the Android device.
If all went well, you should have openMSX installed now or have a stand alone working binary. You can test it by executing openMSX from the command line:
or, by tapping (on Android) or double clicking (on other systems) the openMSX executable or icon that resulted from the previous step.
You should get a screen similar to this:
C-BIOS 0.25 cbios.sf.net No cartridge found. This version of C-BIOS can only start cartridges. Please restart your MSX (emulator) with a cartridge inserted.
C-BIOS MSX2+ is the default system BIOS used by openMSX. It was written from scratch by BouKiCHi and he was kind enough to let us distribute it together with openMSX. It is not perfect yet, but it runs many ROM games well. Nowadays C-BIOS is a separate (SourceForge.net) project, with its own web page.
If you have a ROM image ready, you can try to run it with C-BIOS:
or, you can just drop it on the openMSX executable.
The next step would be to read the openMSX Setup Guide. That document describes how you can configure openMSX to emulate actual MSX machines, such as the Panasonic FS-A1GT (turboR). It also describes how you can have openMSX start up with your personal settings, how you can configure openMSX and your system for optimal performance and several other configuration related topics. And finally there is of course the openMSX User's Manual, which describes all the things you can do with openMSX once it is fully running.
If you got stuck somewhere in the compilation and installation process, please contact us. The next chapter will tell you how.
You can run the openMSX application folder from Finder or from the command line:
We do not have a finished GUI yet that works on macOS, so you can either use openMSX from the command line for now, or use third party software like NekoLauncher openMSX.
You can use the Catapult launcher to run openMSX.
Since openMSX is still under heavy development, feedback and bug reports are very welcome!
If you encounter problems, you have several options:
#openMSX
on libera.chat
and ask your question there. Also reachable via webchat! If you don't get a reply immediately, please stick around for a while, or use one of the other contact options. The majority of the developers lives in time zone GMT+1. You may get no response if you contact them in the middle of the night...
openmsx-user
mailing list.
If you want to address the openMSX developers directly,
post a message to the openmsx-devel
mailing list.
More info on the
openMSX mailing lists,
including an archive of old messages, can be found at SourceForge.
In all cases, please provide as much information as possible when you describe your bug or request.
For experienced users: if you get a crash or a hang,
try to provide a gdb
backtrace.
This will only work if you did not strip the openMSX binary
of its debug symbols.
Another useful thing to do is to install the debug versions of libstdc++ and libc6,
and then run openmsx with an LD_LIBRARY_PATH=/usr/lib/debug
exported in the environment.
This will give a more detailed stacktrace, especially in optimized code.
For experienced users: if you get a crash or a hang, try to provide a user dump. This will work for any openMSX binary, including pre-built binaries obtained from openmsx.org.
As of Windows Vista SP1 and later operating systems, you can find user dump files for crashed processes in the "%LocalAppData%\CrashDumps" directory. The default Windows crash dump behavior can be further customized as per MSDN.
To generate a user dump on demand on any Windows OS, please read KB286350.