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

Igor R boost.lists at gmail.com
Thu Mar 24 16:10:10 CET 2016


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/ce88a42b/attachment.html>


More information about the Libav-user mailing list