[FFmpeg-trac] #2610(undetermined:new): Visual Studio 2012 linker errors with /GL /LTCG

FFmpeg trac at avcodec.org
Thu May 30 20:46:44 CEST 2013


#2610: Visual Studio 2012 linker errors with /GL /LTCG
-------------------------------------+-------------------------------------
             Reporter:  Steve        |                     Type:  defect
  Rothkin                            |                 Priority:  normal
               Status:  new          |                  Version:  git-
            Component:               |  master
  undetermined                       |               Blocked By:
             Keywords:               |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 How to reproduce:
 {{{
 Configure and build in MSYS with
     ./configure --toolchain=msvc --cpu=i686 --arch=i686 --enable-shared
 --disable-static --disable-programs --disable-doc  --disable-swresample
 --disable-postproc  --disable-zlib --disable-bzlib --enable-runtime-
 cpudetect --extra-ldflags="-DEBUG -INCREMENTAL:NO -OPT:REF"
 --optflags="-Zi -O2 -Oy-" --extra-cflags="-I/m -MD"

 Linker will report errors like _ff_get_cpu_flags_ppc is not defined.
 }}}

 The problem is caused by source code lines like

     if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();

 which refer to functions that aren't part of the build because they are
 configured out.

 It seems that many compilers (including Visual Studio when not using whole
 program compilation and link-time optimization) recognize that the above
 statement is dead code and optimize it out during compile. But the Visual
 Studio compiler apparently leaves it in when /GL (whole program
 optimization) is enabled.

 The solution is to change all of these blocks of code to look like this:

 #if (ARCH_PPC)
     flags = ff_get_cpu_flags_ppc();
 #endif

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2610>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list