A Docker based build environment for XCSoar.
If you are using macOS or Windows and want to do some quick changes to XCSoar without investing into the the build toolchain on your machine this Docker based dev setup for XCSoar might be for you.
The Linux based development toolchain for XCSoar is well supported and generally working well. By using a Docker based setup in macOS or Windows we can benefit from this situation.
Note: the Docker image is currently only tested on macOS because I have no need for a Windows environment at the moment. If somebody tests this on Windows and finds issues please drop an issue or PR.
- Docker for Mac (macOS) or Docker for Windows (Windows)
- An X11 server on your host system
- macOS: XQuartz
- socat - Multipurpose relay (SOcket CAT)
- Install Docker for Mac
- Install the remaining dependencies using Homebrew
brew install socat brew cask install xquartz
Please ensure to restart your Mac after you have installed XQuartz, it is needed for its environment to work correctly.
-
To forward X11 network traffic out of Docker to the X servers UNIX socket run
socat
on the host machine in a separate terminal (it will block):socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
-
Now you can work inside the directory of the XCSoar source, e.g. compiling it:
docker run -it --rm -w /src -v $PWD:/src:delegated sandrinr/xcsoar-buildenv make OPENGL=n ENABLE_SDL=y
The
-w /src -v $PWD:/src:delegated
is important for the image to work and have access to your XCSoar source. -
Once you have a compiled project you can run XCSoar. If you have an X11 server installed and the
socat
command from above running, then XCSoar should show up on your host machine.docker run -it --rm -w /src -v $PWD:/src:delegated sandrinr/xcsoar-buildenv output/UNIX/bin/xcsoar
Should this image show traction we could extend it in many ways. Possible ideas:
-
Improve the compilation speed by using some trickery with rsync and cache Docker volumes or some other network storage system, such as NFS.
-
Add support to crossbuild XCSoar to all the different supported platforms.
-
Add support for similar projects, such as LK8000.
-
XCSoar would normally use hardware rendering in the standard Linux platform. However, this is not supported through networked X11 connections. Therefore we need to use software rendering using the
OPENGL=n ENABLE_SDL=y
flags tomake
. This results in a more sluggish user experience than what would be expected using hardware rendering. -
Compiling XCSoar using the approach above takes considerably more time (about 2x). There would be ways to speed it up. At the moment the approach is simple. If this method gains traction then I might invest in some performance improvements.
-
It should be clear that the experience using this method to build and use XCSoar is inferior to using it on the host platform directly. This method is intended to do some quick tests or changes to XCSoar. If you are planning to do some major work then it might be worth investing into a working toolchain on your host system.
Contributions are always welcome in the form of issues or PRs.