You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

336 lines
12KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle Platform Specific information
  3. @titlepage
  4. @center @titlefont{Platform Specific information}
  5. @end titlepage
  6. @top
  7. @contents
  8. @chapter Unix-like
  9. Some parts of Libav cannot be built with version 2.15 of the GNU
  10. assembler which is still provided by a few AMD64 distributions. To
  11. make sure your compiler really uses the required version of gas
  12. after a binutils upgrade, run:
  13. @example
  14. $(gcc -print-prog-name=as) --version
  15. @end example
  16. If not, then you should install a different compiler that has no
  17. hard-coded path to gas. In the worst case pass @code{--disable-asm}
  18. to configure.
  19. @section BSD
  20. BSD make will not build Libav, you need to install and use GNU Make
  21. (@command{gmake}).
  22. @section (Open)Solaris
  23. GNU Make is required to build Libav, so you have to invoke (@command{gmake}),
  24. standard Solaris Make will not work. When building with a non-c99 front-end
  25. (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
  26. or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
  27. since the libc is not c99-compliant by default. The probes performed by
  28. configure may raise an exception leading to the death of configure itself
  29. due to a bug in the system shell. Simply invoke a different shell such as
  30. bash directly to work around this:
  31. @example
  32. bash ./configure
  33. @end example
  34. @anchor{Darwin}
  35. @section Darwin (OS X, iPhone)
  36. The toolchain provided with Xcode is sufficient to build the basic
  37. unacelerated code.
  38. OS X on PowerPC or ARM (iPhone) requires a preprocessor from
  39. @url{http://github.com/yuvi/gas-preprocessor} to build the optimized
  40. assembler functions. Just download the Perl script and put it somewhere
  41. in your PATH, Libav's configure will pick it up automatically.
  42. OS X on AMD64 and x86 requires @command{yasm} to build most of the
  43. optimized assembler functions @url{http://mxcl.github.com/homebrew/, Homebrew},
  44. @url{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix}
  45. or @url{http://www.macports.org, MacPorts} can easily provide it.
  46. @chapter DOS
  47. Using a cross-compiler is preferred for various reasons.
  48. @url{http://www.delorie.com/howto/djgpp/linux-x-djgpp.html}
  49. @chapter OS/2
  50. For information about compiling Libav on OS/2 see
  51. @url{http://www.edm2.com/index.php/FFmpeg}.
  52. @chapter Windows
  53. @section Native Windows compilation
  54. Libav can be built to run natively on Windows using the MinGW or MinGW-w64
  55. toolchains. Install the latest versions of MSYS and MinGW or MinGW-w64 from
  56. @url{http://www.mingw.org/} or @url{http://mingw-w64.sourceforge.net/}.
  57. You can find detailed installation instructions in the download section and
  58. the FAQ.
  59. Libav does not build out-of-the-box with the packages the automated MinGW
  60. installer provides. It also requires coreutils to be installed and many other
  61. packages updated to the latest version. The minimum versions for some packages
  62. are listed below:
  63. @itemize
  64. @item bash 3.1
  65. @item msys-make 3.81-2 (note: not mingw32-make)
  66. @item w32api 3.13
  67. @item mingw-runtime 3.15
  68. @end itemize
  69. Libav automatically passes @code{-fno-common} to the compiler to work around
  70. a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}).
  71. Notes:
  72. @itemize
  73. @item Building natively using MSYS can be sped up by disabling implicit rules
  74. in the Makefile by calling @code{make -r} instead of plain @code{make}. This
  75. speed up is close to non-existent for normal one-off builds and is only
  76. noticeable when running make for a second time (for example during
  77. @code{make install}).
  78. @item In order to compile AVplay, you must have the MinGW development library
  79. of @uref{http://www.libsdl.org/, SDL} and @code{pkg-config} installed.
  80. @item By using @code{./configure --enable-shared} when configuring Libav,
  81. you can build all libraries as DLLs.
  82. @end itemize
  83. @section Microsoft Visual C++ compatibility
  84. As stated in the FAQ, Libav will not compile under MSVC++. However, if you
  85. want to use the libav* libraries in your own applications, you can still
  86. compile those applications using MSVC++. But the libav* libraries you link
  87. to @emph{must} be built with MinGW. However, you will not be able to debug
  88. inside the libav* libraries, since MSVC++ does not recognize the debug
  89. symbols generated by GCC.
  90. We strongly recommend you to move over from MSVC++ to MinGW tools.
  91. This description of how to use the Libav libraries with MSVC++ is based on
  92. Microsoft Visual C++ 2005 Express Edition. If you have a different version,
  93. you might have to modify the procedures slightly.
  94. @subsection Using static libraries
  95. Assuming you have just built and installed Libav in @file{/usr/local}:
  96. @enumerate
  97. @item Create a new console application ("File / New / Project") and then
  98. select "Win32 Console Application". On the appropriate page of the
  99. Application Wizard, uncheck the "Precompiled headers" option.
  100. @item Write the source code for your application, or, for testing, just
  101. copy the code from an existing sample application into the source file
  102. that MSVC++ has already created for you. For example, you can copy
  103. @file{libavformat/output-example.c} from the Libav distribution.
  104. @item Open the "Project / Properties" dialog box. In the "Configuration"
  105. combo box, select "All Configurations" so that the changes you make will
  106. affect both debug and release builds. In the tree view on the left hand
  107. side, select "C/C++ / General", then edit the "Additional Include
  108. Directories" setting to contain the path where the Libav includes were
  109. installed (i.e. @file{c:\msys\1.0\local\include}).
  110. Do not add MinGW's include directory here, or the include files will
  111. conflict with MSVC's.
  112. @item Still in the "Project / Properties" dialog box, select
  113. "Linker / General" from the tree view and edit the
  114. "Additional Library Directories" setting to contain the @file{lib}
  115. directory where Libav was installed (i.e. @file{c:\msys\1.0\local\lib}),
  116. the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}),
  117. and the directory where MinGW's GCC libs are installed
  118. (i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select
  119. "Linker / Input" from the tree view, and add the files @file{libavformat.a},
  120. @file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a},
  121. @file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a})
  122. to the end of "Additional Dependencies".
  123. @item Now, select "C/C++ / Code Generation" from the tree view. Select
  124. "Debug" in the "Configuration" combo box. Make sure that "Runtime
  125. Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in
  126. the "Configuration" combo box and make sure that "Runtime Library" is
  127. set to "Multi-threaded DLL".
  128. @item Click "OK" to close the "Project / Properties" dialog box.
  129. @item MSVC++ lacks some C99 header files that are fundamental for Libav.
  130. Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list}
  131. and install it in MSVC++'s include directory
  132. (i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}).
  133. @item MSVC++ also does not understand the @code{inline} keyword used by
  134. Libav, so you must add this line before @code{#include}ing libav*:
  135. @example
  136. #define inline _inline
  137. @end example
  138. @item Build your application, everything should work.
  139. @end enumerate
  140. @subsection Using shared libraries
  141. This is how to create DLL and LIB files that are compatible with MSVC++:
  142. Within the MSYS shell, build Libav with
  143. @example
  144. ./configure --enable-shared
  145. make
  146. make install
  147. @end example
  148. Your install path (@file{/usr/local/} by default) should now have the
  149. necessary DLL and LIB files under the @file{bin} directory.
  150. Alternatively, build the libraries with a cross compiler, according to
  151. the instructions below in @ref{Cross compilation for Windows with Linux}.
  152. To use those files with MSVC++, do the same as you would do with
  153. the static libraries, as described above. But in Step 4,
  154. you should only need to add the directory where the LIB files are installed
  155. (i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are
  156. installed in the @file{bin} directory. And instead of adding the static
  157. libraries (@file{libxxx.a} files) you should add the MSVC import libraries
  158. (@file{avcodec.lib}, @file{avformat.lib}, and
  159. @file{avutil.lib}). Note that you should not use the GCC import
  160. libraries (@file{libxxx.dll.a} files), as these will give you undefined
  161. reference errors. There should be no need for @file{libmingwex.a},
  162. @file{libgcc.a}, and @file{wsock32.lib}, nor any other external library
  163. statically linked into the DLLs.
  164. Libav headers do not declare global data for Windows DLLs through the usual
  165. dllexport/dllimport interface. Such data will be exported properly while
  166. building, but to use them in your MSVC++ code you will have to edit the
  167. appropriate headers and mark the data as dllimport. For example, in
  168. libavutil/pixdesc.h you should have:
  169. @example
  170. extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
  171. @end example
  172. Note that using import libraries created by dlltool requires
  173. the linker optimization option to be set to
  174. "References: Keep Unreferenced Data (@code{/OPT:NOREF})", otherwise
  175. the resulting binaries will fail during runtime. This isn't
  176. required when using import libraries generated by lib.exe.
  177. This issue is reported upstream at
  178. @url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}.
  179. To create import libraries that work with the @code{/OPT:REF} option
  180. (which is enabled by default in Release mode), follow these steps:
  181. @enumerate
  182. @item Open @emph{Visual Studio 2005 Command Prompt}.
  183. Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
  184. which sets up the environment variables for the Visual C++ tools
  185. (the standard location for this file is
  186. @file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}).
  187. @item Enter the @file{bin} directory where the created LIB and DLL files
  188. are stored.
  189. @item Generate new import libraries with @command{lib.exe}:
  190. @example
  191. lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib
  192. @end example
  193. Replace @code{foo-version} and @code{foo} with the respective library names.
  194. @end enumerate
  195. @anchor{Cross compilation for Windows with Linux}
  196. @section Cross compilation for Windows with Linux
  197. You must use the MinGW cross compilation tools available at
  198. @url{http://www.mingw.org/}.
  199. Then configure Libav with the following options:
  200. @example
  201. ./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
  202. @end example
  203. (you can change the cross-prefix according to the prefix chosen for the
  204. MinGW tools).
  205. Then you can easily test Libav with @uref{http://www.winehq.com/, Wine}.
  206. @section Compilation under Cygwin
  207. Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack
  208. llrint() in its C library.
  209. Install your Cygwin with all the "Base" packages, plus the
  210. following "Devel" ones:
  211. @example
  212. binutils, gcc4-core, make, git, mingw-runtime, texi2html
  213. @end example
  214. In order to run FATE you will also need the following "Utils" packages:
  215. @example
  216. bc, diffutils
  217. @end example
  218. If you want to build Libav with additional libraries, download Cygwin
  219. "Devel" packages for Ogg and Vorbis from any Cygwin packages repository:
  220. @example
  221. libogg-devel, libvorbis-devel
  222. @end example
  223. These library packages are only available from
  224. @uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
  225. @example
  226. yasm, libSDL-devel, libfaac-devel, libgsm-devel, libmp3lame-devel,
  227. libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
  228. @end example
  229. The recommendation for x264 is to build it from source, as it evolves too
  230. quickly for Cygwin Ports to be up to date.
  231. @section Crosscompilation for Windows under Cygwin
  232. With Cygwin you can create Windows binaries that do not need the cygwin1.dll.
  233. Just install your Cygwin as explained before, plus these additional
  234. "Devel" packages:
  235. @example
  236. gcc-mingw-core, mingw-runtime, mingw-zlib
  237. @end example
  238. and add some special flags to your configure invocation.
  239. For a static build run
  240. @example
  241. ./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
  242. @end example
  243. and for a build with shared libraries
  244. @example
  245. ./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
  246. @end example
  247. @bye