dosbox-x

Building DOSBox-X

The page is about manually building the DOSBox-X source code. Automated development (preview) builds intended for testing purposes for various platforms are also available from the DOSBox-X Development Builds page. Released builds are available from the Releases page.

For instructions on installing and using DOSBox-X, please look at the INSTALL page and the DOSBox-X Wiki.

General information on source code compilation

The four major operating systems and platforms of DOSBox-X are:

  1. Windows 11, 10, 8, 7, Vista and XP, 9x/NT4 for 32-bit and 64-bit x86/x64 and ARM
  2. Linux (with X11) 64-bit x86/x64, and on a Raspberry Pi 3/4/5
  3. macOS (Mac OS X) High Sierra and after, Intel, ARM-based, and Universal
  4. DOS (MS-DOS 5.0+ or compatible)

The code requires a C++ compiler that can support the C++11 standard.

DOSBox-X supports both SDL (Simple Directmedia Library) versions 1.x and 2.x.

Note that SDL1 version requires the in-tree SDL 1.x library since it has been heavily modified from the original SDL 1.x source code and is thus somewhat incompatible with the stock library.

Such modifications provide additional functions needed to improve DOSBox-X and fix many issues with keyboard input, window management, and display management that previously required terrible kludges within the DOSBox and DOSBox-X source code.

In Windows, the modifications also permit the emulation to run independent of the main window so that moving, resizing, or using menus does not cause emulation to pause.

In macOS, the modifications provide an interface to allow DOSBox-X to replace and manage the macOS menu bar.

On the other hand, only a slight modification regarding IME support on Windows and macOS are added to the in-tree SDL2 code, so Linux and macOS users may choose to use the original SDL2 library, while on Windows in-tree SDL2 code is always used.

Please look at the README.source-code-description file for more information and descriptions on the source code.

Compiling the source code using Visual Studio (Windows)

The source code can be built with Visual Studio 2017, 2019, and 2022. The executables will work on 32-bit and 64-bit Windows Vista or higher.

Use the ./vs/dosbox-x.sln “solution” file, select 32/64-bit, SDL1/2 and build the source code. You will need the DirectX 2010 SDK for Direct3D9 support.

By default the targeted platform is v142 (Visual Studio 2019). Change it to v141 (VS2017) or v143 (VS2022) accordingly to your build environment.

WindowsTargetPlatformVersion is set to 10.0 by default, which make VS pick the latest Windows SDK version installed, but VS2017 requires you to explicitly set the version installed in your PC, for example 10.0.22000.0. Note that ARM builds requires versions 10.0.22621.0 or before.

To build executables that will work on Windows XP, you have to change the target platform to v141 (Visual Studio 2017). After the build is completed, you have to patch the PE header of the executable using a tool included in the source code.

./contrib/windows/installer/PatchPE.exe path-to-your-exe-file/dosbox-x.exe

Libraries such as SDL, freetype, libpdcurses, libpng and zlib are already included, and as of DOSBox-X 0.83.6 support for FluidSynth MIDI Synthesizer is also included for Windows builds (set mididevice=fluidsynth in the [midi] section of DOSBox-X’s configuration file (dosbox-x.conf) along with required soundfont file [e.g. FluidR3_GM.sf2 or GeneralUser_GS.sf2] to use it).

The slirp backend for the NE2000 network emulation is only supported by MinGW builds but not Visual Studio builds.

Build the source code for your platform (Win32, x64, ARM and ARM64 are supported).

As of 2018/06/06, Visual Studio 2017 builds (32-bit and 64-bit) explicitly require a processor that supports the SSE instruction set. As of version 2022.09.01, Visual Studio ARM/ARM64 builds require a Windows SDK that includes the OpenGL library.

Visual Studio Code is supported, too.

Check the README.development-in-Windows file for more information about this platform.

Compiling the source code using MinGW (Windows)

Depending on the target OS to run DOSBox-X, the build environment and procedures will vary.

NOTICE: Lowend builds should NOT be compiled with MinGW-w64 since they have extra dependencies which are not supported by Windows XP, Vista and 9x/NT4.

General procedures to compile the source code (cross-platform)

To compile DOSBox-X in Ubuntu (tested with 20.04 and 20.10):

First install the development tools, headers and libraries needed

sudo apt install automake gcc g++ make libncurses-dev nasm libsdl-net1.2-dev libsdl2-net-dev libpcap-dev libslirp-dev fluidsynth libfluidsynth-dev libavdevice58 libavformat-dev libavcodec-dev libavcodec-extra libavcodec-extra58 libswscale-dev libfreetype-dev libxkbfile-dev libxrandr-dev

Then change to the directory where you unpacked the DOSBox-X source code, and run the following commands:

./build-debug
sudo make install

Alternatively you can also compile the SDL2 version by running the ./build-debug-sdl2 script.

To compile DOSBox-X in Fedora Workstation:

First install the development tools, headers and libraries needed

 sudo dnf group install "C Development Tools and Libraries"
 sudo dnf install SDL_net-devel SDL2_net-devel libxkbfile-devel ncurses-devel libpcap-devel libslirp-devel libpng-devel fluidsynth-devel freetype-devel nasm

If you want to be able to record video, you will also need to install ffmpeg-devel which you can get from the optional rpmfusion-free repository. Then change to the directory where you unpacked the DOSBox-X source code, and run the following commands:

 ./build-debug
 sudo make install

Alternatively you can also compile the SDL2 version by running the ./build-debug-sdl2 script.

To create a DOSBox-X RPM for use in RHEL, CentOS or Fedora:

First ensure that your system has all the necessary development tools and libraries installed, such as by following the dnf steps in the above “To compile DOSBox-X in Fedora Workstation”. Then run the following commands:

 sudo dnf group install "RPM Development Tools"
 ./make-rpm.sh

After a successful compile, the RPM can be found in the releases directory.

To compile DOSBox-X in Raspberry Pi:

The official Raspberry PI website has an article including build instructions from source.
https://www.raspberrypi.com/news/read-floppy-disks-and-cd-roms-with-raspberry-pi-5-magpimonday/

sudo apt install libtool autogen autoconf automake libncurses-dev gcc g++ make libncurses-dev nasm libsdl-net1.2-dev libsdl2-net-dev libpcap-dev libslirp-dev fluidsynth libfluidsynth-dev libavformat-dev libavcodec-dev libavcodec-extra libswscale-dev libfreetype-dev libxkbfile-dev libxrandr-dev 
git clone https://github.com/joncampbell123/dosbox-x.git
cd dosbox-x
./build-debug

If you have audio problems, you may want to try the SDL2 build using ./build-debug-sdl2 script.

Compiling the source code in macOS (High Sierra and after)

macOS builds are expected to compile on the terminal using GNU autotools and the LLVM/Clang compiler provided by XCode. Universal macOS builds are only possible when building on a host machine powered by an Apple Silicon CPU, due to requiring parallel Homebrew installations running natively and under Rosetta 2.

To compile DOSBox-X for DOS with HX-DOS platform

Libraries used by DOSBox-X

The following libraries are used by DOSBox-X:

Configure script options

The DOSBox-X configure script accepts the following switches, which you can use to customize the code compilation: