Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
  2010-04-06 22:47 [Buildroot] [PATCH] Fix external toolchain sysroot detection Yann E. MORIN
@ 2010-04-06 22:47 ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-04-06 22:47 UTC (permalink / raw)
  To: buildroot

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 |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index 80bdae6..b379095 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -205,14 +205,8 @@ 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::;'))
+$(info SYSROOT_DIR="$(SYROOT_DIR)")
 
 $(STAMP_DIR)/ext-toolchain-installed:
 	@echo "Checking external toolchain settings"

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] Fix external toolchain sysroot detection, take 2
@ 2010-04-06 22:50 Yann E. MORIN
  2010-04-06 22:50 ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2010-04-06 22:50 UTC (permalink / raw)
  To: buildroot

This patch should fix the case when the external toolchain was built
by buildroot. It also has the nice side-effect of being much more simpler.

This new iteration removes a debug mesage that was left-over...

---

Yann E. MORIN (1):
      toolchain: fix using external toolchains built with buildroot


 toolchain/external-toolchain/ext-tool.mk |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
  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
  2010-04-07  7:00   ` Thomas Petazzoni
  2010-04-07  7:51   ` Peter Korsgaard
  0 siblings, 2 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-04-06 22:50 UTC (permalink / raw)
  To: buildroot

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"

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
  2010-04-06 22:50 ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Yann E. MORIN
@ 2010-04-07  7:00   ` Thomas Petazzoni
  2010-04-07  7:51   ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2010-04-07  7:00 UTC (permalink / raw)
  To: buildroot

On Wed, 07 Apr 2010 00:50:10 +0200
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> wrote:

> 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).

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Peter: could you not merge this patch yet ? I'd like to carry this patch
in my codesourcery-toolchain-support branch, which I'll resubmit in the
next few days (after fixing a few minor issues discovered by Yann after
reviewing my patches) ? This would allow me to test the thing as a
whole, with CT-NG toolchains, Buildroot toolchains and CodeSourcery
toolchains.

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
  2010-04-06 22:50 ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Yann E. MORIN
  2010-04-07  7:00   ` Thomas Petazzoni
@ 2010-04-07  7:51   ` Peter Korsgaard
  2010-04-07 17:41     ` Yann E. MORIN
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2010-04-07  7:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@anciens.enib.fr> writes:

 Yann> From: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
 Yann> The toolchains built with buildroot use specially crafted paths for their
 Yann> sysroot and prefix. Fix that by asking gcc where it finds a file we
 Yann> know by relative path to the sysroot.

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

Committed, thanks all of you. Yann, don' forget to sign off on your
patches (-s option).

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot
  2010-04-07  7:51   ` Peter Korsgaard
@ 2010-04-07 17:41     ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-04-07 17:41 UTC (permalink / raw)
  To: buildroot

Peter, All,

On Wednesday 07 April 2010 09:51:13 Peter Korsgaard wrote:
> Yann, don' forget to sign off on your patches (-s option).

:-(
Sorry. Won't do again...

Thank you!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-07 17:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 22:50 [Buildroot] [PATCH] Fix external toolchain sysroot detection, take 2 Yann E. MORIN
2010-04-06 22:50 ` [Buildroot] [PATCH] toolchain: fix using external toolchains built with buildroot Yann E. MORIN
2010-04-07  7:00   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox