From patchwork Fri Apr 15 06:54:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 610767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 3qmSwH2QJPz9sDb for ; Fri, 15 Apr 2016 16:55:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=embedded.rocks header.i=@embedded.rocks header.b=UlF6GTak; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6F50FC00D9; Fri, 15 Apr 2016 06:55:10 +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 J39mq8j7PXOA; Fri, 15 Apr 2016 06:55:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id B44BEC00C7; Fri, 15 Apr 2016 06:55:08 +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 4FD681C2D48 for ; Fri, 15 Apr 2016 06:55:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4BE348A08B for ; Fri, 15 Apr 2016 06:55:08 +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 wwYUDzVyhPHz for ; Fri, 15 Apr 2016 06:55:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E7D27C00C7 for ; Fri, 15 Apr 2016 06:55:06 +0000 (UTC) Received: from dovecot03.posteo.de (dovecot03.posteo.de [172.16.0.13]) by mout01.posteo.de (Postfix) with ESMTPS id 9517E2099D for ; Fri, 15 Apr 2016 08:55:03 +0200 (CEST) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3qmSw7323Yz5vN4 for ; Fri, 15 Apr 2016 08:55:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded.rocks (Postfix) with ESMTP id DDD15EE0C76; Fri, 15 Apr 2016 08:55:02 +0200 (CEST) Authentication-Results: mail.embedded.rocks (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=embedded.rocks DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embedded.rocks; h=content-transfer-encoding:content-type:content-type :mime-version:x-mailer:message-id:date:date:subject:subject:from :from:received:received; s=default; t=1460703288; x=1461308089; bh=XuOJBtjKdYdpGDogteK354ychUsK4pEyKHaTx47WfHQ=; b=UlF6GTak+pm6 NJqkorq9/IC03QvG6F+VugBNhb+WOm0HKc76I6EcqQxytKIBsFJv5NcG0A0va9hy SKE9J8wKw2FIUo4mY5QI2TMiH2uQqqHmFOp9XcINBg059GET5naq2vp32QeqGIlu 5LDLaNspYd1lBBcIwMZeS02xKMMTrVEmLZUOcq8PQ6+Q8kxj2By8EtmXkKL5ZUbS O8wdzeOamqUnLJUNVMebW5IDz9+5w8G0bP0yzvv4l+1JukfZYdlg6WWMAnKvKwGK 2uxM8O86Bb9PU+4cLQUOC2MaTA8kZM256Ba8p4W23pnUJPRvswwUuWhK95LJRMDw Il++gTYyFQ== X-Virus-Scanned: Debian amavisd-new at mail.embedded.rocks Received: from mail.embedded.rocks ([127.0.0.1]) by localhost (mail.embedded.rocks [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id LbsWvxJPO0B4; Fri, 15 Apr 2016 08:54:48 +0200 (CEST) Received: from nzxt.fritz.box (x5f72f07d.dyn.telefonica.de [95.114.240.125]) (Authenticated sender: joerg.krause@embedded.rocks) by mail.embedded.rocks (Postfix) with ESMTPSA; Fri, 15 Apr 2016 08:54:48 +0200 (CEST) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: buildroot@buildroot.org Date: Fri, 15 Apr 2016 08:54:45 +0200 Message-Id: <1460703285-3235-1-git-send-email-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.8.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] qt: fix static linking X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" `-ldl` option is used unconditionally in `QMAKE_LIBS_DYNLOAD` while libdl is not supported when libc is static. As the value of `QMAKE_LIBS_DYNLOAD` goes into 'Libs.private' field of the pkgconfig files created by qmake, static linking with qt will fail with: /usr/bin/ld: cannot find -ldl Fix this issue by adding a build test to configure to check if libdl is supported. `QMAKE_LIBS_DYNLOAD` in "src/corelib/plugin/plugin.pri" is now used only if libdl is available. Fixes: http://autobuild.buildroot.net/results/459/4596b9c69cbc387f1071c730aaac76723afaa853/ http://autobuild.buildroot.net/results/459/4596b9c69cbc387f1071c730aaac76723afaa853/ Backported from Qt5: https://github.com/qtproject/qtbase/commit/f669ea0d54302de31456d57286aa0e4ca1443e98 Signed-off-by: Jörg Krause --- ...with-ldl-option-only-when-it-is-supported.patch | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 package/qt/0011-Link-with-ldl-option-only-when-it-is-supported.patch diff --git a/package/qt/0011-Link-with-ldl-option-only-when-it-is-supported.patch b/package/qt/0011-Link-with-ldl-option-only-when-it-is-supported.patch new file mode 100644 index 0000000..f3d47f7 --- /dev/null +++ b/package/qt/0011-Link-with-ldl-option-only-when-it-is-supported.patch @@ -0,0 +1,116 @@ +From 438f088ad520ac91ae47dba9a515ab0d1088c89c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Fri, 15 Apr 2016 03:32:02 +0200 +Subject: [PATCH] Link with -ldl option only when it is supported +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +`-ldl` option is used unconditionally in `QMAKE_LIBS_DYNLOAD` while libdl is +not supported when libc is static. As the value of `QMAKE_LIBS_DYNLOAD` goes +into 'Libs.private' field of the pkgconfig files created by qmake, static +linking with qt will fail with: + /usr/bin/ld: cannot find -ldl + +Fix this issue by adding a build test to configure to check if libdl is +supported. `QMAKE_LIBS_DYNLOAD` in "src/corelib/plugin/plugin.pri" is now used +only if libdl is available. + +Backported from Qt5: +https://github.com/qtproject/qtbase/commit/f669ea0d54302de31456d57286aa0e4ca1443e98 + +Signed-off-by: Jörg Krause +--- + config.tests/unix/libdl/libdl.cpp | 39 +++++++++++++++++++++++++++++++++++++++ + config.tests/unix/libdl/libdl.pro | 3 +++ + configure | 6 ++++++ + src/corelib/plugin/plugin.pri | 2 +- + 4 files changed, 49 insertions(+), 1 deletion(-) + create mode 100644 config.tests/unix/libdl/libdl.cpp + create mode 100644 config.tests/unix/libdl/libdl.pro + +diff --git a/config.tests/unix/libdl/libdl.cpp b/config.tests/unix/libdl/libdl.cpp +new file mode 100644 +index 0000000..28a8233 +--- /dev/null ++++ b/config.tests/unix/libdl/libdl.cpp +@@ -0,0 +1,39 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2015 The Qt Company Ltd. ++** Contact: http://www.qt.io/licensing/ ++** ++** This file is part of the config.tests of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL21$ ++** Commercial License Usage ++** Licensees holding valid commercial Qt licenses may use this file in ++** accordance with the commercial license agreement provided with the ++** Software or, alternatively, in accordance with the terms contained in ++** a written agreement between you and The Qt Company. For licensing terms ++** and conditions see http://www.qt.io/terms-conditions. For further ++** information use the contact form at http://www.qt.io/contact-us. ++** ++** GNU Lesser General Public License Usage ++** Alternatively, this file may be used under the terms of the GNU Lesser ++** General Public License version 2.1 or version 3 as published by the Free ++** Software Foundation and appearing in the file LICENSE.LGPLv21 and ++** LICENSE.LGPLv3 included in the packaging of this file. Please review the ++** following information to ensure the GNU Lesser General Public License ++** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ++** ++** As a special exception, The Qt Company gives you certain additional ++** rights. These rights are described in The Qt Company LGPL Exception ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++#include ++ ++int main(int, char **) ++{ ++ dlopen(0, 0); ++} +diff --git a/config.tests/unix/libdl/libdl.pro b/config.tests/unix/libdl/libdl.pro +new file mode 100644 +index 0000000..a643934 +--- /dev/null ++++ b/config.tests/unix/libdl/libdl.pro +@@ -0,0 +1,3 @@ ++SOURCES = libdl.cpp ++CONFIG -= qt dylib ++LIBS += -ldl +\ No newline at end of file +diff --git a/configure b/configure +index 10ad7ca..1c70691 100755 +--- a/configure ++++ b/configure +@@ -5506,6 +5506,12 @@ if [ "$CFG_LIBPNG" = "auto" ]; then + fi + fi + ++# detect dl ++if ! compileTest unix/libdl "libdl"; then ++ QMakeVar add DEFINES QT_NO_DYNAMIC_LIBRARY ++ QMAKE_CONFIG="$QMAKE_CONFIG no-libdl" ++fi ++ + # detect accessibility + if [ "$CFG_ACCESSIBILITY" = "auto" ]; then + if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then +diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri +index eb7a7f7..c342f2e 100644 +--- a/src/corelib/plugin/plugin.pri ++++ b/src/corelib/plugin/plugin.pri +@@ -32,4 +32,4 @@ integrity { + SOURCES += plugin/qlibrary_unix.cpp + } + +-LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD ++!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD +-- +2.8.0 +