From patchwork Tue Sep 11 20:42:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 968699 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=micronovasrl.com Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=micronovasrl.com header.i=@micronovasrl.com header.b="vqM9iO2O"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 428xgR1zvpz9s1x for ; Wed, 12 Sep 2018 06:42:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A611E88551; Tue, 11 Sep 2018 20:42:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id caaTauKps2D3; Tue, 11 Sep 2018 20:42:38 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id E3BB288557; Tue, 11 Sep 2018 20:42:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 52FC51C0AD3 for ; Tue, 11 Sep 2018 20:42:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 504B986AEB for ; Tue, 11 Sep 2018 20:42:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z9tMLHgxS84X for ; Tue, 11 Sep 2018 20:42:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.micronovasrl.com (mail.micronovasrl.com [212.103.203.10]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8197486AE9 for ; Tue, 11 Sep 2018 20:42:35 +0000 (UTC) Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id D7026B0093D for ; Tue, 11 Sep 2018 22:42:33 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=x-mailer:message-id:date:date:subject:subject:to:from:from; s=dkim; t=1536698552; x=1537562553; bh=nI4RcunsEKTj1o+XhuEryDaN d9F7WyhcSK81yeqtsH0=; b=vqM9iO2OEdNapwtbG7oF3BTKkQvYVCl8Jlmu0vbR sY0DqmVZr4ulErwEHouk21s00ilVzyCl+A6Hb6UO/EwNer9IRygWgCcNS5Fjtlut eTyuVB23Ll4c6HCLMjKYBqZp1OD17GYR9Lt6zhQirYWNDPPtF9WypQRMwL9soc5A FJs= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rUPlDWAU9K6q for ; Tue, 11 Sep 2018 22:42:32 +0200 (CEST) Received: from ubuntu.localdomain (5-157-103-91.v4.ngi.it [5.157.103.91]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 9CB7BB002BD; Tue, 11 Sep 2018 22:42:32 +0200 (CEST) From: Giulio Benetti To: buildroot@buildroot.org Date: Tue, 11 Sep 2018 22:42:30 +0200 Message-Id: <20180911204230.15890-1-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH] ffmpeg: fix static linking build failure when using libavutil X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bernd Kuhls , Mahyar Koshkouei , Giulio Benetti MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 generates libavutil.pc doesn't append -ldrm after -lavutil. Subsequentely if a package uses pkg-config and ffmpeg it will load library dependencies from libavutil.pc without placing -ldrm at the tail. Without this fix the only way is to workaround the problem directly in the single package, like this: https://github.com/buildroot/buildroot/commit/daf7dd87f4d93923df5e757fd43b3ad214a4a2ae Add patch to assure -ldrm comes after -lavutil when static linking. Fixes: http://autobuild.buildroot.net/results/515/5152dcca58944cf732d09fba6e6c9af8a9243c75// http://autobuild.buildroot.net/results/395/395be1a9cab824b82ef34c2ebd84d54243029b33// Signed-off-by: Giulio Benetti --- ...igure-add-LIBDRM-to-extralibs_avutil.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 package/ffmpeg/0002-configure-add-LIBDRM-to-extralibs_avutil.patch diff --git a/package/ffmpeg/0002-configure-add-LIBDRM-to-extralibs_avutil.patch b/package/ffmpeg/0002-configure-add-LIBDRM-to-extralibs_avutil.patch new file mode 100644 index 0000000000..ae1f3423ae --- /dev/null +++ b/package/ffmpeg/0002-configure-add-LIBDRM-to-extralibs_avutil.patch @@ -0,0 +1,44 @@ +From f4c9a7f55229d5275edb89c29ac9b18a737faf65 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +Date: Tue, 11 Sep 2018 19:22:27 +0200 +Subject: [PATCH] configure: add LIBDRM to extralibs_avutil + +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. + +Add -ldrm to LIBDRM in case libdrm is enabled and add $LIBDRM to +extralibs_avutil. + +Signed-off-by: Giulio Benetti +--- + configure | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 7377046d0a..7599fcc2bd 100755 +--- a/configure ++++ b/configure +@@ -5919,7 +5919,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && + die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } + enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas + 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 && { use_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"; } } +@@ -7096,7 +7096,7 @@ source_path=${source_path} + LIBPREF=${LIBPREF} + LIBSUF=${LIBSUF} + +-extralibs_avutil="$LIBRT $LIBM" ++extralibs_avutil="$LIBDRM $LIBRT $LIBM" + extralibs_avcodec="$extralibs" + extralibs_avformat="$extralibs" + extralibs_avdevice="$extralibs" +-- +2.17.1 +