Skip to contentSkip to conversation

Fix external toolchain sysroot detection, take 2

PATCH New Yann E. MORIN 3 participants 5 messages Apr 6, 2010 – Apr 7, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix external toolchain sysroot detection, take 2

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 · 1 line
Signature
#1 lore raw

PATCH 1/1 toolchain: fix using external toolchains built with buildroot

From: Yann E. MORIN <[email protected]>

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(-)
toolchain/external-toolchain/ext-tool.mk +1 -8
index 80bdae6..4493281 100644
@@ -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"
#2 lore raw

PATCH 1/1 toolchain: fix using external toolchains built with buildroot

Quoted 7 lines · On Wed, 07 Apr 2010 00:50:10 +0200 "Yann E. MORIN"…

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

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH 1/1 toolchain: fix using external toolchains built with buildroot

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> From: Yann E. MORIN <[email protected]>
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).

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 toolchain: fix using external toolchains built with buildroot

Peter, All,

Quoted 1 line · 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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'