Building Ardour on Windows with MSYS2

NOTE: This post was written for Ardour 4. There is at least one more dependency (liblua, possibly more). Since I wrote this article, I’ve mostly shifted my development environment to linux, hence I haven’t kept this post up to date. So, caveat emptor, YMMV, and other suitable disclaimers. If you just want to use Ardour on Windows, it is now supported on Windows, so why not donate to the Ardour developers and get an official download? I’m currently toying with building Ardour for Windows via the Windows Subsystem for Linux on Windows 10, but a post on that is a bit far away.

Building Ardour on Linux is quick and easy. Building Ardour on Windows…isn’t. That being said, I bashed my way through it, and have come up with a strategy that will get you up and running.

Who is this post for?

This post is most definitely for developers, familiarity with MSYS2 is handy, but as I was basically learning how MSYS2 works as I went, this post won’t assume terribly much on that score. If you just want to use Ardour on Windows I highly recommend downloading a nightly build and using that instead. Keep in mind that Ardour is un-ashamedly built for linux, and it is fantastic on that platform, so if you want the most out of Ardour, use it on linux. If you MUST use windows, know that at present it isn’t supported, and sometimes the nightly builds might be broken. That being said the Ardour developer community is looking into how support could become possible one day.

Other things you might want installed

I find it is handy to have JACK and ASIO4ALL installed.

Getting Started

The first thing you’ll need to do is install MSYS2, but what is MSYS2? Google says this:

MSYS2 is a successor of MSYS and MinGW-builds. 
MSYS2-shell uses “pacman” for downloading packages from
repo, and these are GPG signed & verified. Packages are
by developer: lexx83 (Alexpux), mingwandroid, niXman.

Essentially it is a very light gnu-like environment for Windows, like a very stripped down cygwin. It makes it a lot easier to build linux programs and libraries for windows that don’t use Cmake. There is a good set of instructions here on how to install it and set it up, so I won’t copy them.

Great, now that you’ve followed all the way through that, you should have an up-to-date msys2 system. Now we have a few packages that need to be installed, well, quite a few, most of them from source, but we’ll do it in four batches: tools, prebuilt dependencies, source dependencies, and then some more pre-built packages which require some of our source packages. Before that we should discuss the three shells available to you:

  • MSYS2 shell
  • MinGW-w64 Win64 shell
  • MinGW-w64 Win32 shell

Essentially, the MSYS2 shell is a runtime environment with full posix support. This is most useful for the unix tools. The other two shells have less posix compliance, but play much nicer with the windows APIs, so if you want to build a windows application, you’ll use these. Of these latter two, I’m only using the MinGW-w64 Win64 shell, which uses a 64bit toolchain. That being said, it is easiest of you do all of the package installation (both pre-built, and from source) in the MSYS2 shell. There’s a bunch more detail here.

Install various tools
> pacman -S mingw-w64-x86_64-toolchain python3 \
python3-setuptools mingw-w64-x86_64-python3 \
mingw-w64-x86_64-python3-setuptools python2 \
python2-setuptools pkg-config \
mingw-w64-x86_64-pkg-config autoconf automake perl \
gtk-doc flex bison patch libtool \
mingw-w64-x86_64-libtool wget git nasm \
mingw-w64-x86_64-nasm dos2unix mingw-w64-x86_64-cmake

This will take a while based on your internet connection, etc.

Install pre-built dependencies
> pacman -S mingw-w64-x86_64-glib2 \
mingw-w64-x86_64-gobject-introspection \
mingw-w64-x86_64-pkg-config mingw-w64-x86_64-c-ares \
mingw-w64-x86_64-ca-certificates \
mingw-w64-x86_64-gnutls mingw-w64-x86_64-libidn \
mingw-w64-x86_64-libssh2 mingw-w64-x86_64-rtmpdump \
mingw-w64-x86_64-gnutls libgnutls-devel \
libutil-linux-devel gtk-doc \
mingw-w64_x86_64-docbook-xsl intltool \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-jbigkit \
mingw-w64-x86_64-ladspa-sdk

Build and install source dependencies

So the thing about MSYS2 is that it stays very “bleeding edge”, whereas most of the Ardour devs use Debian, which has quite a long update cycle. Both approaches have their merit, but they come into conflict when you want to build something that expects debian-ish packages, but have only the most up-to-date packages available. Thankfully, others have blazed this trail before me and have created repositories of package build scripts for most of the packages you’ll need for Ardour. Most of these are quite straight-forward to install, but there are some mighty strange quirks, which we’ll discuss as we get to them.

To get these package scripts, clone my github fork of them:

> git clone https://github.com/guysherman/MINGW-packages

NB: Make sure to switch to the guypkgs branch!

As the README says, to make a given package do the following:

> cd ${package-name}
> makepkg-mingw

And to install it do:

> pacman -U ${package-name}*.pkg.tar.xz

Alternatively, you can do this to build and install at once:

> cd ${package-name}
> makepkg-mingw --install

There are also a few useful flags that you’ll need at times:

--nocheck - disables the 'check' step, which is usually
            unit tests
--nodeps - disables dependency checking, which is 
           useful because a few packages have cyclic 
           runtime dependencies
--skippgpcheck - doesn't check the signature of the 
                 package, I needed this on a couple of
                 packages, only use it if you have 
                 errors relating to unknow public keys,
                 or the pgp part of the process.

So, now that we’ve covered how to build and install the packages, build and install the following list of packages:

 mingw-w64-x86_64-icu
 mingw-w64-x86_64-boost
 mingw-w64-x86_64-curl
 mingw-w64-x86_64-fftw
 mingw-w64-x86_64-libusb
 mingw-w64-x86_64-libxml2
 mingw-w64-x86_64-libogg
 mingw-w64-x86_64-libflac
 mingw-w64-x86_64-libvorbis
 mingw-w64-x86_64-libsndfile
 mingw-w64-x86_64-libsamplerate
 mingw-w64-x86_64-soundtouch
 mingw-w64-x86_64-wineditline
 mingw-w64-x86_64-pcre with --nocheck
 mingw-w64-x86_64-cppunit
 mingw-w64-x86_64-taglib
 mingw-w64-x86_64-dlfcn
 mingw-w64-x86_64-gobject-introspection with --nodeps
 mingw-w64-x86_64-gnome-doc-utils
 mingw-w64-x86_64-gtk-doc
 mingw-w64-x86_64-gnome-common
 mingw-w64-x86_64-atk
 mingw-w64-x86_64-libpng

These should all be straight forward, but some of the will take a long time. Next we get into the weirdest quirk I’ve seen in a while. There are two libraries, harfbuzz and freetype. Turns out they have a circular dependency on eachother. So what you have to do is

First, build and install harfbuzz with –nodeps

> cd mingw-w64-x86_64-harfbuzz
> makepkg-mingw --nodeps --install

This will end up installing the following packages from the pre-built repositories, but the freetype will have no harfbuzz support:

mingw-w64-x86_64-cairo
mingw-w64-x86_64-fontconfig
mingw-w64-x86_64-freetype
mingw-w64-x86_64-pixman

So, next step delete the harfbuzz package that you already built and rebuild it (assuming your still in the harfbuzz directory):

> rm -rf mingw-w64-x86_64-harfbuzz*.pkg.tar.gz
> makepkg-mingw --nodeps --install

Next build and install the following packages:

mingw-w64-x86_64-freetype
mingw-w64-x86_64-fontconfig
mingw-w64-x86_64-pixman

Ok, now that’s the harfbuzz freetype weirdness out of the way. You should be good to go ahead and install the rest of the source packages:

 mingw-w64-x86_64-pango
 mingw-w64-x86_64-libjpeg-turbo
 mingw-w64-x86_64-jasper
 mingw-w64-x86_64-libtiff
 mingw-w64-x86_64-gdk-pixbuf2 
 mingw-w64-x86_64-shared-mime-info
 mingw-w64-x86_64-gtk2 
 mingw-w64-x86_64-libsigc++
 mingw-w64-x86_64-cairomm
 mingw-w64-x86_64-glibmm
 mingw-w64-x86_64-atkmm
 mingw-w64-x86_64-pangomm
 mingw-w64-x86_64-gtkmm
 mingw-w64-liblo
 mingw-w64-serd
 mingw-w64-sord
 mingw-w64-lv2
 mingw-w64-sratom
 mingw-w64-lilv
 mingw-w64-aubio
 mingw-w64-portaudio
 mingw-w64-jack
 mingw-w64-libltc

The second wave of pre-built packages

Ok, so now there are two more pre-built packages that you need to install:

> pacman -S mingw-w64-x86_64-rubberband \
mingw-w64-x86_64-vamp-plugin-sdk
Actually Building Ardour

Ok, so now you have all the dependencies you need to build and run Ardour (although we’ll discuss one other work around a bit later which solved a problem that I had, that I’m not sure if you will encounter or not).

For now you’ll need to clone my fork of Ardour. I’ll update when my pull request is accepted. Get the ardour code (do this from somewhere you’d like the code to go):

> git clone https://github.com/guysherman/ardour.git
> git clone git://git.ardour.org/ardour/ardour.git
> cd ardour

Ardour uses the waf build system. I found there was a tiny quirk with running it under MSYS. Run it as follows to configure Ardour:

> MSYSTEM=''
> ./waf configure \
  --dist-target=mingw \
  --prefix=/mingw64 \
  --configdir=/share

Then to build it, run

> ./waf

If you want to install it you can do so with

> ./waf install

I’m more interested in running it:

> cd gtk2_ardour
> ./ardev-win

Now, you might find that you get white text on white buttons, like I did, and you’ll probably see warnings about the gtk ‘clearlooks’ engine. I worked out a weird work around for this.

Weird clearlooks workaround

Go to a folder somewhere (ie ~/), and get the gtk-engines source code:

> cd ~/
> wget http://ftp.gnome.org/pub/GNOME/sources/gtk-engines/2.20/gtk-engines-2.20.2.tar.gz
> cd gtk-engines-2.20.2
> ./configure \
  --build=x86_64-w64-mingw32 \
  --host=x86_64-w64-mingw32 \
  --prefix=/mingw64
> make
> make install

You’ll get a whole lot of warnings that it can’t find various dlls. That’s no biggie in this case.

Next you’ll want to download a nightly build of ardour for windows and install it.

Then copy C:\Program Files\Ardour4\lib\gtk-2.0\engines\libclearlooks.la to C:\msys64\mingw64\lib\gtk-2.0\2.10.0\engines. It’ll want to over-write a file, which is all good. Now if you go back and run Ardour, it should look fine.

UPDATE: ACKNOWLEDGEMENTS

It occurred to me after I wrote this that I should have acknowledged all the help the Ardour devs gave me while I was asking pesky questions. They are a very helpful and welcoming group.

16 thoughts on “Building Ardour on Windows with MSYS2

  1. wow, nice walkthough. Thanks.

    A quick note regarding the circular dependency. Just build freetype with -with-harfbuzz=no
    and libharfbuzz after that. No need to look back. None of the libs nor Ardour itself uses freetype’s harfbuzz engine directly (it all goes via pango -> harfbuzz -> freetype).

  2. Thanks mate, that was helpful.

    Some packages are missing from your github repository, or would not compile so I had to use a combination of these: https://github.com/Alexpux/MINGW-packages and https://github.com/mojofunk/MINGW-packages.

    Also, there are a few typos: dockbook-xsl should be docbook-xsl (though you don’t need to manually install that, so it could be removed), and mingw-m64-x86_64-toolchain should be mingw-w64-x86_64-toolchain.

    Great job anyway, cheers!

    1. I’ve now updated the post to fix the typos, and include a note to switch to the guypkgs branch of the MINGW-packages repository, which may have been the issue you had with getting some of those packages sorted.

  3. Hi,
    I got as far as the command
    makepkg-mingw –install
    but that gave me an error below:
    /home/Frank/MINGW-packages/mingw-w64-icu/PKGBUILD: line 86: make: command not found
    ==> ERROR: A failure occurred in build().
    Line 86 runs “make”, and sure enough I dont have make on the path. Doesnt seem to be even installed. I googled and someone suggested to run
    pacman -S make
    That works, thought I would point it out for anyone else who stumbles over the same rocky outcrop.

    Any ideas?

    1. You might have been using the wrong MSYS2 shell, there are three of them, you have to use the MSYS2 shell to do the installing of packages, but to build stuff you have to use either the MinGW-w64 shell or the MinGW-w32 shell (these have the paths set appropriately). Note, I’m about to put a warning at the top of this post that it is not valid as of the release of Ardour 5.

  4. ./waf configure –dist-target=mingw –prefix=/mingw64 –configdir=/share
    Setting top to : C:\msys64\home\Administrator\ardour
    Setting out to : C:\msys64\home\Administrator\ardour\build
    Checking for ‘msvc’ (c compiler) : not found
    Checking for ‘gcc’ (c compiler) : C:\msys64\mingw64\bin\gcc.exe
    Checking for ‘msvc’ (c++ compiler) : not found
    Checking for ‘g++’ (c++ compiler) : C:\msys64\mingw64\bin\g++.exe
    Checking for program windres : C:\msys64\mingw64\bin\windres.exe
    Global Configuration
    * Install prefix : C:/msys64/mingw64
    * Debuggable build : True
    * Build documentation : False
    Ardour Configuration
    * Will build against private GTK dependency stack : no
    * Will rely on libintl built into libc : yes
    * Will build against private Ardour dependency stack : no
    Checking for program pkg-config : C:\msys64\mingw64\bin\pkg-config.exe
    Checking for ‘glib-2.0’ >= 2.28 : yes
    Checking for ‘gthread-2.0’ >= 2.2 : yes
    Checking for ‘glibmm-2.4’ >= 2.32.0 : yes
    Checking for ‘sndfile’ >= 1.0.18 : yes
    Checking for ‘giomm-2.4’ >= 2.2 : yes
    Checking for ‘libcurl’ >= 7.0.0 : yes
    Checking for ‘liblo’ >= 0.26 : yes
    Checking for ‘taglib’ >= 1.6 : yes
    Checking for ‘vamp-sdk’ >= 2.1 : yes
    Checking for ‘vamp-hostsdk’ >= 2.1 : yes
    Checking for ‘rubberband’ : yes
    Checking for sndfile RF64=>RIFF support : Not found, no RF64-to-WAV support
    Checking for function htonl : yes
    Checking for function regcomp : yes
    Checking for pthread posix semaphore : Found
    Checking for clang : no
    Checking for ‘fftw3f’ : yes
    Checking for ‘aubio’ >= 0.3.2 : yes
    Checking for ‘aubio’ >= 0.4.0 : yes
    Checking for ‘libxml-2.0’ : yes
    Checking for ‘sigc++-2.0’ >= 2.0 : yes
    Checking for function getmntent : not found
    Checking for header execinfo.h : not found
    Checking for header unistd.h : yes
    Checking for function posix_memalign : no
    Checking for function localtime_r : not found
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/weak_ptr.hpp : yes
    Checking for library ole32 : yes
    Checking for ‘cppunit’ >= 1.12.0 : yes
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/weak_ptr.hpp : yes
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/weak_ptr.hpp : yes
    Checking for header cwiid.h : not found
    Checking for ‘jack’ >= 0.121.0 : yes
    Checking for ‘portaudio-2.0’ >= 19 : yes
    Checking for JACK metadata API : ok
    Checking for program gas,as,gcc : C:\msys64\mingw64\bin\as.exe
    Checking for ‘samplerate’ >= 0.1.0 : yes
    Checking for ‘lv2’ >= 1.0.0 : yes
    Checking for ‘lv2’ >= 1.2.0 : yes
    Checking for ‘lv2’ >= 1.10.0 : yes
    Checking for ‘serd-0’ >= 0.14.0 : yes
    Checking for ‘sord-0’ >= 0.8.0 : yes
    Checking for ‘sratom-0’ >= 0.2.0 : yes
    Checking for ‘lilv-0’ >= 0.14.0 : yes
    Checking for ‘lilv-0’ >= 0.16.0 : yes
    Checking for ‘lilv-0’ >= 0.19.2 : yes
    Checking for ‘lilv-0’ >= 0.21.3 : yes
    Checking for ‘suil-0’ >= 0.6.0 : not found
    Checking for ‘ogg’ >= 1.1.2 : yes
    Checking for ‘flac’ >= 1.2.1 : yes
    Checking for header sys/vfs.h : not found
    Checking for header sys/statvfs.h : not found
    Checking for header unistd.h : yes
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/weak_ptr.hpp : yes
    Checking for header boost/scoped_ptr.hpp : yes
    Checking for header boost/ptr_container/ptr_list.hpp : yes
    Checking for ‘gtkmm-2.4’ >= 2.8 : yes
    Checking for ‘gtk+-2.0’ >= 2.12.1 : yes
    Checking for ‘samplerate’ >= 0.1.7 : yes
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/format.hpp : yes
    Checking for ‘cairomm-1.0’ >= 1.8.4 : yes
    Checking for ‘lv2’ >= 1.0.0 : yes
    Checking for ‘fftw3f’ >= 3.3.5 : not found
    Checking for ‘gthread-2.0’ >= 2.10.1 : yes
    Checking for ‘gtk+-2.0’ >= 2.18 : yes
    Checking for ‘x11’ >= 1.1 : not found
    Checking for ‘fontconfig’ : yes
    Checking for header boost/shared_ptr.hpp : yes
    Checking for header boost/weak_ptr.hpp : yes
    * build session-utils : no
    * Build documentation : False
    * Debuggable build : True
    * Export all symbols (backtrace) : False
    * Install prefix : C:/msys64/mingw64
    * Strict compiler flags : []
    * Internal Shared Libraries : True
    * Use External Libraries : False
    * Library exports hidden : True
    * ALSA DBus Reservation : False
    * Architecture flags : None
    * Aubio : True
    * AudioUnits : False
    * Free/Demo copy : False
    * Build target : mingw
    * CoreAudio : False
    * CoreAudio 10.5 compat : False
    * Debug RT allocations : False
    * Debug Symbols : True
    * Process thread timing : False
    * Denormal exceptions : False
    * FLAC : True
    * FPU optimization : True
    * Freedesktop files : False
    * Libjack linking : weak
    * Libjack metadata : True
    * LV2 UI embedding : False
    * LV2 support : True
    * LXVST support : False
    * OGG : True
    * Phone home : True
    * Program name : Ardour
    * Samplerate : True
    * PT format : False
    * PTW32 Semaphore : False
    * Translation : True
    * Unit tests : False
    * Mac i386 Architecture : False
    * Mac ppc Architecture : False
    * Windows VST support : False
    * Wiimote support : False
    * Windows key : Mod4><Super
    * PortAudio Backend : False
    * CoreAudio/Midi Backend : False
    * ALSA Backend : False
    * Dummy backend : False
    * JACK Backend : True
    * C compiler flags : ['-IC:\\msys64\\home\\Administrator\\ardour', '-DPLATFORM_WINDOWS', '-DCOMPILER_MINGW', '-DUSE_CAIRO_IMAGE_SURFACE', '-DWAF_BUILD', '-g', '-fshow-column', '-DARCH_X86', '-msse', '-mfpmath=sse', '-DUSE_XMMINTRIN', '-masm=att', '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter', '-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE', '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64', '-DENABLE_NLS', '-DPROGRAM_NAME="Ardour"', u'-DPROGRAM_VERSION="4"', '-Wstrict-prototypes', '-Wmissing-prototypes']
    * C++ compiler flags : ['-IC:\\msys64\\home\\Administrator\\ardour', '-DPLATFORM_WINDOWS', '-DCOMPILER_MINGW', '-DUSE_CAIRO_IMAGE_SURFACE', '-DWAF_BUILD', '-g', '-fshow-column', '-DARCH_X86', '-msse', '-mfpmath=sse', '-DUSE_XMMINTRIN', '-masm=att', '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter', '-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE', '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64', '-DENABLE_NLS', '-DPROGRAM_NAME="Ardour"', u'-DPROGRAM_VERSION="4"', '-Woverloaded-virtual', '-Wno-unused-local-typedefs', '-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS', '-DCANVAS_COMPATIBILITY', '-DCANVAS_DEBUG']
    * Linker flags : ['-Wl,–enable-auto-import', '-Wl,–enable-auto-import', '']
    'configure' finished successfully (30.221s)

    You are missing the cwiid headers needed to compile wiimote support
    session-utils depend on the dummy backend.

    Backends:

  5. When i run ./waf ,it build failed.
    missing some build dependencies ?
    ardour version: 4.7-1011-g1968f94

    “failed message”
    In file included from C:\msys64\mingw64\include\sigc++-2.0/sigc++/functors/slot.h:8:0,
    from C:\msys64\mingw64\include\sigc++-2.0/sigc++/signal_base.h:27,
    from C:\msys64\mingw64\include\sigc++-2.0/sigc++/signal.h:8,
    from C:\msys64\mingw64\include\sigc++-2.0/sigc++/sigc++.h:104,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/signalproxy.h:28,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/objectbase.h:23,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/wrap.h:23,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/containerhandle_shared.h:25,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/arrayhandle.h:23,
    from C:\msys64\mingw64\include\glibmm-2.4/glibmm/miscutils.h:24,
    from ..\libs\pbd\basename.cc:21:
    C:\msys64\mingw64\include\sigc++-2.0/sigc++/functors/slot_base.h:313:15: warning: inline function ‘bool sigc::slot_base::empty() const’ used but never defined
    inline bool empty() const noexcept
    ^
    C:\msys64\mingw64\include\sigc++-2.0/sigc++/functors/slot_base.h:319:15: warning: inline function ‘bool sigc::slot_base::blocked() const’ used but never defined
    inline bool blocked() const noexcept
    ^
    Waf: Leaving directory `C:\msys64\home\Administrator\ardour\build’
    Build failed
    -> task in ‘liblua’ failed (exit status 1):

    1. -> task in ‘liblua’ failed (exit status 1):
      {task 47506960L: cxx luastate.cc -> luastate.cc.1.o}
      -> task in ‘libpbd’ failed (exit status 1):
      {task 48228304L: cxx basename.cc -> basename.cc.2.o}
      -> task in ‘libpbd’ failed (exit status 1):
      {task 48228432L: cxx base_ui.cc -> base_ui.cc.2.o}

      1. Looks like you’re trying to build Ardour 5, this post isn’t up to date. I’m not sure whether you’ll find a liblua package for MSYS2 or not, it couldn’t hurt to have a look. I’m about to put a warning at the top of the post.

  6. I kind of got stuck when trying to do the makepkg-mingw step. Got a nice ==> ERROR: PKGBUILD does not exist.
    message.

  7. The problem is sigc++-2.0 and gcc. Update sigc++ and compile it with the same compiler… or try to work-around with `./waf configure -cxx11 ….`
    (Ardour’s source does include Lua, and liblua is early in the compile process and the first to stumble over this)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s