Platform Specific Information

Table of Contents

1 Unix-like

1.1 Advanced linking configuration

If you compiled FFmpeg libraries statically and you want to use them to build your own shared library, you may need to force PIC support (with --enable-pic during FFmpeg configure) and add the following option to your project LDFLAGS:

-Wl,-Bsymbolic

If your target platform requires position independent binaries, you should pass the correct linking flag (e.g. -pie) to --extra-ldexeflags.

1.2 BSD

BSD make will not build FFmpeg, you need to install and use GNU Make (gmake).

1.3 (Open)Solaris

GNU Make is required to build FFmpeg, so you have to invoke (gmake), standard Solaris Make will not work.

1.4 Darwin (Mac OS X, iPhone)

The toolchain provided with Xcode is sufficient to build the basic unaccelerated code.

macOS on x86 requires nasm to build most of the optimized assembly functions. Gentoo Prefix, Homebrew or MacPorts can easily provide it.

2 DOS

Using a cross-compiler is preferred for various reasons. http://www.delorie.com/howto/djgpp/linux-x-djgpp.html

3 OS/2

For information about compiling FFmpeg on OS/2 see http://www.edm2.com/index.php/FFmpeg.

4 Windows

4.1 Native Windows compilation using MinGW or MinGW-w64

FFmpeg can be built to run natively on Windows using the MinGW-w64 toolchain. Install the latest versions of MSYS2 and MinGW-w64 from https://www.msys2.org/ and/or https://www.mingw-w64.org/. You can find detailed installation instructions in the download section and the FAQ.

Notes:

4.1.1 Native Windows compilation using MSYS2

The MSYS2 MinGW-w64 environments provide ready to use toolchains and dependencies through pacman.

Launch the shell of the environment you want to build in using its launcher, for example ucrt64.exe or the corresponding start menu shortcut for UCRT64. Then install the toolchain and the FFmpeg dependencies. The pacboy wrapper from the pactoys package fills in the package name prefix of the current environment, so the same command works in every environment.

# normal msys2 packages
pacman -S make pkgconf diffutils pactoys

# mingw-w64 packages and toolchains for the current environment
pacboy -S cc nasm SDL2

4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows

FFmpeg can be built with MSVC 2019 16.8 or later, the first version able to compile C11.

You will need the following prerequisites:

To set up a proper environment in MSYS2, you need to run msys2_shell.cmd -use-full-path from the Visual Studio or Intel Compiler command prompt.

Place nasm.exe somewhere in your PATH.

Next, make sure any other headers and libs you want to use, such as zlib, are located in a spot that the compiler can see. Do so by modifying the LIB and INCLUDE environment variables to include the Windows-style paths to these directories. Alternatively, you can try to use the --extra-cflags/--extra-ldflags configure options.

Finally, run:

For MSVC:
./configure --toolchain=msvc

For ICL:
./configure --toolchain=icl

make
make install

If you wish to compile shared libraries, add --enable-shared to your configure options. Note that due to the way MSVC and ICL handle DLL imports and exports, you cannot compile static and shared libraries at the same time, and enabling shared libraries will automatically disable the static ones.

Notes:

4.2.1 Linking to FFmpeg with Microsoft Visual C++

If you plan to link with MSVC-built static libraries, you will need to make sure you have Runtime Library set to Multi-threaded (/MT) in your project’s settings.

If you plan on using import libraries created by dlltool, you must set References to No (/OPT:NOREF) under the linker optimization settings, otherwise the resulting binaries will fail during runtime. This is not required when using import libraries generated by lib.exe. This issue is reported upstream at http://sourceware.org/bugzilla/show_bug.cgi?id=12633.

To create import libraries that work with the /OPT:REF option (which is enabled by default in Release mode), follow these steps:

  1. Open the Visual Studio Command Prompt.

    Alternatively, in a normal command line prompt, call vcvarsall.bat which sets up the environment variables for the Visual C++ tools.

  2. Enter the bin directory where the created LIB and DLL files are stored.
  3. Generate new import libraries with lib.exe:
    lib /machine:i386 /def:..\lib\foo-version.def  /out:foo.lib
    

    Replace foo-version and foo with the respective library names.

4.3 Cross compilation for Windows with Linux

You must use the MinGW-w64 cross compilation tools, which most Linux distributions provide as packages.

Then configure FFmpeg with the following options:

./configure --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32-

(you can change the cross-prefix according to the prefix chosen for the MinGW-w64 tools).

Then you can easily test FFmpeg with Wine.

4.4 Compilation under Cygwin

Install your Cygwin with all the "Base" packages, plus the following "Devel" ones:

binutils, gcc-core, make, git, texinfo

In order to run FATE you will also need the following "Utils" packages:

diffutils

If you want to build FFmpeg with additional libraries, download Cygwin "Devel" packages for Ogg and Vorbis from any Cygwin packages repository:

libogg-devel, libvorbis-devel

4.5 Crosscompilation for Windows under Cygwin

With Cygwin you can create Windows binaries that do not need the cygwin1.dll.

Just install your Cygwin as explained before, plus the MinGW-w64 cross toolchain "Devel" packages:

mingw64-x86_64-gcc-core, mingw64-x86_64-binutils

and configure with:

./configure --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32-

4.6 ARM64EC

FFmpeg does not intend to support the Windows ARM64EC build configuration; patches for changing the individual libraries for the purposes of ARM64EC will not be accepted.

It may still be possible to build FFmpeg in this build configuration; such a build may seem to work to some extent. Such a build may have some amounts of ABI inconsistencies though - which we are not willing to fix.

(Changing aarch64 assembly code to strictly support ARM64EC would require ifdeffing/changing essentially all such assembly code, and would be a huge maintenance burden. Additionally, changing the library ABI surfaces to fix ABI inconsistencies could require extensive and intrusive changes.)

This document was generated using makeinfo.