[FFmpeg-devel] [PATCH] Fix link errors when HAVE_X86ASM is not defined

Xiang, Haihao haihao.xiang at intel.com
Thu Nov 22 02:57:53 EET 2018


On Wed, 2018-11-21 at 12:27 -0300, James Almer wrote:
> On 11/20/2018 11:47 PM, Haihao Xiang wrote:
> > This fixes the link errors below:
> > 
> > LD      ffmpeg_g
> > libavfilter/libavfilter.so: undefined reference to `ff_scene_sad_avx2'
> > libavfilter/libavfilter.so: undefined reference to `ff_scene_sad_sse2'
> > collect2: error: ld returned 1 exit status
> > Makefile:108: recipe for target 'ffmpeg_g' failed
> > make: *** [ffmpeg_g] Error 1
> > 
> > Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
> > ---
> >  libavfilter/x86/scene_sad_init.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/libavfilter/x86/scene_sad_init.c
> > b/libavfilter/x86/scene_sad_init.c
> > index 461fa406d9..7e93ef44d3 100644
> > --- a/libavfilter/x86/scene_sad_init.c
> > +++ b/libavfilter/x86/scene_sad_init.c
> > @@ -20,6 +20,7 @@
> >  #include "libavutil/x86/cpu.h"
> >  #include "libavfilter/scene_sad.h"
> >  
> > +#if HAVE_X86ASM
> >  #define SCENE_SAD_FUNC(FUNC_NAME, ASM_FUNC_NAME,
> > MMSIZE)                      \
> >  void
> > ASM_FUNC_NAME(SCENE_SAD_PARAMS);                                         \
> >                                                                             
> >    \
> > @@ -50,3 +51,12 @@ ff_scene_sad_fn ff_scene_sad_get_fn_x86(int depth)
> >      }
> >      return NULL;
> >  }
> > +
> > +#else
> > +
> > +ff_scene_sad_fn ff_scene_sad_get_fn_x86(int depth)
> > +{
> > +    return NULL;
> > +}
> > +
> > +#endif
> > \ No newline at end of file
> 
> Can you test the attached patch? It's more in line with how other asm
> modules with the same issue were fixed before, like synth_filter in
> libavcodec.

Yes, your patch works for me. However I think you should check
HAVE_AVX2_EXTERNAL as well in ff_scene_sad_get_fn_x86(), otherwise the link
error still exists if HAVE_X86ASM is 1 but HAVE_AVX2_EXTERNAL is 0. Both
HAVE_X86ASM and HAVE_AVX2_EXTERNAL are 0 on my system.

Thanks
Haihao


> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list