Changes between Version 9 and Version 10 of CompilationGuide/CrossCompilingForWindows


Ignore:
Timestamp:
Nov 1, 2017, 4:01:33 PM (3 weeks ago)
Author:
slhck
Comment:

add prominent link to GitHub? cross-compile script, as guide seems quite outdated / incomplete

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/CrossCompilingForWindows

    v9 v10  
    1 = Intro = 
     1= Cross Compiling for Windows = 
    22 
    3 Basically, cross compiling FFmpeg for windows means that you use a special version of the gcc compiler (and related tools) that output a working windows executable when they're done.  You can copy it to your windows box and then use it (or use wine to run it under linux, but that kind of defeats the point). 
     3[[PageOutline(2, Contents)]] 
    44 
    5 This is sometimes easier than using a "native" compilation in windows because some dependencies' configure scripts accept a cross compiler more readily than a native windows mingw gcc, etc.  It also may be "faster" than using mingw's gcc in windows, for whatever reason gcc seems faster in linux. 
     5== Introduction == 
    66 
    7 Most cross compilation are done under Linux, but it is possible to us OS X as a host machine as well. 
     7Cross compiling FFmpeg for Windows means that you use a special version of the `gcc` compiler (and related tools) that output a working Windows executable when they're done. You can copy it to your Windows box and then use it (or use WINE to run it under Linux, but that kind of defeats the point). 
    88 
    9 Also "windows 10 bash" can do cross compilation as well. 
     9Most cross compilation is done under Linux, but it is possible to use macOS as a host machine as well. Windows 10 WSL can do cross compilation as well. 
    1010 
    11 = Automated cross compiling environment = 
     11Note that cross-compiling is sometimes easier than using a "native" compilation under Windows because some dependencies' configure scripts accept a cross compiler more readily than a native Windows MinGW, `gcc`, etc. It also may be "faster" than using `gcc` under Windows. 
     12 
     13{{{ 
     14#!div style="border: 1px solid #c7e5c7; margin: 1em; background-color: #ddffdd;" 
     15'''Tip:''' The [https://github.com/rdp/ffmpeg-windows-build-helpers FFmpeg Windows Build Helpers] script can automatically cross-compile FFmpeg for Windows. You can still follow this guide if you want to manually compile FFmpeg. 
     16}}} 
     17 
     18== Cross-Compiling Environment == 
     19 
     20=== Automated Cross Compiling Environment === 
    1221 
    1322Some building environments aim to automatically build the cross compilers and dependencies of FFmpeg. By using these projects you can eliminate the mess of building toolchains yourself. These projects include [http://mxe.cc MXE] and [http://win-builds.org Win-builds]. 
    1423 
    1524MXE is more feature-complete as of Dec 2013, as 
     25 
    1626* it has more dependencies for FFmpeg (x264, xvid, etc.) 
    17 * it has a ffmpeg package (by default it is libraries-only, but users are able to generate the programs to by simply deleting one line in the building recipe) 
    18 * it supports OS X as a host machine 
     27* it has an ffmpeg package (by default it is libraries-only, but users are able to generate the programs to by simply deleting one line in the building recipe) 
     28* it supports macOS as a host machine 
    1929* it supports MinGW in addition to mingw-w64. 
    2030 
    21 Win-builds as the official package manager for mingw-w64, is really new, and it does not have as many multimedia packages as MXE. 
     31Win-builds as the official package manager for mingw-w64 is really new, and it does not have as many multimedia packages as MXE. 
    2232 
    23 = Cross Compiler = 
     33=== Linux Packages === 
    2434 
    25 Zeranoe has a [http://ffmpeg.zeranoe.com/blog/ script] for compiling your own windows cross compiler, then you can use it to [http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=19&t=459 compile ffmpeg and its libs].  NB that it can be a little tricky, you could try using [https://github.com/rdp/ffmpeg-windows-build-helpers this script] which attempts to automated building the cross compiler and gcc. 
     35Some Linux distros have packages like `mingw-w64-dev` or `gcc-mingw-w64-i686` which might also get a working local cross compiler system.  They'll add `x86_64-w64-mingw32-gcc` to your `PATH` and you're ready to go. 
    2636 
    27 Another option is that some linux distros have packages like mingw-w64-dev or gcc-mingw-w64-i686 which might also get a working local cross compiler system.  Basically, they'll add x86_64-w64-mingw32-gcc to a directory or to the PATH somehow.  And you're ready to go. 
    2837 
    29 = Compile dependencies = 
     38== Compile FFmpeg == 
    3039 
    31 Next cross compile any added dependencies you may want, for instead libx264. 
     40Now configure and compile FFmpeg like: 
    3241 
    33 The script "cross_compile_ffmpeg.sh" in [https://github.com/rdp/ffmpeg-windows-build-helpers this repository] lists many dependencies. 
    34  
    35 = Compile FFmpeg = 
    36  
    37 Now basically configure and compile FFmpeg like  
    3842{{{ 
    39 $ ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config 
    40 $ make 
     43./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- 
     44make 
    4145}}} 
    4246 
    43 and other options if you want them, like --enable-libx264, etc. 
     47and other options if you want them, like `--enable-libx264`, etc. if you have these dependencies cross-compiled as well. 
    4448 
    45 This should eventually create the file ffmpeg_g.exe (ffmpeg.exe with debug symbols) and ffmpeg.exe (ffmpeg.exe "stripped" of its debug symbols).  If you cross compile SDL before hand, it will also include ffplay.exe 
     49This should eventually create the file `ffmpeg_g.exe` (`ffmpeg.exe` with debug symbols) and `ffmpeg.exe` (`ffmpeg.exe` "stripped" of its debug symbols).  If you cross compile SDL beforehand, it will also include `ffplay.exe`. 
    4650 
    47 = Resources = 
    48  
    49 [https://github.com/rdp/ffmpeg-windows-build-helpers This repository] has a script that compiles the cross compiler locally 
     51== Getting Help == 
    5052 
    5153You can ask questions on the [http://ffmpeg.zeranoe.com/forum/ Zeranoe Forum].