msys 2コンパイルlibx 264ライブラリ

2825 ワード

時間はもう2018年なので、libx 264の32/64ビットのライブラリをもう一度コンパイルして、メモを書きましょう.同時に新浪ブログにも投稿しました.
今回はmsys 2オリジナルインストールパッケージを使用します.ダウンロード先:https://sourceforge.net/projects/msys2/
(1)ダブルクリックインストールmsys 2-x 86_64-20161025.exe,デフォルトインストールパスC:msys 64mingw 32.exeまたはmingw 64.exeは、mingwの32ビットと64ビットのコンパイル環境(2)64ビットlibx 264ライブラリをコンパイルする、mingw 64を開く.Exceはgccなどの基本的なコンパイルツールをインストールし、リンクを参照
https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2
MSYS has not been updated a long time, MSYS2 is more active, you can download from MSYS2, it has both mingw and cygwin fork package.
To install the MinGW toolchain (Reference):
1.      Open MSYS2 shell from start menu
2.      Run pacman -Sy pacman to update the package database
3.      Re-open the shell, run pacman -Syu to update the package database and core system packages
4.      Re-open the shell, run pacman -Su to update the rest
5.      (Reference)
·         For 32-bits, run pacman -S mingw-w64-i686-toolchain
·         For 64 bits, run pacman -S mingw-w64-x86_64-toolchain
6.      Select which package to install, default is all
7.      You may also need make, run pacman -S make
コンパイル環境がインストールされない前に、
gcc-vはgccが見つからないことを提示し、ツールチェーンをインストールするとgcc-vにgccバージョン番号が表示されます
(3)libx 264の解決に必要な依存ライブラリ,例えばnasmの欠如
pacman -S nasm
(4)libx 264ソースをダウンロードし、解凍し、x 264ソースのディレクトリの下に入る
公式サイト
https://www.videolan.org/developers/x264.html
git clone http://git.videolan.org/git/x264.git

(5)libx 264をコンパイル、コンパイルする.aとすることができる.lib,リファレンスリンク
http://www.ayobamiadewole.com/Blog/Others/x264compilation.aspxNow compiling the x264 into a dynamic link library that can be used in Visual studio takes another process entirely. Open the MinGW bash once again and change the directory to the location of your x264 source code, just like you did previously. Then type ./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264-120.def               or just ./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def   Now in libx264-120.def “120” is the version of the x264 you are using, you can find the version of the x264 you are using by opening the x264.h file in your x264 source folder you will see something like this #define X264_BUILD 120 depending on your version.You can now type the make command and press enter and you will find the libx264-120.dll in your x264 source folder. Then rename libx264-120.dll to libx264.dll and you have you dynamic link library to work with. If you wish to generate the Visual Studio .lib file to work with then open a Visual Studio command prompt, and change the directory to the location of the x264 source . Then run this command LIB/DEF:libx264.def /Machine:x64Then press enter