Changes between Initial Version and Version 1 of CompilationGuide/MSVC


Ignore:
Timestamp:
Aug 5, 2014, 10:42:14 PM (5 years ago)
Author:
hahaha1234
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CompilationGuide/MSVC

    v1 v1  
     1It's fairly simple to build ffmpeg on Windows with visual studio. The official guide found on this page is quite clear, but a little bit out-of-date.
     2[https://www.ffmpeg.org/platform.html#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows]
     3
     4I experienced few minor issues while building ffmpeg myself. I decided to document them here.
     5
     6FFmpeg can be built with MSVC 2012 or earlier using a C99-to-C89 conversion utility and wrapper, or with MSVC 2013 natively.
     7
     8You will need the following prerequisites:
     9
     101. C99-to-C89 Converter & Wrapper (if using MSVC 2012 or earlier)
     11[https://github.com/libav/c99-to-c89/]
     12
     132. msinttypes (if using MSVC 2012 or earlier)
     14[http://code.google.com/p/msinttypes/]
     15
     163. MSYS
     17[http://www.mingw.org/]
     18
     194. YASM
     20[http://yasm.tortall.net/]
     21
     22
     23First, you need to unzip and copy 1,2,4 into a folder, for example, c:\c99
     24Then, you need to add the folder c:\c99 into your PATH environment variable.
     25Rename yasm-1.2.0-win64.exe (or the yasm executable you will use) to yasm.exe
     26Finally, create an INCLUDE environment variable, and point it to c:\99, this is the location where the compiler will find inttypes.h
     27
     28To set up a proper environment in MSYS, you need to run msys.bat from the Visual Studio or Intel Compiler command prompt.
     29
     30Next, make sure any other headers and libs you want to use, such as zlib, are located in a spot that the compiler can see. Do so by modifying the LIB and INCLUDE environment variables to include the Windows-style paths to these directories. Alternatively, you can try and use the --extra-cflags/--extra-ldflags configure options.
     31
     32Finally, run:
     33       
     34For MSVC:
     35./configure --toolchain=msvc
     36make
     37make install
     38
     39or the following:
     40./configure --enable-asm --enable-yasm --arch=i386 --disable-ffserver --disable-avdevice --disable-swscale --disable-doc --disable-ffplay --disable-ffprobe --disable-ffmpeg --enable-shared --disable-static --disable-bzlib --disable-libopenjpeg --disable-iconv --disable-zlib --prefix=/c/ffmpeg --toolchain=msvc
     41
     42--enable-shared will generate the dynamic linked lib (dlls)
     43
     44you might see two problems when building ffmpeg:
     451. pr command not found:
     46please take a look at here [http://creekcodes.blogspot.com/2011/02/msys-pr-not-found.html]
     47basically pr.exe is removed from msys, you need to download it from here [http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/_obsolete/coreutils-5.97-MSYS-1.0.11-2/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2/download] and copy pr.exe to the msys/bin folder.
     48
     492. the compiler might complain about redefinition issues of stdint.h, because both msinttypes and visual studio have stdint.h. I removed stdint.h from c:\c99 to let the compiler uses the one provided by visual studio.
     50
     51in the end of configuration, you might also see pkg-config not found issue. that won't affect compilation, you can ignore it. it is said that installing pkg-config to msys is kinda tiresome.