[Libav-user] Building static FFmpeg libs for Windows 64-bit application

Weiß Christoph Christoph.Weiss at ait.ac.at
Thu Mar 24 16:21:11 CET 2016


There is a –toolchain=msvc switch in the FFMpeg configure script.

I wrote up my steps to compile without having to link to libgcc and libmingwex here:
http://cristobaldobranco.github.io/blog/2015/01/20/compiling-ffmpeg-with-windows-tools/

Perhaps it might help.
Cheers, Chris



Von: Libav-user [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Igor R
Gesendet: Donnerstag, 24. März 2016 16:16
An: This list is about using libavcodec, libavformat, libavutil libavdevice and libavfilter.
Betreff: [Libav-user] Building static FFmpeg libs for Windows 64-bit application


I build static FFmpeg libs for Windows 64 bit. Configuring as follows:

./configure --disable-everything --enable-static --disable-shared --enable-memalign-hack --disable-debug --enable-stripping --enable-protocol=file --enable-yasm --enable-decoder=mp3,mpeg4,h264 --enable-muxer=mp4,avi --enable-encoder=mjpeg .

The application is built in Visual Studio 2012 with/MT option and linked with libavformat.a,libavcodec.a etc. I also link it with libmingwex.a,libgcc.a.

The linker fails with the following errors:

6>libavformat.a(file.o) : error LNK2001: unresolved external symbol __imp__wrmdir
6>libavformat.a(file.o) : error LNK2001: unresolved external symbol __imp__rmdir
6>libavformat.a(file.o) : error LNK2001: unresolved external symbol __imp__wunlink
6>libavformat.a(file.o) : error LNK2001: unresolved external symbol __imp__unlink
6>libavutil.a(time.o) : error LNK2001: unresolved external symbol clock_gettime
6>libavutil.a(time.o) : error LNK2001: unresolved external symbol nanosleep

As for the 2 latter errors, I can solve them by manually defining macros in config.h: #define HAVE_NANOSLEEP 1 and #define HAVE_CLOCK_GETTIME 1.

The question is how to solve the former 4. These look like functions imported from a dll (__impprefix), but my application is built with /MT, and I don't want any dynamic dependencies in FFmpeg. How to get rid of them?

I tried to configure FFmpeg with --extra-cflags="-static", but it doesn't help.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160324/ffb7a44e/attachment.html>


More information about the Libav-user mailing list