From patchwork Mon Aug 8 17:11:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Bedarkar X-Patchwork-Id: 656893 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]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s7PBQ5VKmz9sRB for ; Tue, 9 Aug 2016 03:13:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BF34388F9C; Mon, 8 Aug 2016 17:13:16 +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 RWeEt7aV6U44; Mon, 8 Aug 2016 17:13:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id F289C88DA5; Mon, 8 Aug 2016 17:13:15 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id B21B31C0D74 for ; Mon, 8 Aug 2016 17:13:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A607130E1E for ; Mon, 8 Aug 2016 17:13:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oCMuO0XACK0M for ; Mon, 8 Aug 2016 17:13:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by silver.osuosl.org (Postfix) with ESMTP id 664723095A for ; Mon, 8 Aug 2016 17:13:13 +0000 (UTC) Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id A92F576EF6673 for ; Mon, 8 Aug 2016 18:12:57 +0100 (IST) Received: from PUMAIL01.pu.imgtec.org (192.168.91.250) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (TLS) id 14.3.294.0; Mon, 8 Aug 2016 18:13:01 +0100 Received: from pudesk287-linux.pu.imgtec.org (192.168.91.23) by PUMAIL01.pu.imgtec.org (192.168.91.250) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 8 Aug 2016 22:42:59 +0530 From: Rahul Bedarkar To: Date: Mon, 8 Aug 2016 22:41:51 +0530 Message-ID: <1470676311-12729-2-git-send-email-rahul.bedarkar@imgtec.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1470676311-12729-1-git-send-email-rahul.bedarkar@imgtec.com> References: <1470676311-12729-1-git-send-email-rahul.bedarkar@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.91.23] Cc: Rahul Bedarkar Subject: [Buildroot] [PATCH 2/2] lftp: fix static link with readline 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" When readline is static library, we need to link against ncurses, it is because, dependent library's symbols are not resolved when static library is built. Those symbols are resolved when binary tries to link with static library. We can't pass linker flags for ncurses by setting LIBS environment variable via _CONF_ENV because it looks like build system is not taking that into account and even though it would have been, order of linking is important. We can't also pass linker flags for ncurses via --with-readline-libs conf options because it causes lftp_LIB_READLINE macro to take readline headers from host machine if available. To use --with-readline-libs we need to set --with-readline=yes and --with-readline-inc to include dir. But when --with-readline=yes, readline_prefix is computed based on if headers can be found in /usr/local or /usr. If readline is installed on host machine, then configure fails since we are using headers for host machine. If headers are not found in /usr/local or /usr then only path specified --with-readline-inc is taken into account. So specifying linker flags for ncurses via --with-readline-libs will not work in all cases. So it looks like, updating linker flags directly is only option to fix static link issue against readline. Fixes: http://autobuild.buildroot.net/results/ae9/ae93bd1b4f6e1ed8f386830d4a51f00d9466f267/ Signed-off-by: Rahul Bedarkar --- .../lftp/0001-fix-static-link-with-readline.patch | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 package/lftp/0001-fix-static-link-with-readline.patch diff --git a/package/lftp/0001-fix-static-link-with-readline.patch b/package/lftp/0001-fix-static-link-with-readline.patch new file mode 100644 index 0000000..3392396 --- /dev/null +++ b/package/lftp/0001-fix-static-link-with-readline.patch @@ -0,0 +1,40 @@ +fix static link with readline + +When readline is static library, we need to link against ncurses +because readline needs ncurses. It is because, dependent library's +symbols are not resolved when static library is built. Those symbols +are resolved program tries to link with static library. + +We can't pass linker flags for ncurses by setting LIBS environment +variable via _CONF_ENV because it looks like build system is not +taking that into account and even though it would have been, order of +linking is important. + +We can't also pass linker flags for ncurses via --with-readline-libs +conf options because it causes lftp_LIB_READLINE macro to take readline +headers from host machine if available. To use --with-readline-libs +we need to set --with-readline=yes and --with-readline-inc to include +dir. But when --with-readline=yes, readline_prefix is computed based +on if headers can be found in /usr/local or /usr. If readline is +installed on host machine, then configure fails since we are using +headers for host machine. If headers are not found in /usr/local or /usr +then only path specified --with-readline-inc is taken into account. +So specifying linker flags for ncurses via --with-readline-libs will +not work in all cases. + +So it looks like, updating linker flags directly is only option to fix +static link issue against readline. + +Signed-off-by: Rahul Bedarkar + +--- lftp-4.7.3/m4/lftp_lib_readline.m4.old 2016-08-08 19:49:12.217596470 +0530 ++++ lftp-4.7.3/m4/lftp_lib_readline.m4 2016-08-08 19:49:46.265596398 +0530 +@@ -108,7 +108,7 @@ AC_DEFUN([lftp_LIB_READLINE], + readline_include_dir="$readline_include_dir/readline" + fi + readline_ld_flags="-L$readline_prefix/lib" +- readline_lib_flags="-lreadline" ++ readline_lib_flags="-lreadline -lncurses" + run_readline_test="yes" + elif test "$readline_requested" = "yes"; then + if test -n "$readline_include_dir" -a -n "$readline_lib_flags"; then