codekingpro/portable-devtools
114k
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">2<html>3<!-- Created by , GNU Texinfo 7.1.1 -->4 <head>5 <meta charset="utf-8">6 <title>7 Platform Specific Information8 </title>9 <meta name="viewport" content="width=device-width,initial-scale=1.0">10 <link rel="stylesheet" type="text/css" href="bootstrap.min.css">11 <link rel="stylesheet" type="text/css" href="style.min.css">12 </head>13 <body>14 <div class="container">15 <h1>16 Platform Specific Information17 </h1>18 19 20<a name="SEC_Top"></a>21 22<div class="element-contents" id="SEC_Contents">23<h2 class="contents-heading">Table of Contents</h2>24 25<div class="contents">26 27<ul class="toc-numbered-mark">28 <li><a id="toc-Unix_002dlike" href="#Unix_002dlike">1 Unix-like</a>29 <ul class="toc-numbered-mark">30 <li><a id="toc-Advanced-linking-configuration" href="#Advanced-linking-configuration">1.1 Advanced linking configuration</a></li>31 <li><a id="toc-BSD" href="#BSD">1.2 BSD</a></li>32 <li><a id="toc-_0028Open_0029Solaris" href="#g_t_0028Open_0029Solaris">1.3 (Open)Solaris</a></li>33 <li><a id="toc-Darwin-_0028Mac-OS-X_002c-iPhone_0029" href="#Darwin-_0028Mac-OS-X_002c-iPhone_0029">1.4 Darwin (Mac OS X, iPhone)</a></li>34 </ul></li>35 <li><a id="toc-DOS" href="#DOS">2 DOS</a></li>36 <li><a id="toc-OS_002f2" href="#OS_002f2">3 OS/2</a></li>37 <li><a id="toc-Windows" href="#Windows">4 Windows</a>38 <ul class="toc-numbered-mark">39 <li><a id="toc-Native-Windows-compilation-using-MinGW-or-MinGW_002dw64" href="#Native-Windows-compilation-using-MinGW-or-MinGW_002dw64">4.1 Native Windows compilation using MinGW or MinGW-w64</a>40 <ul class="toc-numbered-mark">41 <li><a id="toc-Native-Windows-compilation-using-MSYS2" href="#Native-Windows-compilation-using-MSYS2">4.1.1 Native Windows compilation using MSYS2</a></li>42 </ul></li>43 <li><a id="toc-Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows" href="#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows">4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows</a>44 <ul class="toc-numbered-mark">45 <li><a id="toc-Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b" href="#Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b">4.2.1 Linking to FFmpeg with Microsoft Visual C++</a></li>46 </ul></li>47 <li><a id="toc-Cross-compilation-for-Windows-with-Linux-1" href="#Cross-compilation-for-Windows-with-Linux-1">4.3 Cross compilation for Windows with Linux</a></li>48 <li><a id="toc-Compilation-under-Cygwin" href="#Compilation-under-Cygwin">4.4 Compilation under Cygwin</a></li>49 <li><a id="toc-Crosscompilation-for-Windows-under-Cygwin" href="#Crosscompilation-for-Windows-under-Cygwin">4.5 Crosscompilation for Windows under Cygwin</a></li>50 <li><a id="toc-ARM64EC" href="#ARM64EC">4.6 ARM64EC</a></li>51 </ul></li>52</ul>53</div>54</div>55 56<a name="Unix_002dlike"></a>57<h2 class="chapter">1 Unix-like<span class="pull-right"><a class="anchor hidden-xs" href="#Unix_002dlike" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Unix_002dlike" aria-hidden="true">TOC</a></span></h2>58 59<p>Some parts of FFmpeg cannot be built with version 2.15 of the GNU60assembler which is still provided by a few AMD64 distributions. To61make sure your compiler really uses the required version of gas62after a binutils upgrade, run:63</p>64<div class="example">65<pre class="example-preformatted">$(gcc -print-prog-name=as) --version66</pre></div>67 68<p>If not, then you should install a different compiler that has no69hard-coded path to gas. In the worst case pass <code class="code">--disable-asm</code>70to configure.71</p>72<a name="Advanced-linking-configuration"></a>73<h3 class="section">1.1 Advanced linking configuration<span class="pull-right"><a class="anchor hidden-xs" href="#Advanced-linking-configuration" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Advanced-linking-configuration" aria-hidden="true">TOC</a></span></h3>74 75<p>If you compiled FFmpeg libraries statically and you want to use them to76build your own shared library, you may need to force PIC support (with77<code class="code">--enable-pic</code> during FFmpeg configure) and add the following option78to your project LDFLAGS:79</p>80<div class="example">81<pre class="example-preformatted">-Wl,-Bsymbolic82</pre></div>83 84<p>If your target platform requires position independent binaries, you should85pass the correct linking flag (e.g. <code class="code">-pie</code>) to <code class="code">--extra-ldexeflags</code>.86</p>87<a name="BSD"></a>88<h3 class="section">1.2 BSD<span class="pull-right"><a class="anchor hidden-xs" href="#BSD" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-BSD" aria-hidden="true">TOC</a></span></h3>89 90<p>BSD make will not build FFmpeg, you need to install and use GNU Make91(<code class="command">gmake</code>).92</p>93<a name="g_t_0028Open_0029Solaris"></a>94<h3 class="section">1.3 (Open)Solaris<span class="pull-right"><a class="anchor hidden-xs" href="#_0028Open_0029Solaris" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-_0028Open_0029Solaris" aria-hidden="true">TOC</a></span></h3>95 96<p>GNU Make is required to build FFmpeg, so you have to invoke (<code class="command">gmake</code>),97standard Solaris Make will not work. When building with a non-c99 front-end98(gcc, generic suncc) add either <code class="code">--extra-libs=/usr/lib/values-xpg6.o</code>99or <code class="code">--extra-libs=/usr/lib/64/values-xpg6.o</code> to the configure options100since the libc is not c99-compliant by default. The probes performed by101configure may raise an exception leading to the death of configure itself102due to a bug in the system shell. Simply invoke a different shell such as103bash directly to work around this:104</p>105<div class="example">106<pre class="example-preformatted">bash ./configure107</pre></div>108 109<a class="anchor" id="Darwin"></a><a name="Darwin-_0028Mac-OS-X_002c-iPhone_0029"></a>110<h3 class="section">1.4 Darwin (Mac OS X, iPhone)<span class="pull-right"><a class="anchor hidden-xs" href="#Darwin-_0028Mac-OS-X_002c-iPhone_0029" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Darwin-_0028Mac-OS-X_002c-iPhone_0029" aria-hidden="true">TOC</a></span></h3>111 112<p>The toolchain provided with Xcode is sufficient to build the basic113unaccelerated code.114</p>115<p>Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from116<a class="url" href="https://github.com/FFmpeg/gas-preprocessor">https://github.com/FFmpeg/gas-preprocessor</a> or117<a class="url" href="https://github.com/yuvi/gas-preprocessor">https://github.com/yuvi/gas-preprocessor</a>(currently outdated) to build the optimized118assembly functions. Put the Perl script somewhere119in your PATH, FFmpeg’s configure will pick it up automatically.120</p>121<p>Mac OS X on amd64 and x86 requires <code class="command">nasm</code> to build most of the122optimized assembly functions. <a class="uref" href="http://www.finkproject.org/">Fink</a>,123<a class="uref" href="https://wiki.gentoo.org/wiki/Project:Prefix">Gentoo Prefix</a>,124<a class="uref" href="https://mxcl.github.com/homebrew/">Homebrew</a>125or <a class="uref" href="http://www.macports.org">MacPorts</a> can easily provide it.126</p>127 128<a name="DOS"></a>129<h2 class="chapter">2 DOS<span class="pull-right"><a class="anchor hidden-xs" href="#DOS" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-DOS" aria-hidden="true">TOC</a></span></h2>130 131<p>Using a cross-compiler is preferred for various reasons.132<a class="url" href="http://www.delorie.com/howto/djgpp/linux-x-djgpp.html">http://www.delorie.com/howto/djgpp/linux-x-djgpp.html</a>133</p>134 135<a name="OS_002f2"></a>136<h2 class="chapter">3 OS/2<span class="pull-right"><a class="anchor hidden-xs" href="#OS_002f2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-OS_002f2" aria-hidden="true">TOC</a></span></h2>137 138<p>For information about compiling FFmpeg on OS/2 see139<a class="url" href="http://www.edm2.com/index.php/FFmpeg">http://www.edm2.com/index.php/FFmpeg</a>.140</p>141 142<a name="Windows"></a>143<h2 class="chapter">4 Windows<span class="pull-right"><a class="anchor hidden-xs" href="#Windows" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Windows" aria-hidden="true">TOC</a></span></h2>144 145<a name="Native-Windows-compilation-using-MinGW-or-MinGW_002dw64"></a>146<h3 class="section">4.1 Native Windows compilation using MinGW or MinGW-w64<span class="pull-right"><a class="anchor hidden-xs" href="#Native-Windows-compilation-using-MinGW-or-MinGW_002dw64" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Native-Windows-compilation-using-MinGW-or-MinGW_002dw64" aria-hidden="true">TOC</a></span></h3>147 148<p>FFmpeg can be built to run natively on Windows using the MinGW-w64149toolchain. Install the latest versions of MSYS2 and MinGW-w64 from150<a class="url" href="http://msys2.github.io/">http://msys2.github.io/</a> and/or <a class="url" href="http://mingw-w64.sourceforge.net/">http://mingw-w64.sourceforge.net/</a>.151You can find detailed installation instructions in the download section and152the FAQ.153</p>154<p>Notes:155</p>156<ul class="itemize mark-bullet">157<li>Building for the MSYS environment is discouraged, MSYS2 provides a full158MinGW-w64 environment through <samp class="file">mingw64_shell.bat</samp> or159<samp class="file">mingw32_shell.bat</samp> that should be used instead of the environment160provided by <samp class="file">msys2_shell.bat</samp>.161 162</li><li>Building using MSYS2 can be sped up by disabling implicit rules in the163Makefile by calling <code class="code">make -r</code> instead of plain <code class="code">make</code>. This164speed up is close to non-existent for normal one-off builds and is only165noticeable when running make for a second time (for example during166<code class="code">make install</code>).167 168</li><li>In order to compile FFplay, you must have the MinGW development library169of <a class="uref" href="http://www.libsdl.org/">SDL</a> and <code class="code">pkg-config</code> installed.170 171</li><li>By using <code class="code">./configure --enable-shared</code> when configuring FFmpeg,172you can build the FFmpeg libraries (e.g. libavutil, libavcodec,173libavformat) as DLLs.174 175</li></ul>176 177<a name="Native-Windows-compilation-using-MSYS2"></a>178<h4 class="subsection">4.1.1 Native Windows compilation using MSYS2<span class="pull-right"><a class="anchor hidden-xs" href="#Native-Windows-compilation-using-MSYS2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Native-Windows-compilation-using-MSYS2" aria-hidden="true">TOC</a></span></h4>179 180<p>The MSYS2 MinGW-w64 environment provides ready to use toolchains and dependencies181through <code class="command">pacman</code>.182</p>183<p>Make sure to use <samp class="file">mingw64_shell.bat</samp> or <samp class="file">mingw32_shell.bat</samp> to have184the correct MinGW-w64 environment. The default install provides shortcuts to185them under <code class="command">MinGW-w64 Win64 Shell</code> and <code class="command">MinGW-w64 Win32 Shell</code>.186</p>187<div class="example">188<pre class="example-preformatted"># normal msys2 packages189pacman -S make pkgconf diffutils190 191# mingw-w64 packages and toolchains192pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2193</pre></div>194 195<p>To target 32 bits replace <code class="code">x86_64</code> with <code class="code">i686</code> in the command above.196</p>197<a name="Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows"></a>198<h3 class="section">4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows<span class="pull-right"><a class="anchor hidden-xs" href="#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows" aria-hidden="true">TOC</a></span></h3>199 200<p>FFmpeg can be built with MSVC 2013 or later.201</p>202<p>You will need the following prerequisites:203</p>204<ul class="itemize mark-bullet">205<li><a class="uref" href="http://msys2.github.io/">MSYS2</a>206</li><li><a class="uref" href="http://www.nasm.us/">NASM</a>207(Also available via MSYS2’s package manager.)208</li></ul>209 210<p>To set up a proper environment in MSYS2, you need to run <code class="code">msys_shell.bat</code> from211the Visual Studio or Intel Compiler command prompt.212</p>213<p>Place <code class="code">nasm.exe</code> somewhere in your <code class="code">PATH</code>.214</p>215<p>Next, make sure any other headers and libs you want to use, such as zlib, are216located in a spot that the compiler can see. Do so by modifying the <code class="code">LIB</code>217and <code class="code">INCLUDE</code> environment variables to include the <strong class="strong">Windows-style</strong>218paths to these directories. Alternatively, you can try to use the219<code class="code">--extra-cflags</code>/<code class="code">--extra-ldflags</code> configure options.220</p>221<p>Finally, run:222</p>223<div class="example">224<pre class="example-preformatted">For MSVC:225./configure --toolchain=msvc226 227For ICL:228./configure --toolchain=icl229 230make231make install232</pre></div>233 234<p>If you wish to compile shared libraries, add <code class="code">--enable-shared</code> to your235configure options. Note that due to the way MSVC and ICL handle DLL imports and236exports, you cannot compile static and shared libraries at the same time, and237enabling shared libraries will automatically disable the static ones.238</p>239<p>Notes:240</p>241<ul class="itemize mark-bullet">242<li>If you wish to build with zlib support, you will have to grab a compatible243zlib binary from somewhere, with an MSVC import lib, or if you wish to link244statically, you can follow the instructions below to build a compatible245<code class="code">zlib.lib</code> with MSVC. Regardless of which method you use, you must still246follow step 3, or compilation will fail.247<ol class="enumerate">248<li> Grab the <a class="uref" href="http://zlib.net/">zlib sources</a>.249</li><li> Edit <code class="code">win32/Makefile.msc</code> so that it uses -MT instead of -MD, since250this is how FFmpeg is built as well.251</li><li> Edit <code class="code">zconf.h</code> and remove its inclusion of <code class="code">unistd.h</code>. This gets252erroneously included when building FFmpeg.253</li><li> Run <code class="code">nmake -f win32/Makefile.msc</code>.254</li><li> Move <code class="code">zlib.lib</code>, <code class="code">zconf.h</code>, and <code class="code">zlib.h</code> to somewhere MSVC255can see.256</li></ol>257 258</li><li>FFmpeg has been tested with the following on i686 and x86_64:259<ul class="itemize mark-bullet">260<li>Visual Studio 2013 Pro and Express261</li><li>Intel Composer XE 2013262</li><li>Intel Composer XE 2013 SP1263</li></ul>264<p>Anything else is not officially supported.265</p>266</li></ul>267 268<a name="Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b"></a>269<h4 class="subsection">4.2.1 Linking to FFmpeg with Microsoft Visual C++<span class="pull-right"><a class="anchor hidden-xs" href="#Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b" aria-hidden="true">TOC</a></span></h4>270 271<p>If you plan to link with MSVC-built static libraries, you will need272to make sure you have <code class="code">Runtime Library</code> set to273<code class="code">Multi-threaded (/MT)</code> in your project’s settings.274</p>275<p>You will need to define <code class="code">inline</code> to something MSVC understands:276</p><div class="example">277<pre class="example-preformatted">#define inline __inline278</pre></div>279 280<p>Also note, that as stated in <strong class="strong">Microsoft Visual C++</strong>, you will need281an MSVC-compatible <a class="uref" href="http://code.google.com/p/msinttypes/">inttypes.h</a>.282</p>283<p>If you plan on using import libraries created by dlltool, you must284set <code class="code">References</code> to <code class="code">No (/OPT:NOREF)</code> under the linker optimization285settings, otherwise the resulting binaries will fail during runtime.286This is not required when using import libraries generated by <code class="code">lib.exe</code>.287This issue is reported upstream at288<a class="url" href="http://sourceware.org/bugzilla/show_bug.cgi?id=12633">http://sourceware.org/bugzilla/show_bug.cgi?id=12633</a>.289</p>290<p>To create import libraries that work with the <code class="code">/OPT:REF</code> option291(which is enabled by default in Release mode), follow these steps:292</p>293<ol class="enumerate">294<li> Open the <em class="emph">Visual Studio Command Prompt</em>.295 296<p>Alternatively, in a normal command line prompt, call <samp class="file">vcvars32.bat</samp>297which sets up the environment variables for the Visual C++ tools298(the standard location for this file is something like299<samp class="file">C:\Program Files (x86_\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat</samp>).300</p>301</li><li> Enter the <samp class="file">bin</samp> directory where the created LIB and DLL files302are stored.303 304</li><li> Generate new import libraries with <code class="command">lib.exe</code>:305 306<div class="example">307<pre class="example-preformatted">lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib308</pre></div>309 310<p>Replace <code class="code">foo-version</code> and <code class="code">foo</code> with the respective library names.311</p>312</li></ol>313 314<a class="anchor" id="Cross-compilation-for-Windows-with-Linux"></a><a name="Cross-compilation-for-Windows-with-Linux-1"></a>315<h3 class="section">4.3 Cross compilation for Windows with Linux<span class="pull-right"><a class="anchor hidden-xs" href="#Cross-compilation-for-Windows-with-Linux-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Cross-compilation-for-Windows-with-Linux-1" aria-hidden="true">TOC</a></span></h3>316 317<p>You must use the MinGW cross compilation tools available at318<a class="url" href="http://www.mingw.org/">http://www.mingw.org/</a>.319</p>320<p>Then configure FFmpeg with the following options:321</p><div class="example">322<pre class="example-preformatted">./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-323</pre></div>324<p>(you can change the cross-prefix according to the prefix chosen for the325MinGW tools).326</p>327<p>Then you can easily test FFmpeg with <a class="uref" href="http://www.winehq.com/">Wine</a>.328</p>329<a name="Compilation-under-Cygwin"></a>330<h3 class="section">4.4 Compilation under Cygwin<span class="pull-right"><a class="anchor hidden-xs" href="#Compilation-under-Cygwin" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Compilation-under-Cygwin" aria-hidden="true">TOC</a></span></h3>331 332<p>Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack333llrint() in its C library.334</p>335<p>Install your Cygwin with all the "Base" packages, plus the336following "Devel" ones:337</p><div class="example">338<pre class="example-preformatted">binutils, gcc4-core, make, git, mingw-runtime, texinfo339</pre></div>340 341<p>In order to run FATE you will also need the following "Utils" packages:342</p><div class="example">343<pre class="example-preformatted">diffutils344</pre></div>345 346<p>If you want to build FFmpeg with additional libraries, download Cygwin347"Devel" packages for Ogg and Vorbis from any Cygwin packages repository:348</p><div class="example">349<pre class="example-preformatted">libogg-devel, libvorbis-devel350</pre></div>351 352<p>These library packages are only available from353<a class="uref" href="http://sourceware.org/cygwinports/">Cygwin Ports</a>:354</p>355<div class="example">356<pre class="example-preformatted">libSDL-devel, libgsm-devel, libmp3lame-devel,357speex-devel, libtheora-devel, libxvidcore-devel358</pre></div>359 360<p>The recommendation for x264 is to build it from source, as it evolves too361quickly for Cygwin Ports to be up to date.362</p>363<a name="Crosscompilation-for-Windows-under-Cygwin"></a>364<h3 class="section">4.5 Crosscompilation for Windows under Cygwin<span class="pull-right"><a class="anchor hidden-xs" href="#Crosscompilation-for-Windows-under-Cygwin" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Crosscompilation-for-Windows-under-Cygwin" aria-hidden="true">TOC</a></span></h3>365 366<p>With Cygwin you can create Windows binaries that do not need the cygwin1.dll.367</p>368<p>Just install your Cygwin as explained before, plus these additional369"Devel" packages:370</p><div class="example">371<pre class="example-preformatted">gcc-mingw-core, mingw-runtime, mingw-zlib372</pre></div>373 374<p>and add some special flags to your configure invocation.375</p>376<p>For a static build run377</p><div class="example">378<pre class="example-preformatted">./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin379</pre></div>380 381<p>and for a build with shared libraries382</p><div class="example">383<pre class="example-preformatted">./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin384</pre></div>385 386<a name="ARM64EC"></a>387<h3 class="section">4.6 ARM64EC<span class="pull-right"><a class="anchor hidden-xs" href="#ARM64EC" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-ARM64EC" aria-hidden="true">TOC</a></span></h3>388 389<p>FFmpeg does not intend to support the Windows ARM64EC build configuration;390patches for changing the individual libraries for the purposes of ARM64EC will391not be accepted.392</p>393<p>It may still be possible to build FFmpeg in this build configuration;394such a build may seem to work to some extent. Such a build may have some395amounts of ABI inconsistencies though - which we are not willing to fix.396</p>397<p>(Changing aarch64 assembly code to strictly support ARM64EC would require398ifdeffing/changing essentially all such assembly code, and would be a399huge maintenance burden. Additionally, changing the library ABI400surfaces to fix ABI inconsistencies could require extensive and intrusive401changes.)402</p>403 <p style="font-size: small;">404 This document was generated using <a class="uref" href="https://www.gnu.org/software/texinfo/"><em class="emph">makeinfo</em></a>.405 </p>406 </div>407 </body>408</html>409 