VP9お試しビルド

うまく行かなかったので下記の方法にて解決
VP9お試しビルド(その2) - fftester06’s blog

refs/heads/master - webm/libvpx - Git at Google

cygwin上で作業

$ ./configure
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'x86-win32-gcc'
  enabling x86
  enabling runtime_cpu_detect
  enabling mmx
  enabling sse
  enabling sse2
  enabling sse3
  enabling ssse3
  enabling sse4_1
  enabling avx
  enabling avx2
  enabling avx512
  using yasm
  enabling postproc
  enabling unit_tests
  enabling webm_io
  enabling libyuv
Creating makefiles for x86-win32-gcc libs
Creating makefiles for x86-win32-gcc examples
Creating makefiles for x86-win32-gcc tools
Creating makefiles for x86-win32-gcc docs
$ make
    [CREATE] vpx_scale_rtcd.h
    [CREATE] vpx_dsp_rtcd.h
    [CREATE] vp8_rtcd.h
    [CREATE] vp9_rtcd.h
    [DEP] test/test_intra_pred_speed.cc.d
・・・・
    [AR] libvpx_g.a
    [STRIP] libvpx.a < libvpx_g.a
    [CREATE] vpx.pc
    [CXX] third_party/googletest/src/src/gtest-all.cc.o
In file included from /home/ss/libvpx/third_party/googletest/src/include/gtest/i                            nternal/gtest-internal.h:40:0,
                 from /home/ss/libvpx/third_party/googletest/src/include/gtest/g                            test.h:59,
                 from third_party/googletest/src/src/gtest-all.cc:38:
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:                             関数 ‘int testing::internal::posix::FileNo(FILE*)’ 内:
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:2                            487:51: エラー: ‘fileno’ was not declared in this scope
 inline int FileNo(FILE* file) { return fileno(file); }
                                                   ^
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:                             関数 ‘char* testing::internal::posix::StrDup(const char*)’ 内:
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:2                            493:57: エラー: ‘strdup’ was not declared in this scope
 inline char* StrDup(const char* src) { return strdup(src); }
                                                         ^
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:                             関数 ‘FILE* testing::internal::posix::FDOpen(int, const char*)’ 内:
/home/ss/libvpx/third_party/googletest/src/include/gtest/internal/gtest-port.h:2                            521:71: エラー: ‘fdopen’ was not declared in this scope
 inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
                                                                       ^
In file included from third_party/googletest/src/src/gtest-all.cc:44:0:
/home/ss/libvpx/third_party/googletest/src/src/gtest-port.cc: コンストラクタ ‘te                            sting::internal::CapturedStream::CapturedStream(int)’ 内:
/home/ss/libvpx/third_party/googletest/src/src/gtest-port.cc:1034:50: エラー: ‘m                            kstemp’ was not declared in this scope
     const int captured_fd = mkstemp(name_template);
                                                  ^
make[1]: *** [Makefile:168: third_party/googletest/src/src/gtest-all.cc.o] エラ                            ー 1
make: *** [Makefile:17: .DEFAULT] エラー 2

テストツールでなんかエラーが出てるけど、とりあえずライブラリの生成は成功。

エラーをなくしてビルドを最後まで通してみる。

./configure --disable-tools --disable-unit-tests --disable-docs
→
    [CXX] third_party/libwebm/mkvmuxer/mkvmuxerutil.cc.o
third_party/libwebm/mkvmuxer/mkvmuxerutil.cc: 関数 ‘mkvmuxer::uint64 mkvmuxer::MakeUID(unsigned int*)’ 内:
third_party/libwebm/mkvmuxer/mkvmuxerutil.cc:640:33: エラー: ‘rand_r’ was not declared in this scope
     const int32 nn = rand_r(seed);
                                 ^
make[1]: *** [Makefile:168: third_party/libwebm/mkvmuxer/mkvmuxerutil.cc.o] エラー 1
make: *** [Makefile:17: .DEFAULT] エラー 2

mkvmuxerutil.cc:640
const int32 nn = rand_r(seed); → const int32 nn = rand();

    [CXX] third_party/libwebm/mkvparser/mkvreader.cc.o
third_party/libwebm/mkvparser/mkvreader.cc: メンバ関数 ‘virtual int mkvparser::MkvReader::Read(long long int, long int, unsigned char*)’ 内:
third_party/libwebm/mkvparser/mkvreader.cc:124:54: エラー: ‘fseeko’ was not declared in this scope
   fseeko(m_file, static_cast<off_t>(offset), SEEK_SET);
                                                      ^
make[1]: *** [Makefile:168: third_party/libwebm/mkvparser/mkvreader.cc.o] エラー 1
make: *** [Makefile:17: .DEFAULT] エラー 2

fseekoがないようなのでfseekに書き換え・・・関数の仕様の互換性などは見てません・・・。
まあでもこれでビルドが最後まで通るようになった!

生成されたlibvpx.aをMinGWに持ってきて、simple_encoderをコンパイルしてみる。

C:\Documents and Settings\ss\My Documents\src\imgtrans\VP9\libvpx-refs_heads_mas
ter\examples>gcc simple_decoder.c ..\tools_common.c ..\video_writer.c ..\video_r
eader.c ..\y4minput.c ..\ivfenc.c  ..\ivfdec.c libvpx.a -I..
libvpx.a(vp8_cx_iface.c.o):(.text+0x1af5): undefined reference to `setjmp'
libvpx.a(onyx_if.c.o):(.text+0x2fee): undefined reference to `setjmp'
libvpx.a(vp8_dx_iface.c.o):(.text+0x522): undefined reference to `setjmp'
libvpx.a(vp8_dx_iface.c.o):(.text+0x68b): undefined reference to `setjmp'
libvpx.a(vp8_dx_iface.c.o):(.text+0x7bb): undefined reference to `setjmp'
libvpx.a(onyxd_if.c.o):(.text+0x7a): more undefined references to `setjmp' follo
w
libvpx.a(systemdependent.c.o):(.text+0xf): undefined reference to `sysconf'
collect2.exe: error: ld returned 1 exit status

cygwinでは不要だったsetjmp.hがMinGWでは必要な模様
→vp8_dx_iface.cに追加
同様にunistd.hが必要
→systemdependent.cに追加
...ここまでくるとMinGW用にbashとmakeがほしいような・・・。
しかもビルドがうまく行かないので、Git bash上に環境構築してみることに。