From patchwork Mon Nov 28 05:11:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Bobroff X-Patchwork-Id: 699857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tRvtL0r6Zz9t0H for ; Mon, 28 Nov 2016 16:11:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D78BB8AD56; Mon, 28 Nov 2016 05:11:49 +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 kUgCw1IS4DYr; Mon, 28 Nov 2016 05:11:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id CE8A68ACAA; Mon, 28 Nov 2016 05:11:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CB9561C0180 for ; Mon, 28 Nov 2016 05:11:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C541B86014 for ; Mon, 28 Nov 2016 05:11:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Phj61ue2y02N for ; Mon, 28 Nov 2016 05:11:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by whitealder.osuosl.org (Postfix) with ESMTPS id B99FD85E42 for ; Mon, 28 Nov 2016 05:11:45 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAS59EQa138397 for ; Mon, 28 Nov 2016 00:11:45 -0500 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) by mx0a-001b2d01.pphosted.com with ESMTP id 270ajcgbm2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 28 Nov 2016 00:11:45 -0500 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Nov 2016 15:11:42 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Nov 2016 15:11:41 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 81F4E2BB0055 for ; Mon, 28 Nov 2016 16:11:40 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAS5BeZv34603220 for ; Mon, 28 Nov 2016 16:11:40 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uAS5BeBp013332 for ; Mon, 28 Nov 2016 16:11:40 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uAS5BdQf013317; Mon, 28 Nov 2016 16:11:39 +1100 Received: from tungsten.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 894F2A01B7; Mon, 28 Nov 2016 16:11:39 +1100 (AEDT) From: Sam Bobroff To: buildroot@busybox.net Date: Mon, 28 Nov 2016 16:11:39 +1100 X-Mailer: git-send-email 2.1.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112805-1617-0000-0000-00000186AC2F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112805-1618-0000-0000-0000473F9DF3 Message-Id: <1d653a47bcc91167e4ff1782e889a8229119fc3b.1480309892.git.sam.bobroff@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-28_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611280090 Subject: [Buildroot] [PATCH v3 1/1] pkg-autotools: generic configure fix for powerpc64 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Many (100+) packages supported by buildroot contain old configure scripts (or build them from old versions of autotools) that are unable to determine how to link shared libraries on powerpc64 and powerpc64le. This causes that test to erroneously fail on toolchains that are not "bi-endian" (which is the case for toolchains built by buildroot), which causes configure to build static libraries instead of dynamic ones. Although these builds succeed, they tend to cause linker failures in binaries later linked against them. Because affected configure files can be discovered automatically, this patch introduces a hook (enabled only when building for powerpc64 and powerpc64le) that uses a script to scan and fix each package. Signed-off-by: Sam Bobroff Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- v3: Followed suggestions from Arnout Vandecappelle: * simplify test. * double-$ variables. v2: * Patch host packages as well as target ones. (Feedback on the GNU Make code to detect this is welcome.) * Folded long line in script. * Removed patch backup files. * Updated diff to unified format. * Changed $pkg variable to $srcdir. package/pkg-autotools.mk | 16 ++++++++++ support/scripts/fix-configure-powerpc64.sh | 47 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 support/scripts/fix-configure-powerpc64.sh diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index d1cdb89..00822e2 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -79,6 +79,15 @@ define LIBTOOL_PATCH_HOOK endef # +# Hook to patch common issue with configure on powerpc64{,le} failing +# to detect shared library support: +# +define CONFIGURE_FIX_POWERPC64_HOOK + @$(call MESSAGE,"Checking configure (powerpc64/powerpc64le)") + support/scripts/fix-configure-powerpc64.sh $($(PKG)_DIR) +endef + +# # Hook to gettextize the package if needed # define GETTEXTIZE_HOOK @@ -255,6 +264,13 @@ endif endif +# Append a configure hook if building for a powerpc64 (or powerpc64le) arch. +# Must be added after other pre-configure hooks that might regenerate the +# configure script and overwrite the changes made here. +ifneq ($$(filter powerpc64%,$$(if $$(filter target,$(4)),$$(ARCH),$$(HOSTARCH))),) +$(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_POWERPC64_HOOK +endif + # # Build step. Only define it if not already defined by the package .mk # file. diff --git a/support/scripts/fix-configure-powerpc64.sh b/support/scripts/fix-configure-powerpc64.sh new file mode 100755 index 0000000..ad71042 --- /dev/null +++ b/support/scripts/fix-configure-powerpc64.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# This is a script to find, and correct, a problem with old versions of +# configure that affect powerpc64 and powerpc64le. + +# The issue causes configure to incorrectly determine that shared library +# support is not present in the linker. This causes the package to build a +# static library rather than a dynamic one and although the build will succeed, +# it may cause packages that link with the static library it to fail due to +# undefined symbols. + +# This script searches for files named 'configure' that appear to have this +# issue (by searching for a known bad pattern) and patching them. + +set -e + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 2 +fi + +srcdir="$1" +files=$(cd "$srcdir" && find . -name configure \ +-exec grep -qF 'Generated by GNU Autoconf' {} \; \ +-exec grep -qF 'ppc*-*linux*|powerpc*-*linux*)' {} \; -print) + +# --ignore-whitespace is needed because some packages have included +# copies of configure scripts where tabs have been replaced with spaces. +for c in $files; do + patch --ignore-whitespace "$srcdir"/"$c" <<'EOF' +--- a/configure 2016-11-16 15:31:46.097447271 +1100 ++++ b/configure 2008-07-21 12:17:23.000000000 +1000 +@@ -4433,7 +4433,10 @@ + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; +- ppc*-*linux*|powerpc*-*linux*) ++ powerpcle-*linux*) ++ LD="${LD-ld} -m elf64lppc" ++ ;; ++ powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) +EOF +done +