Skip to content

MinGW Toolchain

Taner Sener edited this page Aug 21, 2026 · 1 revision

This page describes the MSYS2 / MinGW-w64 toolchain used to build FFmpegKitNext for Windows.

For Windows build commands, see Building Windows. For the Windows script option reference, see windows.sh.

Windows builds are native MSYS2 builds. Nix is not used on Windows because it does not provide the MinGW-w64 target toolchain required by windows.sh.

1. Install MSYS2

Download and install MSYS2 from msys2.org.

Use the native installer for the Windows host:

  • arm64 Windows host: install the ARM64 MSYS2 package and use the CLANGARM64 shell.
  • x86-64 Windows host: use the CLANG64 shell for experimental x86-64 builds. x86-64 support is implemented but not yet tested.

Do not run the build from the plain MSYS shell. It provides POSIX host tools, not the MinGW-w64 compiler environment used to produce native Windows DLLs.

2. Update MSYS2

Open the matching MinGW shell and update the package database and installed packages:

pacman -Syu

If MSYS2 asks you to close the terminal after updating core packages, close it, open the same MinGW shell again and run:

pacman -Syu

3. Verify the Environment

Check that the active shell is the intended MinGW environment:

echo "$MSYSTEM"
echo "$MINGW_PACKAGE_PREFIX"
clang --version

For supported arm64 builds, the values should identify CLANGARM64, and MINGW_PACKAGE_PREFIX should be mingw-w64-clang-aarch64.

4. Install Required Packages

Install the compiler, pkg-config implementation and mandatory host build tools:

pacman -S --needed ${MINGW_PACKAGE_PREFIX}-clang ${MINGW_PACKAGE_PREFIX}-pkgconf make autoconf \
  automake libtool git curl rsync pkg-config

The ${MINGW_PACKAGE_PREFIX} variable is set by MSYS2. It selects packages for the active MinGW environment, such as mingw-w64-clang-aarch64 in CLANGARM64.

5. Optional Library Tooling

Some optional external libraries need additional tools. Install these when you enable the matching libraries:

pacman -S --needed ${MINGW_PACKAGE_PREFIX}-meson ${MINGW_PACKAGE_PREFIX}-ninja \
  ${MINGW_PACKAGE_PREFIX}-cmake gperf bison gettext-devel autogen gtk-doc

Install nasm only when experimenting with x86-64 builds or libraries that require x86 assembly:

pacman -S --needed nasm

Use the ${MINGW_PACKAGE_PREFIX}- builds of meson, ninja and cmake. The plain MSYS versions run as POSIX host tools and can fail inside a MinGW build with Python or executable-format errors.

6. Build From the Repository Root

From the same MSYS2 shell, change to the ffmpeg-kit-next repository root and run:

./windows.sh

For optional libraries:

./windows.sh --enable-lib-openssl --enable-lib-dav1d

The output bundle is created under:

prebuilt/bundle-windows/ffmpeg-kit-next/

Troubleshooting

  • If clang or ${MINGW_PACKAGE_PREFIX}-pkgconf is missing, reopen the correct MinGW shell and reinstall the required packages.
  • If Meson or CMake reports that MSYS Python is being used in a MinGW environment, install the ${MINGW_PACKAGE_PREFIX}-meson, ${MINGW_PACKAGE_PREFIX}-ninja and ${MINGW_PACKAGE_PREFIX}-cmake packages.
  • If a build fails after partially downloading or configuring a library, retry with --redownload-lib-LIBRARY, --reconf-lib-LIBRARY or --rebuild-lib-LIBRARY as needed. See Redownload Option, Reconf Option and Rebuild Option.

Clone this wiki locally