mingw安装指南 原文

来源:互联网 发布:手机淘宝积分在哪里看 编辑:程序博客网 时间:2024/05/01 13:11

Get the most up-to-date MSys+MinGW system.
Today (December 6, 2006), that includes:
                                bash version => 2.05b
                                            and
                    msys-1.0.dll-SNAP-1.0.11-2006.04.23
Do not use bash version 2.0.4. It is known to be broken.
bash version 2.05b works fine for compiling FFmpeg, but 3.1 is preferable(更可取的,更优越的), since it will work fine for building all extra libraries.

Also, do not use binutils-2.15.91-20040904-1. It is known to not link properly.
If you are sure you have this ready, skip to Getting FFmpeg SVN. Or else, read these steps.

Installing MSys
Installing MinGW
Integrating(使一体化) MinGW with MSys

This step can safely be ignored for most people. You'll only need this if you want to generate documentation or install some specific extra libraries. Don't worry about it now, you'll be reminded every time it is needed.


Installing MSys
Go to http://sourceforge.net/project/showfiles.php?group_id=2435
Get these packages:
MSYS-1.0.11-2004.04.30-1.exe
MSYS-1.0.11-20071204.tar.bz2
bash-3.1-MSYS-1.0.11-snapshot.tar.bz2
coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2

Proceed with:
MSYS-1.0.11-2004.04.30-1.exe
    详情,看安装附件 MSYS-1.0.11-2004.04.30-1.exe.doc
    安装路径为: C:/msys
MSYS-1.0.11-20071204.tar.bz2
    Unpack MSYS-1.0.11-20071204.tar.bz2 to C:/msys/. Overwrite all files it asks about. 这个解压出一个BIN目录,将这个bin目录复制到C:/msys/目录下
bash-3.1-MSYS-1.0.11-snapshot.tar.bz2
    Unpack bash-3.1-MSYS-1.0.11-snapshot.tar.bz2.
    It will unpack a folder named bash-3.1.
    Inside that folder, there's a folder named bin, among others. It is the only one(只有这个文件夹有用) that matters for us, unless you really want man pages.
    Copy the files from that bin folder to C:/msys/bin.
    Accept to replace sh.exe.
coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
    Unpack the file.
    Copy coreutils-5.97/bin/pr.exe to C:/msys/bin/.
    Other utils from that package might be welcome too (like du and kill) but aren't necessary for compiling and running FFmpeg.

Fixing (设置)"msys.bat"

    Fixing "msys.bat"
    Open C:/msys/msys.bat in a plain-text editor, such as notepad.exe.

    If you plan on compiling your apps with MSVC++ (note: your apps, not FFmpeg), you will need .lib files to link against FFmpeg's libraries.
    Those .lib files can be generated by the lib command from the Microsoft's Toolchain.
    For that, you must have Microsoft Visual Studio, or Microsoft Visual C++.
    Add the following line to the beggining of msys.bat, replacing the path leading to vcvars32.bat to wherever that file is located in your computer:
    call "C:/Program Files/Microsoft Visual Studio 8/VC/bin/vcvars32.bat"
这样做的功能是什么呢?必须的吗?   可以使用 VC 的LIB命令(工具)来产生*.LIB文件

    If you have Windows x64, you must add the following lines right after the :_WindowsNT label (line 36), or else the shell window will quickly open and close:
    rem Hopefully a temporary workaround for getting MSYS shell to run on x64
    rem (WoW64 cmd prompt sets PROCESSOR_ARCHITECTURE to x86)
    if not "x%PROCESSOR_ARCHITECTURE%" == "xAMD64" goto _NotX64
    set COMSPEC=%WINDIR%/SysWOW64/cmd.exe
    %COMSPEC% /c %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
    goto EOF
    :_NotX64



Installing MinGW
Go to http://sourceforge.net/project/showfiles.php?group_id=2435

Get these packages:
binutils-2.18.50-20080109.tar.gz
mingw-runtime-3.14.tar.gz
w32api-3.11.tar.gz

You may choose to use gcc version 3.4.5, which is the latest official and stable release from MinGW. Using this version, you will not be able to link to the libav* libraries from MSVC++. It will link, but your program will crash on most SSE and MMX optimizations.

I personally prefer using gcc version 4.2.1, which is the latest official and technology preview release from MinGW. I have had no problems with it.


So, choose either:

gcc-core-3.4.5-20060117-1.tar.gz
gcc-g++-3.4.5-20060117-1.tar.gz

or

gcc-core-4.2.1-sjlj-2.tar.gz
gcc-g++-4.2.1-sjlj-2.tar.gz


Then proceed with unpacking all downloaded files to C:/msys/mingw


If you chose gcc version 4.2.1, go to C:/mingw/bin/ and rename:
c++-sjlj.exe to c++.exe
cpp-sjlj.exe to cpp.exe
g++-sjlj.exe to g++.exe
gcc-sjlj.exe to gcc.exe




Integrating(使一体化) MinGW with MSys
Copy C:/msys/etc/fstab.sample to C:/msys/etc/fstab
Open C:/msys/etc/fstab in a plain-text editor that supports unix-style line ending, such as wordpad.exe.

Change the line that says

c:/mingw        /mingw

to

c:/msys/mingw        /mingw

 

 

 

阴历表

http://www.haha83.com