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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Joel Linn
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
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: if(0) and unresolved symbols.

Jaka Bac
On Mon, 22 Jun 2020 at 14:26, Joel Linn <[hidden email]> 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 becomes:

If(0)
   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,
Jaka


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: if(0) and unresolved symbols.

Carl Eugen Hoyos-2
In reply to this post by Joel Linn


> Am 22.06.2020 um 14:26 schrieb Joel Linn <[hidden email]>:
>
> 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

(You mean you don’t want to use them)

> "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.

You need to enable „dead code elimination“, FFmpeg cannot be compiled without it, most supported compilers do not allow to disable it.

Carl Eugen


>
> Thanks in advance,
> Joel
> _______________________________________________
> Libav-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: if(0) and unresolved symbols.

Jaka Bac
On Mon, 22 Jun 2020 at 16:16, Carl Eugen Hoyos <[hidden email]> wrote:

You need to enable „dead code elimination“, FFmpeg cannot be compiled without it, most supported compilers do not allow to disable it.

Carl Eugen

MSVC with optimizations disabled (/Od) does not do perform DCE

Jaka 

 

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: if(0) and unresolved symbols.

Carl Eugen Hoyos-2
Am Mo., 22. Juni 2020 um 21:36 Uhr schrieb Jaka Bac <[hidden email]>:
>
> On Mon, 22 Jun 2020 at 16:16, Carl Eugen Hoyos <[hidden email]> wrote:
>>
>> You need to enable „dead code elimination“, FFmpeg cannot be
>> compiled without it, most supported compilers do not allow to disable it.

> MSVC with optimizations disabled (/Od) does not do perform DCE

I know.

Most (all other?) supported compilers do not allow to disable Dead Code
Elimination, FFmpeg cannot be compiled without Dead Code Elimination.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: if(0) and unresolved symbols.

Joel Linn
Thanks for the fast and plenty replies.

I got it linking fine now in my debug configuration.
I am however unable to compile for Release although Optimizations are
enabled, some other flags in combination seem to break dead code
elimination.

I will share when I find the culprit.

On 2020-06-22 23:10, Carl Eugen Hoyos wrote:

> Am Mo., 22. Juni 2020 um 21:36 Uhr schrieb Jaka Bac
> <[hidden email]>:
>>
>> On Mon, 22 Jun 2020 at 16:16, Carl Eugen Hoyos <[hidden email]>
>> wrote:
>>>
>>> You need to enable „dead code elimination“, FFmpeg cannot be
>>> compiled without it, most supported compilers do not allow to disable
>>> it.
>
>> MSVC with optimizations disabled (/Od) does not do perform DCE
>
> I know.
>
> Most (all other?) supported compilers do not allow to disable Dead Code
> Elimination, FFmpeg cannot be compiled without Dead Code Elimination.
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".