From patchwork Sun Jul 13 18:45:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 369434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 0BEA114010B for ; Mon, 14 Jul 2014 04:46:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 859E18911E; Sun, 13 Jul 2014 18:46:32 +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 70c1G1cYLzXP; Sun, 13 Jul 2014 18:46:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E6FD3890C0; Sun, 13 Jul 2014 18:46:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 3EF371BFA51 for ; Sun, 13 Jul 2014 18:46:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3961E890C0 for ; Sun, 13 Jul 2014 18:46:30 +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 M-yuhnH6tYaD for ; Sun, 13 Jul 2014 18:46:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E8AB889091 for ; Sun, 13 Jul 2014 18:46:28 +0000 (UTC) Received: from localhost.localdomain (unknown [81.57.22.125]) by smtp1-g21.free.fr (Postfix) with ESMTP id 2DC12940172; Sun, 13 Jul 2014 20:46:26 +0200 (CEST) From: Romain Naour To: buildroot@buildroot.net Date: Sun, 13 Jul 2014 20:45:58 +0200 Message-Id: <1405277160-4686-2-git-send-email-romain.naour@openwide.fr> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405277160-4686-1-git-send-email-romain.naour@openwide.fr> References: <1405277160-4686-1-git-send-email-romain.naour@openwide.fr> Subject: [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net With the Sourcery Codebench standard edition, the sysroot returned point to a non existant directory if no CFLAGS are specified. Here are the results of -print-sysroot gcc option: $ ./i686-pc-linux-gnu-gcc -print-sysroot Full/path/to/i686-pc-linux-gnu/libc/system32 $ ./i686-pc-linux-gnu-gcc -m64 -print-sysroot Full/path/to/i686-pc-linux-gnu/libc/system64 $ ./i686-pc-linux-gnu-gcc -msgxx-glibc -print-sysroot Full/path/to/i686-pc-linux-gnu/libc/sgxx-glibc The problem is that in the "libc" directory there is only the sub-directory "sgxx-glibc". Note: All hearders files and libraries are available in arch specific sysroot. When using the -print-file-name gcc option, the result is quite buggy and it is not empty. $ ./i686-pc-linux-gnu-gcc -print-file-name=libc.a libc.a So the toolchain check fail because $PWD/libc.a is used as SYSROOT_DIR since the toolchain-external backend does not always use CFLAGS. Add a test to use ARCH_SYSROOT_DIR for kernel headers check if SYSROOT_DIR is not a directory. Signed-off-by: Romain Naour --- toolchain/toolchain-external/toolchain-external.mk | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index 0955686..8280b84 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -454,9 +454,16 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ exit 1 ; \ fi ; \ - $(call check_kernel_headers_version,\ - $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\ - $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ + ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + if test -d "$${SYSROOT_DIR}" ; then \ + $(call check_kernel_headers_version,\ + "$${SYSROOT_DIR}",\ + $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ + else \ + $(call check_kernel_headers_version,\ + "$${ARCH_SYSROOT_DIR}",\ + $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ + fi ; \ if test "$(BR2_arm)" = "y" ; then \ $(call check_arm_abi,\ "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\