[FFmpeg-devel] [PATCH] configure: add LIBDRM to extralibs_avutil

James Almer jamrial at gmail.com
Wed Sep 12 00:21:02 EEST 2018


On 9/11/2018 5:59 PM, Giulio Benetti wrote:
> Hello,
> 
> Il 11/09/2018 22:49, James Almer ha scritto:
>> On 9/11/2018 5:29 PM, Giulio Benetti wrote:
>>> When static linking programs using ffmpeg libraries, if linking against
>>> libavutil, -ldrm is listed before -lavutil. This leads to linking
>>> failure
>>> due to undefined reference of drmGetVersion() and drmFreeVersion().
>>> This is why when pkg-config create libavutil.pc doesn't append -ldrm
>>> after -lavutil.
>>>
>>> Create LIBDRM=-ldrm in case libdrm is enabled and add $LIBDRM to
>>> extralibs_avutil.
>>
>> I'm not sure i understand. libdrm is already added to avutil extralibs,
>> seeing it's listed in the "avutil_suggest" line in configure. I see it's
>> also added to avdevice if kmsgrab_indev is enabled.
>>
>> The -ldrm ldflag, assuming the libdrm pkg-config file is correct, should
>> be in $avutil_extralibs when configure dumps it into extralibs_avutil
>> for the purpose of creating libavutil.pc.
>>
> 
> I point you a build failure, so it should be more clear.
> I did my best to explain on commit log, but it wasn't easy.
> 
> http://autobuild.buildroot.net/results/515/5152dcca58944cf732d09fba6e6c9af8a9243c75/build-end.log
> 
> 
> In that case .configure file is different but the point is the same.
> 
> At the end of the log you can see that -ldrm is yes present, but it
> comes too early respect to -lavutil.
> This situation is valid only in the case you link *statically*.
> For dynamic linking there's no problem at all.
> 
> Thanks and
> Best regards
> Giulio Benetti

> -lswscale -lavdevice -lavformat -lavcodec -lssl -lcrypto -lspeex -lmodplug -lstdc++ -lfontconfig -lfreetype -lpng16 -lexpat -ldrm -lz -pthread -latomic -lswresample  -lavutil -lm  

What i'm seeing here is that -ldrm is apparently present in
libavdevice.pc, but not in libavutill.pc, which shouldn't happen given
that it's strictly listed in the avutil_suggest list.

What version of ffmpeg is this script using? Latest git head, an old
snapshot, or a release? Did this start failing recently?
This patch is a hacky way to add the "-ldrm" ldflag to avutil_extralibs.
It should be added organically by configure as part of the dependency
checks, so this is definitely not an adequate fix.


More information about the ffmpeg-devel mailing list