From patchwork Wed Jan 20 15:09:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 570742 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]) by ozlabs.org (Postfix) with ESMTP id 24E98140317 for ; Thu, 21 Jan 2016 02:11:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=yLi1CRJQ; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 11C5C9367B; Wed, 20 Jan 2016 15:11:16 +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 soc7D6MvyHCS; Wed, 20 Jan 2016 15:11:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 6296D9365C; Wed, 20 Jan 2016 15:11:14 +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 500661C1F5B for ; Wed, 20 Jan 2016 15:11:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4C66A32EAE for ; Wed, 20 Jan 2016 15:11:12 +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 5Rzei77LIEvT for ; Wed, 20 Jan 2016 15:11:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by silver.osuosl.org (Postfix) with ESMTPS id A242832E0C for ; Wed, 20 Jan 2016 15:11:10 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id b14so4784081wmb.1 for ; Wed, 20 Jan 2016 07:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uhbeLvr9AEUQrTKlx8paVzj0uxEflAMt89cYwyKs/J8=; b=yLi1CRJQxmqzTl5BIuFSDpgKRUNsMtUKx2fGw3VjiHRsw2nYK69GTSDGCsmD15QTZo c39Yvwf+MBt5dvzNZdgWoXuHGCzT3sCPnz91mIms69GCSWWeYugG6aupzQUiaqibHBcz DVma00tQ9/wa8nayY+4vu/y/sAP4P8DYwdxU+mAZ/lucjNyeTT8hSvG7DGMF3pIpKrS2 pmSK9DR/F50BUEyipVvzcxvVRtF77L4sTLFG1U6v+BJjMbBYJlIJ/5kCNwROGWMBQu3X SVXBobZWLeBJXkaupMu3Y3Fhv3I0aGbNsqi4og56/2sKcMMaZQtl0WT6rWt1RL9suLG7 w49Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uhbeLvr9AEUQrTKlx8paVzj0uxEflAMt89cYwyKs/J8=; b=l+eWdpapFPVEZwxOEf3jKMXy4w7mLbpBJX9mPMyV8i8aXn14IKL7TtaTIK52hBxe7Z obbbYTPJuAe09kz321hpd6fVUTKTeiHGNvXBvbRGqGjHn1VQ2Gc0n77XnJCa+SHxkMAA wrxztQRTQj6yBbDdwdfZzodVudosf06WkCE25L4n6u9uvlMF6upC2kFMz1aJOr1DOkWp wUwGEJEJc1xS2bj92H6qDPV0qKDSzcm2g6Z8UYRRKSPLPn/kFhLCDZTHAibSr2yD25NU ow3NAqf+dmNO3NxoxvBMSkJndsHJVKu23W+uiXQCruu9pj/JEgJOSP/O2WqHZ1ek0nZ1 OZZA== X-Gm-Message-State: ALoCoQkgkH6dpV1MEPV6OZ5IXwYyb53qJaUAPbye6N3emisXStJsUptKTTCXmFqMWY7/S9hh6ajTkBWBPTRQAjvARVAf+8ca1Q== X-Received: by 10.194.47.231 with SMTP id g7mr36923446wjn.42.1453302669232; Wed, 20 Jan 2016 07:11:09 -0800 (PST) Received: from localhost.localdomain (alc112.alcatel.be. [195.207.101.112]) by smtp.gmail.com with ESMTPSA id lx4sm33657855wjb.5.2016.01.20.07.11.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jan 2016 07:11:07 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Wed, 20 Jan 2016 16:09:07 +0100 Message-Id: <1453302547-24314-4-git-send-email-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1453302547-24314-1-git-send-email-patrickdepinguin@gmail.com> References: <1453302547-24314-1-git-send-email-patrickdepinguin@gmail.com> Cc: Thomas Petazzoni , Thomas De Schampheleire , Romain Naour , "Yann E. Morin" Subject: [Buildroot] [PATCH v10 4/4] toolchain-external: create symlink ARCH_LIB_DIR->lib 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" From: Thomas De Schampheleire Currently, following symbolic links are created in both target and staging directories: - lib(32|64) --> lib - usr/lib(32|64) --> lib The decision for lib32 or lib64 is based on the target architecture configuration in buildroot (BR2_ARCH_IS_64). In at least one case this is not correct: when building for a Cavium Octeon III processor using the toolchain from the Cavium Networks SDK, and specifying -march=octeon3 in BR2_TARGET_OPTIMIZATION, libraries are expected in directory 'lib32-fp' rather than 'lib32' (ABI=n32; likewise for lib64-fp in case of ABI=n64) More generally the correct symbolic link is from (usr/)${ARCH_LIB_DIR}->lib. However, feedback from Arnout Vandecappelle is that there are packages that do depend on the lib32/lib64 symlink, even if ARCH_LIB_DIR is different. Hence, these links must be kept. Fix the problem as follows: - For internal toolchains: no change - For external toolchains: create a symlink ARCH_LIB_DIR->lib if ARCH_LIB_DIR is different from lib/lib32/lib64. Signed-off-by: Thomas De Schampheleire Cc: Thomas Petazzoni Cc: Arnout Vandecappelle Cc: "Yann E. Morin" Cc: Romain Naour Cc: Peter Korsgaard --- toolchain/toolchain-external/toolchain-external.mk | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) v10: - simplify after realization that skeleton symlink creation can be kept (thanks Thomas Petazzoni for noticing this) v9: - remove redundant mkdir's (handled by skeleton) (Yann) v8: - use helper only for external toolchain and incorporate ARCH_LIB_DIR definition (Arnout) - keep lib32/lib64->lib symlink anyway v7: rebase v6: rebase only v5: - move internal toolchain logic into gcc-initial.mk - also silence the internal toolchain link steps with $(Q) v4: - merge both helpers into one - remove the separate target for the internal toolchain and hook into gcc-initial - re-add deleted comment about MIPS64/n32 v3: - update commit message wrapping - change dependency on $(BUILD_DIR) to a order-only dependency v2: - fix 'lib32-fp' leftover in toolchain-buildroot - silence commands creating symlink with $(Q) - fix case where ARCH_LIB_DIR is 'lib' Note: in output/staging/usr/ there would still be more directories than I think are really necessary. This behavior is not changed by this patch, it was already present before. For example, with the mentioned Octeon III toolchain, output/staging/usr/ contains: bin bin32 bin32-fp bin64-fp, lib lib32 lib32-fp lib64-fp libexec libexec32 libexec32-fp libexec64-fp sbin sbin32 sbin32-fp sbin64-fp where bin/lib/libexec/sbin seem to be the 64-bit equivalents of bin32/lib32/libexec32/sbin32. This is related to the behavior of copy_toolchain_sysroot in toolchain/helpers.mk. It already attempts to filter out the unnecessary lib* directories, but does not care about any bin/sbin/libexec directories. As this poses no known problem and is not impacted by this patch, I make no attempt to change it. diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index ddefd01..10f1edc 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -517,6 +517,27 @@ endef TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK endif +# Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. +# Note: the skeleton package additionally creates lib32->lib or lib64->lib +# (as appropriate) +# +# $1: destination directory (TARGET_DIR / STAGING_DIR) +create_lib_symlinks = \ + $(Q)DESTDIR="$(strip $1)" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + if [ "$${ARCH_LIB_DIR}" != "lib" -a "$${ARCH_LIB_DIR}" != "$(SKELETON_LIB_SYMLINK)" ]; then \ + ln -snf lib "$${DESTDIR}/$${ARCH_LIB_DIR}" ; \ + ln -snf lib "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ; \ + fi + +define TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK + $(call create_lib_symlinks,$(STAGING_DIR)) +endef + +define TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK + $(call create_lib_symlinks,$(TARGET_DIR)) +endef + # Integration of the toolchain into Buildroot: find the main sysroot # and the variant-specific sysroot, then copy the needed libraries to # the $(TARGET_DIR) and copy the whole sysroot (libraries and headers) @@ -732,6 +753,7 @@ endef TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER) define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS + $(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) @@ -741,6 +763,7 @@ endef # and the target directory, we do everything within the # install-staging step, arbitrarily. define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS + $(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)