annotate ffmpeg/doc/platform.texi @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 \input texinfo @c -*- texinfo -*-
yading@10 2
yading@10 3 @settitle Platform Specific Information
yading@10 4 @titlepage
yading@10 5 @center @titlefont{Platform Specific Information}
yading@10 6 @end titlepage
yading@10 7
yading@10 8 @top
yading@10 9
yading@10 10 @contents
yading@10 11
yading@10 12 @chapter Unix-like
yading@10 13
yading@10 14 Some parts of FFmpeg cannot be built with version 2.15 of the GNU
yading@10 15 assembler which is still provided by a few AMD64 distributions. To
yading@10 16 make sure your compiler really uses the required version of gas
yading@10 17 after a binutils upgrade, run:
yading@10 18
yading@10 19 @example
yading@10 20 $(gcc -print-prog-name=as) --version
yading@10 21 @end example
yading@10 22
yading@10 23 If not, then you should install a different compiler that has no
yading@10 24 hard-coded path to gas. In the worst case pass @code{--disable-asm}
yading@10 25 to configure.
yading@10 26
yading@10 27 @section BSD
yading@10 28
yading@10 29 BSD make will not build FFmpeg, you need to install and use GNU Make
yading@10 30 (@command{gmake}).
yading@10 31
yading@10 32 @section (Open)Solaris
yading@10 33
yading@10 34 GNU Make is required to build FFmpeg, so you have to invoke (@command{gmake}),
yading@10 35 standard Solaris Make will not work. When building with a non-c99 front-end
yading@10 36 (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
yading@10 37 or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
yading@10 38 since the libc is not c99-compliant by default. The probes performed by
yading@10 39 configure may raise an exception leading to the death of configure itself
yading@10 40 due to a bug in the system shell. Simply invoke a different shell such as
yading@10 41 bash directly to work around this:
yading@10 42
yading@10 43 @example
yading@10 44 bash ./configure
yading@10 45 @end example
yading@10 46
yading@10 47 @anchor{Darwin}
yading@10 48 @section Darwin (Mac OS X, iPhone)
yading@10 49
yading@10 50 The toolchain provided with Xcode is sufficient to build the basic
yading@10 51 unacelerated code.
yading@10 52
yading@10 53 Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
yading@10 54 @url{http://github.com/yuvi/gas-preprocessor} to build the optimized
yading@10 55 assembler functions. Just download the Perl script and put it somewhere
yading@10 56 in your PATH, FFmpeg's configure will pick it up automatically.
yading@10 57
yading@10 58 Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
yading@10 59 optimized assembler functions. @uref{http://www.finkproject.org/, Fink},
yading@10 60 @uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix},
yading@10 61 @uref{http://mxcl.github.com/homebrew/, Homebrew}
yading@10 62 or @uref{http://www.macports.org, MacPorts} can easily provide it.
yading@10 63
yading@10 64
yading@10 65 @chapter DOS
yading@10 66
yading@10 67 Using a cross-compiler is preferred for various reasons.
yading@10 68 @url{http://www.delorie.com/howto/djgpp/linux-x-djgpp.html}
yading@10 69
yading@10 70
yading@10 71 @chapter OS/2
yading@10 72
yading@10 73 For information about compiling FFmpeg on OS/2 see
yading@10 74 @url{http://www.edm2.com/index.php/FFmpeg}.
yading@10 75
yading@10 76
yading@10 77 @chapter Windows
yading@10 78
yading@10 79 To get help and instructions for building FFmpeg under Windows, check out
yading@10 80 the FFmpeg Windows Help Forum at @url{http://ffmpeg.zeranoe.com/forum/}.
yading@10 81
yading@10 82 @section Native Windows compilation using MinGW or MinGW-w64
yading@10 83
yading@10 84 FFmpeg can be built to run natively on Windows using the MinGW or MinGW-w64
yading@10 85 toolchains. Install the latest versions of MSYS and MinGW or MinGW-w64 from
yading@10 86 @url{http://www.mingw.org/} or @url{http://mingw-w64.sourceforge.net/}.
yading@10 87 You can find detailed installation instructions in the download section and
yading@10 88 the FAQ.
yading@10 89
yading@10 90 Notes:
yading@10 91
yading@10 92 @itemize
yading@10 93
yading@10 94 @item Building natively using MSYS can be sped up by disabling implicit rules
yading@10 95 in the Makefile by calling @code{make -r} instead of plain @code{make}. This
yading@10 96 speed up is close to non-existent for normal one-off builds and is only
yading@10 97 noticeable when running make for a second time (for example during
yading@10 98 @code{make install}).
yading@10 99
yading@10 100 @item In order to compile FFplay, you must have the MinGW development library
yading@10 101 of @uref{http://www.libsdl.org/, SDL} and @code{pkg-config} installed.
yading@10 102
yading@10 103 @item By using @code{./configure --enable-shared} when configuring FFmpeg,
yading@10 104 you can build the FFmpeg libraries (e.g. libavutil, libavcodec,
yading@10 105 libavformat) as DLLs.
yading@10 106
yading@10 107 @end itemize
yading@10 108
yading@10 109 @section Microsoft Visual C++
yading@10 110
yading@10 111 FFmpeg can be built with MSVC using a C99-to-C89 conversion utility and
yading@10 112 wrapper.
yading@10 113
yading@10 114 You will need the following prerequisites:
yading@10 115
yading@10 116 @itemize
yading@10 117 @item @uref{http://download.videolan.org/pub/contrib/c99-to-c89/, C99-to-C89 Converter & Wrapper}
yading@10 118 @item @uref{http://code.google.com/p/msinttypes/, msinttypes}
yading@10 119 @item @uref{http://www.mingw.org/, MSYS}
yading@10 120 @item @uref{http://yasm.tortall.net/, YASM}
yading@10 121 @item @uref{http://gnuwin32.sourceforge.net/packages/bc.htm, bc for Windows} if
yading@10 122 you want to run @uref{fate.html, FATE}.
yading@10 123 @end itemize
yading@10 124
yading@10 125 To set up a proper MSVC environment in MSYS, you simply need to run
yading@10 126 @code{msys.bat} from the Visual Studio command prompt.
yading@10 127
yading@10 128 Place @code{makedef}, @code{c99wrap.exe}, @code{c99conv.exe}, and @code{yasm.exe}
yading@10 129 somewhere in your @code{PATH}.
yading@10 130
yading@10 131 Next, make sure @code{inttypes.h} and any other headers and libs you want to use
yading@10 132 are located in a spot that MSVC can see. Do so by modifying the @code{LIB} and
yading@10 133 @code{INCLUDE} environment variables to include the @strong{Windows} paths to
yading@10 134 these directories. Alternatively, you can try and use the
yading@10 135 @code{--extra-cflags}/@code{--extra-ldflags} configure options.
yading@10 136
yading@10 137 Finally, run:
yading@10 138
yading@10 139 @example
yading@10 140 ./configure --toolchain=msvc
yading@10 141 make
yading@10 142 make install
yading@10 143 @end example
yading@10 144
yading@10 145 If you wish to compile shared libraries, add @code{--enable-shared} to your
yading@10 146 configure options. Note that due to the way MSVC handles DLL imports and
yading@10 147 exports, you cannot compile static and shared libraries at the same time, and
yading@10 148 enabling shared libraries will automatically disable the static ones.
yading@10 149
yading@10 150 Notes:
yading@10 151
yading@10 152 @itemize
yading@10 153
yading@10 154 @item It is possible that coreutils' @code{link.exe} conflicts with MSVC's linker.
yading@10 155 You can find out by running @code{which link} to see which @code{link.exe} you
yading@10 156 are using. If it is located at @code{/bin/link.exe}, then you have the wrong one
yading@10 157 in your @code{PATH}. Either move or remove that copy, or make sure MSVC's
yading@10 158 @code{link.exe} takes precedence in your @code{PATH} over coreutils'.
yading@10 159
yading@10 160 @item If you wish to build with zlib support, you will have to grab a compatible
yading@10 161 zlib binary from somewhere, with an MSVC import lib, or if you wish to link
yading@10 162 statically, you can follow the instructions below to build a compatible
yading@10 163 @code{zlib.lib} with MSVC. Regardless of which method you use, you must still
yading@10 164 follow step 3, or compilation will fail.
yading@10 165 @enumerate
yading@10 166 @item Grab the @uref{http://zlib.net/, zlib sources}.
yading@10 167 @item Edit @code{win32/Makefile.msc} so that it uses -MT instead of -MD, since
yading@10 168 this is how FFmpeg is built as well.
yading@10 169 @item Edit @code{zconf.h} and remove its inclusion of @code{unistd.h}. This gets
yading@10 170 erroneously included when building FFmpeg.
yading@10 171 @item Run @code{nmake -f win32/Makefile.msc}.
yading@10 172 @item Move @code{zlib.lib}, @code{zconf.h}, and @code{zlib.h} to somewhere MSVC
yading@10 173 can see.
yading@10 174 @end enumerate
yading@10 175
yading@10 176 @item FFmpeg has been tested with Visual Studio 2010 and 2012, Pro and Express.
yading@10 177 Anything else is not officially supported.
yading@10 178
yading@10 179 @end itemize
yading@10 180
yading@10 181 @subsection Linking to FFmpeg with Microsoft Visual C++
yading@10 182
yading@10 183 If you plan to link with MSVC-built static libraries, you will need
yading@10 184 to make sure you have @code{Runtime Library} set to
yading@10 185 @code{Multi-threaded (/MT)} in your project's settings.
yading@10 186
yading@10 187 You will need to define @code{inline} to something MSVC understands:
yading@10 188 @example
yading@10 189 #define inline __inline
yading@10 190 @end example
yading@10 191
yading@10 192 Also note, that as stated in @strong{Microsoft Visual C++}, you will need
yading@10 193 an MSVC-compatible @uref{http://code.google.com/p/msinttypes/, inttypes.h}.
yading@10 194
yading@10 195 If you plan on using import libraries created by dlltool, you must
yading@10 196 set @code{References} to @code{No (/OPT:NOREF)} under the linker optimization
yading@10 197 settings, otherwise the resulting binaries will fail during runtime.
yading@10 198 This is not required when using import libraries generated by @code{lib.exe}.
yading@10 199 This issue is reported upstream at
yading@10 200 @url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}.
yading@10 201
yading@10 202 To create import libraries that work with the @code{/OPT:REF} option
yading@10 203 (which is enabled by default in Release mode), follow these steps:
yading@10 204
yading@10 205 @enumerate
yading@10 206
yading@10 207 @item Open the @emph{Visual Studio Command Prompt}.
yading@10 208
yading@10 209 Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
yading@10 210 which sets up the environment variables for the Visual C++ tools
yading@10 211 (the standard location for this file is something like
yading@10 212 @file{C:\Program Files (x86_\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat}).
yading@10 213
yading@10 214 @item Enter the @file{bin} directory where the created LIB and DLL files
yading@10 215 are stored.
yading@10 216
yading@10 217 @item Generate new import libraries with @command{lib.exe}:
yading@10 218
yading@10 219 @example
yading@10 220 lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib
yading@10 221 @end example
yading@10 222
yading@10 223 Replace @code{foo-version} and @code{foo} with the respective library names.
yading@10 224
yading@10 225 @end enumerate
yading@10 226
yading@10 227 @anchor{Cross compilation for Windows with Linux}
yading@10 228 @section Cross compilation for Windows with Linux
yading@10 229
yading@10 230 You must use the MinGW cross compilation tools available at
yading@10 231 @url{http://www.mingw.org/}.
yading@10 232
yading@10 233 Then configure FFmpeg with the following options:
yading@10 234 @example
yading@10 235 ./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
yading@10 236 @end example
yading@10 237 (you can change the cross-prefix according to the prefix chosen for the
yading@10 238 MinGW tools).
yading@10 239
yading@10 240 Then you can easily test FFmpeg with @uref{http://www.winehq.com/, Wine}.
yading@10 241
yading@10 242 @section Compilation under Cygwin
yading@10 243
yading@10 244 Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack
yading@10 245 llrint() in its C library.
yading@10 246
yading@10 247 Install your Cygwin with all the "Base" packages, plus the
yading@10 248 following "Devel" ones:
yading@10 249 @example
yading@10 250 binutils, gcc4-core, make, git, mingw-runtime, texi2html
yading@10 251 @end example
yading@10 252
yading@10 253 In order to run FATE you will also need the following "Utils" packages:
yading@10 254 @example
yading@10 255 bc, diffutils
yading@10 256 @end example
yading@10 257
yading@10 258 If you want to build FFmpeg with additional libraries, download Cygwin
yading@10 259 "Devel" packages for Ogg and Vorbis from any Cygwin packages repository:
yading@10 260 @example
yading@10 261 libogg-devel, libvorbis-devel
yading@10 262 @end example
yading@10 263
yading@10 264 These library packages are only available from
yading@10 265 @uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
yading@10 266
yading@10 267 @example
yading@10 268 yasm, libSDL-devel, libfaac-devel, libaacplus-devel, libgsm-devel, libmp3lame-devel,
yading@10 269 libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
yading@10 270 @end example
yading@10 271
yading@10 272 The recommendation for x264 is to build it from source, as it evolves too
yading@10 273 quickly for Cygwin Ports to be up to date.
yading@10 274
yading@10 275 @section Crosscompilation for Windows under Cygwin
yading@10 276
yading@10 277 With Cygwin you can create Windows binaries that do not need the cygwin1.dll.
yading@10 278
yading@10 279 Just install your Cygwin as explained before, plus these additional
yading@10 280 "Devel" packages:
yading@10 281 @example
yading@10 282 gcc-mingw-core, mingw-runtime, mingw-zlib
yading@10 283 @end example
yading@10 284
yading@10 285 and add some special flags to your configure invocation.
yading@10 286
yading@10 287 For a static build run
yading@10 288 @example
yading@10 289 ./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
yading@10 290 @end example
yading@10 291
yading@10 292 and for a build with shared libraries
yading@10 293 @example
yading@10 294 ./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
yading@10 295 @end example
yading@10 296
yading@10 297 @chapter Plan 9
yading@10 298
yading@10 299 The native @uref{http://plan9.bell-labs.com/plan9/, Plan 9} compiler
yading@10 300 does not implement all the C99 features needed by FFmpeg so the gcc
yading@10 301 port must be used. Furthermore, a few items missing from the C
yading@10 302 library and shell environment need to be fixed.
yading@10 303
yading@10 304 @itemize
yading@10 305
yading@10 306 @item GNU awk, grep, make, and sed
yading@10 307
yading@10 308 Working packages of these tools can be found at
yading@10 309 @uref{http://code.google.com/p/ports2plan9/downloads/list, ports2plan9}.
yading@10 310 They can be installed with @uref{http://9front.org/, 9front's} @code{pkg}
yading@10 311 utility by setting @code{pkgpath} to
yading@10 312 @code{http://ports2plan9.googlecode.com/files/}.
yading@10 313
yading@10 314 @item Missing/broken @code{head} and @code{printf} commands
yading@10 315
yading@10 316 Replacements adequate for building FFmpeg can be found in the
yading@10 317 @code{compat/plan9} directory. Place these somewhere they will be
yading@10 318 found by the shell. These are not full implementations of the
yading@10 319 commands and are @emph{not} suitable for general use.
yading@10 320
yading@10 321 @item Missing C99 @code{stdint.h} and @code{inttypes.h}
yading@10 322
yading@10 323 Replacement headers are available from
yading@10 324 @url{http://code.google.com/p/plan9front/issues/detail?id=152}.
yading@10 325
yading@10 326 @item Missing or non-standard library functions
yading@10 327
yading@10 328 Some functions in the C library are missing or incomplete. The
yading@10 329 @code{@uref{http://ports2plan9.googlecode.com/files/gcc-apelibs-1207.tbz,
yading@10 330 gcc-apelibs-1207}} package from
yading@10 331 @uref{http://code.google.com/p/ports2plan9/downloads/list, ports2plan9}
yading@10 332 includes an updated C library, but installing the full package gives
yading@10 333 unusable executables. Instead, keep the files from @code{gccbin.tgz}
yading@10 334 under @code{/386/lib/gnu}. From the @code{libc.a} archive in the
yading@10 335 @code{gcc-apelibs-1207} package, extract the following object files and
yading@10 336 turn them into a library:
yading@10 337
yading@10 338 @itemize
yading@10 339 @item @code{strerror.o}
yading@10 340 @item @code{strtoll.o}
yading@10 341 @item @code{snprintf.o}
yading@10 342 @item @code{vsnprintf.o}
yading@10 343 @item @code{vfprintf.o}
yading@10 344 @item @code{_IO_getc.o}
yading@10 345 @item @code{_IO_putc.o}
yading@10 346 @end itemize
yading@10 347
yading@10 348 Use the @code{--extra-libs} option of @code{configure} to inform the
yading@10 349 build system of this library.
yading@10 350
yading@10 351 @item FPU exceptions enabled by default
yading@10 352
yading@10 353 Unlike most other systems, Plan 9 enables FPU exceptions by default.
yading@10 354 These must be disabled before calling any FFmpeg functions. While the
yading@10 355 included tools will do this automatically, other users of the
yading@10 356 libraries must do it themselves.
yading@10 357
yading@10 358 @end itemize
yading@10 359
yading@10 360 @bye