Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
Date: Wed, 07 Apr 2010 00:50:10 +0200	[thread overview]
Message-ID: <20100406225010.23853.36745.stgit@roazhon.bzh.lan> (raw)
In-Reply-To: <20100406224918.23853.83103.stgit@roazhon.bzh.lan>

From: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>

The toolchains built with buildroot use specially crafted paths for their
sysroot and prefix. Fix that by asking gcc where it finds a file we
know by relative path to the sysroot.

This has the side effect of greatly simplifying the sysroot detection
in every cases tested so far (BR toolchains, CT-NG toolchains, and
CodeSourcery toolchains).

Fixes bug #851.

Thanks Thomas Petazzoni for the hint and some testings.
Thanks Grant Edwards for the report and the comments.
---
 toolchain/external-toolchain/ext-tool.mk |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index 80bdae6..4493281 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -205,14 +205,7 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 EXTERNAL_LIBS+=libstdc++.so
 endif
 
-# This dance is needed because the toolchain may have been relocated, so the
-# configured paths may no longer match; fortunately, the sysroot moves along
-# the toolchain, so is always at the same place relative to the toolchain's
-# current location.
-CFG_PREFIX_DIR=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--prefix=" | cut -f2 -d=)
-CFG_SYSROOT_DIR=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--with-sysroot=" | cut -f2 -d=)
-REL_SYSROOT_DIR=$(shell echo "$(CFG_SYSROOT_DIR)" |sed -r -e 's:^$(CFG_PREFIX_DIR)::;')
-SYSROOT_DIR=$(TOOLCHAIN_EXTERNAL_PATH)/$(REL_SYSROOT_DIR)
+SYSROOT_DIR=$(shell readlink -f $$(LANG=C $(TARGET_CC) -print-file-name=libc.a |sed -r -e 's:usr/lib/libc\.a::;'))
 
 $(STAMP_DIR)/ext-toolchain-installed:
 	@echo "Checking external toolchain settings"

  reply	other threads:[~2010-04-06 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 22:50 [Buildroot] [PATCH] Fix external toolchain sysroot detection, take 2 Yann E. MORIN
2010-04-06 22:50 ` Yann E. MORIN [this message]
2010-04-07  7:00   ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Thomas Petazzoni
2010-04-07  7:51   ` Peter Korsgaard
2010-04-07 17:41     ` Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2010-04-06 22:47 [Buildroot] [PATCH] Fix external toolchain sysroot detection Yann E. MORIN
2010-04-06 22:47 ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100406225010.23853.36745.stgit@roazhon.bzh.lan \
    --to=yann.morin.1998@anciens.enib.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox