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

James Almer jamrial at gmail.com
Tue Sep 11 23:49:22 EEST 2018


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.

> 
> Signed-off-by: Giulio Benetti <giulio.benetti at micronovasrl.com>
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index ef97c6b500..28bc3481bc 100755
> --- a/configure
> +++ b/configure
> @@ -6057,7 +6057,7 @@ enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_
>  enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
>  enabled libdavs2          && require_pkg_config libdavs2 "davs2 >= 1.5.115" davs2.h davs2_decoder_open
>  enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
> -enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
> +enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion && LIBDRM="-ldrm"
>  enabled libfdk_aac        && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
>                                 { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
>                                   warn "using libfdk without pkg-config"; } }
> @@ -7347,7 +7347,7 @@ rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}")
>  source_path=${source_path}
>  LIBPREF=${LIBPREF}
>  LIBSUF=${LIBSUF}
> -extralibs_avutil="$avutil_extralibs"
> +extralibs_avutil="$avutil_extralibs $LIBDRM"
>  extralibs_avcodec="$avcodec_extralibs"
>  extralibs_avformat="$avformat_extralibs"
>  extralibs_avdevice="$avdevice_extralibs"
> 



More information about the ffmpeg-devel mailing list