[FFmpeg-devel] [PATCH] configure: fix linking with MSVC when using --disable-optimizations

Steve Lhomme robux4 at gmail.com
Wed Dec 14 17:47:56 EET 2016


From: Steve Lhomme <robux4 at gmail.com>

Without any optimization flags, MSVC does no dead code elimination (DCE) at
all, even for the most trivial cases. DCE is a prerequisite for building ffmpeg
correctly, otherwise there are undefined references to functions for other
architectures and disabled components.

-Os -Og is the minimal optimization flags for MSVC that does include DCE. It
warns that -Og will be removed but it doesn't work without. -O1 includes these
flags and some other ones not necessary to link properly.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 9dfd006..1a8a05c 100755
--- a/configure
+++ b/configure
@@ -4087,6 +4087,7 @@ probe_cc(){
         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
         _cflags_speed="-O2"
         _cflags_size="-O1"
+        _cflags_noopt="-Os -Og"
         if $_cc -nologo- 2>&1 | grep -q Linker; then
             _ld_o='-out:$@'
         else
-- 
2.10.2



More information about the ffmpeg-devel mailing list