PC6001V をビルドしようぜ (失敗編)
Windows 11マシンを用意します。
MSYS2を入れて、開発環境を入れます。(gcc,make,vim,gitなど)
必要なライブラリを入れます。(sdl3など)
あと、ffmpeg ですが、ソースリストからビルドする必要があるようです。なぜかというと、静的結合版をビルドしたいから。。ソースコードを落としてきて下記を実行します。
./configure --enable-static --disable-shared
make; make install
PC6001V のソースコードを落としてきて、make します。
これでいけるかと思いきや、私の場合、下記のエラーで止まりました
Linking pc6001v.exe...C:\......../ld.exe: C:........bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\libssh.a(misc.c.obj):(.text+0x15f0): multiple definition of `explicit_bzero'; C:........bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\libgnutls.a(libgnu_la-explicit_bzero.o):(.text+0x0): first defined hereC:\......../ld.exe: C:........bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\librav1e.a(rav1e.std-8f4200ddc3508613.std.7e39b4733639c7ef-cgu.0.rcgu.o.rcgu.o):std.7e39b4733639c7ef-cgu.0:(.text+0x241c0): multiple definition of `rust_eh_personality'; C:........bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\librsvg-2.a(std-4dc6217dbfd6d693.std.659bc529da84b7a0-cgu.0.rcgu.o):std.659bc529da84b7a0-cgu.0:(.text+0x565e0): first defined hereC:\......../ld.exe: cannot find -lshaderc_shared: No such file or directoryC:\......../ld.exe: have you installed the static version of the shaderc_shared library ?C:\......../ld.exe: cannot find -ldl: No such file or directoryC:\......../ld.exe: have you installed the static version of the dl library ?C:\......../ld.exe: cannot find -ldl: No such file or directoryC:\......../ld.exe: have you installed the static version of the dl library ?collect2.exe: error: ld returned 1 exit status
-ldl (えるでぃえる)といのは、dlopen という関数をリンクしようとしていますが、実はUnix環境ではひつようだけど、Windows環境では不要らしいです。
ffmpeg みたいなクロスプラットフォームなライブラリを使うときに、しばしばぶちあたる問題のようですね。
対策としては、
1.ffmpeg のconfigure 時に、-ldl を付加しないようなオプションをなんとか編み出して、実行する(?)
2.pkg-config --libs --static libavcodec やpkg-config --libs --static libavformat などの出力から、-ldl を手作業で削除する
3. make -n >hoge.sh して、hoge.sh から -ldl と言うワードを削除してsh hoge.sh で実行する
もう少しましな方法はないものでしょうか?
一番簡単なのは、PC6001VのMakefileから、--static という記述を消すことだったりしますが、なぜ静的リンクしているかというと、PC6001V.exe のほかに、dllファイルが大量に必要とすると、わずらわしいからでしょう。
なるべく本家と同じ方法でやりたいですね。
そもそも、本家にできるのに、なぜできないかという。。うーん。
あと、-lshaderc_shared ですが、
あと、なぜか、起動できる時と、できない時があるような。。うーん。。
