Changes between Version 9 and Version 10 of CompilationGuide/CrossCompilingForWindows
- Timestamp:
- Nov 1, 2017, 2:01:33 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CompilationGuide/CrossCompilingForWindows
v9 v10 1 = Intro=1 = Cross Compiling for Windows = 2 2 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)]] 4 4 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 == 6 6 7 Most cross compilation are done under Linux, but it is possible to us OS X as a host machine as well.7 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). 8 8 9 Also "windows 10 bash"can do cross compilation as well.9 Most 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. 10 10 11 = Automated cross compiling environment = 11 Note 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 === 12 21 13 22 Some 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]. 14 23 15 24 MXE is more feature-complete as of Dec 2013, as 25 16 26 * 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 Xas a host machine27 * 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 19 29 * it supports MinGW in addition to mingw-w64. 20 30 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.31 Win-builds as the official package manager for mingw-w64 is really new, and it does not have as many multimedia packages as MXE. 22 32 23 = Cross Compiler=33 === Linux Packages === 24 34 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.35 Some 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. 26 36 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.28 37 29 = Compile dependencies=38 == Compile FFmpeg == 30 39 31 N ext cross compile any added dependencies you may want, for instead libx264.40 Now configure and compile FFmpeg like: 32 41 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 like38 42 {{{ 39 $ ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config 40 $make43 ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- 44 make 41 45 }}} 42 46 43 and other options if you want them, like --enable-libx264, etc.47 and other options if you want them, like `--enable-libx264`, etc. if you have these dependencies cross-compiled as well. 44 48 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.exe49 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 beforehand, it will also include `ffplay.exe`. 46 50 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 == 50 52 51 53 You can ask questions on the [http://ffmpeg.zeranoe.com/forum/ Zeranoe Forum].
