I use mingw-w64 on linux to cross compile the ffmpeg static library for windows with the following command:
./configure --arch=x86 --disable-doc --disable-ffplay --disable-ffprobe --disable-ffmpeg --prefix=/mnt/c/ffmpeg --enable-gpl --enable-nonfree --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config --disable-shared --enable-static
make -j16
make install
Then I got some .a
files instead of .lib
files. Can I directly link these files to MSVC? If not, what should I do next?
Even though you asked for a cross-compilation, here's how you do it natively on Windows. I'd rather do this than trying to use MinGW libraries with MSVC.
This is adapted to MSYS2 from the official guide that uses MSYS1.
pacman -Syu
. If it closes itself during update, restart and run pacman -Syu
to finish the update../configure
script asks for: pacman -S make diffutils mingw-w64-ucrt-x86_64-yasm
.C:\msys64\msys2_shell.cmd -ucrt64 -full-path
. This will add cl.exe
to the PATH.cd
to FFmpeg source directory, ./configure --toolchain=msvc
, make -j4
, DESTDIR="$(realpath inst)" make install
to install to ./inst
.