From patchwork Wed Jan 20 19:11:31 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: 570878 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 581EA1402ED for ; Thu, 21 Jan 2016 06:13:11 +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=NMLQL06F; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A087D938E5; Wed, 20 Jan 2016 19:13:10 +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 hnmzguH3GsAy; Wed, 20 Jan 2016 19:13:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 41F78938BB; Wed, 20 Jan 2016 19:13:02 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 2B71F1C1F31 for ; Wed, 20 Jan 2016 19:13:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 256B493728 for ; Wed, 20 Jan 2016 19:13:00 +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 lCtjUP5KE4Fd for ; Wed, 20 Jan 2016 19:12:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id 8624893681 for ; Wed, 20 Jan 2016 19:12:58 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id u188so6105550wmu.0 for ; Wed, 20 Jan 2016 11:12:58 -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=ls2jekQUcaBx9+HvvaThBspbOo/g+plRF3Nel8Sv58Y=; b=NMLQL06FW0bUm3uD2HTAVnPmqu18mqzBg3zKoEsvD4C+ii8f7mjl3llvh9U9mTiRh7 NM9egam0RzXzXHAi+z9p3eB0hqnVTPK514Wx048qF1V+PhnCWSGQF2o0PGe0M9gNKBsK /gyRpEDTGHWfths9TXnXvDY5kKy/1Tb17WobDvQV1TN0+jGF7/toiTkvZlj1OhweIvt0 2lmSH/JKNs+hM2eLoP4vEiztxzJ5Wnb11hp2w/ai6lJVRzi1ERXt5NJZ20Lbp2a7Z+yE px/Vo3K59NPxJpq/3I36CeiIGmDgk57+B9zRCphw8m/EhQNCaoL9b6bTSsNalhtcjP79 ZEGQ== 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=ls2jekQUcaBx9+HvvaThBspbOo/g+plRF3Nel8Sv58Y=; b=a1KqUsQfUcHl/LsDf4byyUsDzCylzMhokR4sNlO+5NGzgU3xXqb24b7FdEkD9lnugT EAZzo1MYB4cBp0P7LBjfcZHbaxYmUgU4kSD6jn+jLJ3wgz+XGcrTTv2l1vNcNMlcNm9J yAU7Vg+0XJ/nPX2uTCgCtZJUfr8keQW5TzRqq0MqJY+Rq5W+r3r0tNbt4INuWWhcivVx 5tpPPpBPImFSkMYZYTwaRrKhLMq/2KLOQc4/Tpv+q4liawsXaGB9jaJX23aPow04ByQ2 fiKAlOcZT1ZqJqpuHUj5cjCI8za55iSjLv5MKhyNBhMwe1pygblvKd5lKDTPYX3Noosz 4Dfg== X-Gm-Message-State: AG10YOR+eumGEj9Gc62txEexScXMvWTzOk2THlxKDPEp0HFdY0W3jDr2v0fUOP8LlusvvA== X-Received: by 10.28.6.213 with SMTP id 204mr5728825wmg.47.1453317177027; Wed, 20 Jan 2016 11:12:57 -0800 (PST) Received: from localhost.localdomain (alc112.alcatel.be. [195.207.101.112]) by smtp.gmail.com with ESMTPSA id w8sm34492961wjx.21.2016.01.20.11.12.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jan 2016 11:12:55 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Wed, 20 Jan 2016 20:11:31 +0100 Message-Id: <1453317091-17676-4-git-send-email-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1453317091-17676-1-git-send-email-patrickdepinguin@gmail.com> References: <1453317091-17676-1-git-send-email-patrickdepinguin@gmail.com> Cc: Thomas Petazzoni , Thomas De Schampheleire , Romain Naour , "Yann E. Morin" Subject: [Buildroot] [PATCH v11 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 (usr/)ARCH_LIB_DIR does not exist yet. Signed-off-by: Thomas De Schampheleire Cc: Thomas Petazzoni Cc: Arnout Vandecappelle Cc: "Yann E. Morin" Cc: Romain Naour Cc: Peter Korsgaard --- v11: - check for existence of destination instead of explicitly checking on the known values lib/lib32/lib64. (ThomasP) 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. toolchain/toolchain-external/toolchain-external.mk | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index ddefd01..6383f8b 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 [ ! -f "$${DESTDIR}/$${ARCH_LIB_DIR}" -a ! -f "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ]; 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)