[Libav-user] if(0) and unresolved symbols.

Jaka Bac jakabac at gmail.com
Mon Jun 22 17:03:34 EEST 2020

On Mon, 22 Jun 2020 at 14:26, Joel Linn <jl at conductive.de> wrote:

> Hi folks,
> I want to use components statically. There is a number of places where
> functions are called conditionally based on config defines, for example
> in libavutil/cpu.c get_cpu_flags():
>      if (ARCH_PPC)
>          return ff_get_cpu_flags_ppc();
> I can't use the makefiles so needed to "translate" them into our build
> system for the parts I need.
> However I get unresolved symbols. What am I missing? I'm pretty sure the
> makefiles don't build the objects that define those unused functions
> either.
> Thanks in advance,
> Joel

If you have optimizations completely disabled in some compilers, dead code
elimination will not be applied so even if after macro expansion this

   return ff_get_cpu_flags_ppc();

linker will complain that  ff_get_cpu_flags_ppc is not available (since you
are obviously not compiling for PPC)
Depending on your compiler, try to enable just enough optimizations to get
dead code elimination pass applied.

Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200622/22438c20/attachment.html>

More information about the Libav-user mailing list