LoginSignup
1
3

More than 5 years have passed since last update.

cerberoを使ってVS2015でGStreamerをビルドする

Posted at

最近のGstreamerはWindowsでどのようにビルドするのかを調べていたところ、

なる記事に当たった。

cerberoという依存アプリを含めてソースをダウンロードしながら自動ビルドするシステムを作ったらしい。
記事では、gentooに言及したりしているので期待が持てそう。
MesonというのはNinjaのフロントエンドでGStreamerのビルドに使うみたい。
cerberoはGStreamerをビルドするときはMesonを呼び出すいうことか。

Windows10(64bit)でGstreamerのビルドをやってみる。

cerberoの手順に従ってWindows環境を準備する

をcloneする。
cerbero自身はpython2のスクリプト。

  • python2.7
  • python3.6(3.5だとconsoleのcodepageの扱いで非英語のWindowsでエラーになる)
  • git
  • cmake
  • MSYS/MinGW

あたりを
https://github.com/centricular/cerbero#windows
に書いてある通りに導入する。
コマンドラインはmsysを使えということなのだろうか。

msys shellを整える

minttyはerror時のpromptでメニューが出ずに固まることが分かったので中止

Recipe 'gst-plugins-bad-1.0' failed at the build step 'compile'
Select an action to proceed:
[0] Enter the shell
[1] Rebuild the recipe from scratch
[2] Rebuild starting from the failed step
[3] Skip recipe
[4] Abort

minttyだとこれが出ずに固まる。

shell開始用のショートカットを作る

D:\MinGW\msys\1.0\msys.bat 

環境変数

以下のようなPATHを綺麗にするログインスクリプトを作った。
同じ名前のコマンドがヒットしないようにPATHの順番にも注意する必要がある(間違えてmsys-gccをインストールしちゃった)。

msysの~/.profile
PATH=""
PATH="${PATH}:/D/dev/_build/cerbero/build/mingw/w64/bin"
PATH="${PATH}:/usr/local/bin"
PATH="${PATH}:/mingw/bin"
PATH="${PATH}:/usr/bin"
PATH="${PATH}:/D/tools/cmake-3.7.2-win64-x64/bin"
PATH="${PATH}:/D/Git/bin"
#PATH="${PATH}:/d/Python35/Scripts:/d/Python35:/d/Python27:/C/Windows/System32"
PATH="${PATH}:/d/Python36/Scripts:/d/Python36:/d/Python27:/C/Windows/System32"
export PATH

if [ -e $HOME/.bashrc ];then
    source $HOME/.bashrc
fi

gitの設定

user.emailとuser.nameの設定が無くてcloneに失敗する場合があるので。

$ git config --global user.email "user@host"
$ git config --global user.name "user"

並行ビルドの設定

makeの-jオプションの引数になる。ドキュメントの記述が見つからなかったのでソースを見て勘で作った。
コア数に応じて適当にどうぞ。

~/.cerbero/cerbero.cbc
allow_parallel_build=True
num_of_cpus=8

bootstrap

$ python2 ./cerbero-uninstalled -c config/win64-mixed-msvc.cbc bootstrap

gccをダウンロードしてMinGW版のgettextとかiconvをビルドするので、msysのconfigureが遅いのもあって長い。1時間以上かかった。あと、cerbero directoryをアンチウイルスの対象外にせよとのアドバイスがあった(非常に遅くなり、時にはビルドが途中で失敗するそうな)。

build gstreamer

$ python2 ./cerbero-uninstalled -c config/win64-mixed-msvc.cbc build gst-plugins-base-1.0

うまくいった。
Windowsでautovideosinkがうごくようにしたいのでgoodとbadもやってみる。

$ python2 ./cerbero-uninstalled -c config/win64-mixed-msvc.cbc build gst-plugins-good-1.0
$ python2 ./cerbero-uninstalled -c config/win64-mixed-msvc.cbc build gst-plugins-bad-1.0
$ /d/dev/_build/cerbero/build/dist/windows_x86_64/bin/gst-launch-1.0.exe -v videotestsrc ! autovideosink

無事動いた。
d3dvideosink.png

visualstudioのprojectを出力できるらしい?

まとめ

うまく動いていると思う。
Glibというよりもgettext周り(libintl)のビルドが厄介なので、そこがクリアされているのは有用かなと。
だが、動作を見てみるとGlibより下はMinGW64のGCCでビルドしているみたいだ。

によると下記の部分はMSVCビルドらしい。

  • bzip2.recipe
  • orc.recipe
  • libffi.recipe (only 32-bit)
  • glib.recipe
  • gstreamer-1.0.recipe
  • gst-plugins-base-1.0.recipe
  • gst-plugins-good-1.0.recipe
  • gst-plugins-bad-1.0.recipe
  • gst-plugins-ugly-1.0.recipe
config/win64-mixed-msvc.cbc

のmixedというのはそういうことか。
混ぜていいんだっけ?。
static runtimeじゃなければよいのかな。

configを見ると、

config/win64-pure-msvc.cbc

というのもある。こっちは全部msvcでがんばってくれそう・・・。
今後、recipeが充実していけばかなりよくなるんでなかろうか。

リンク

cerberoにrecipeを追加する例

GStreamerにもcerberoビルドについて書いてあった

Mesonについて

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3