Skip to contentSkip to conversation

Pull request for branch ext-toolchain-fixes

GIT PULL New Thomas Petazzoni 3 participants 18 messages Jul 5, 2010 – Jul 6, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

Here is a new version of my ext-toolchain-fixes branch, which fixes the problem noted by Peter on the sysroot detection code.

We switch to --sysroot=/path/to instead of --sysroot /path/to, which eases the filtering of this option, which is needed to find out the original location of the toolchain sysroot.

Thanks,

Thomas

The following changes since commit f4abd4e61215b119d38ccba011a901732ce704e4:
Peter Huewe (1):
docs: Fixed spelling error in buildroot.html GETTEXT instead of GNUTTEXT

are available in the git repository at:

git://git.busybox.net/~tpetazzoni/git/buildroot ext-toolchain-fixes

Thomas Petazzoni (10):
ext-toolchains: take into account other Glibc dynamic loader variants
ext-toolchain: Fix ARCH_SYSROOT detection
external-toolchain: only copy existing directories of the sysroot
external-toolchain: support 64 bits glibc toolchains
external-toolchain: create lib64 symlinks if needed
external-toolchain: mention MIPS and PowerPC CodeSourcery toolchains
external-toolchain: recognize uClibc 64 bits toolchains
uclibc: add patch to fix fcntl64() on 64 bits targets
external-toolchain: handle libstdc++/libgcc_s for BR toolchains
external-toolchain: hardcode the destination directory for a library

 package/Makefile.in                                |    4 +-
 toolchain/external-toolchain/ext-tool.mk           |   92 +++++++++++++-------
 ...ibc-0.9.31-fix-fcntl64-for-64-bit-targets.patch |   34 +++++++
 3 files changed, 98 insertions(+), 32 deletions(-)
 create mode 100644 toolchain/uClibc/uClibc-0.9.31-fix-fcntl64-for-64-bit-targets.patch

Thanks,

Signature · 1 line
Thomas Petazzoni
#1 lore raw

PATCH 1/10 ext-toolchains: take into account other Glibc dynamic loader variants

External toolchains using Glibc have different names for the dynamic loader. Some of them name it ld-linux.so.*, while some others (such as the PowerPC and MIPS CodeSourcery toolchains) name it simply ld.so.*.

Therefore, we fix the glibc detection code to handle this case.

---
 toolchain/external-toolchain/ext-tool.mk |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
toolchain/external-toolchain/ext-tool.mk +4 -6
index 8daae15..3943ceb 100644
@@ -155,7 +155,7 @@ check_glibc_feature = \
 #
 check_glibc = \
 	SYSROOT_DIR="$(strip $1)"; \
-	if ! test -f $${SYSROOT_DIR}/lib/ld-linux.so.* ; then \
+	if ! test -f $${SYSROOT_DIR}/lib/ld-linux.so.* -o -f $${SYSROOT_DIR}/lib/ld.so.* ; then \
 		echo "Incorrect selection of the C library"; \
 		exit -1; \
 	fi; \
@@ -251,11 +251,9 @@ check_cross_compiler_exists = \
 
 uclibc: dependencies $(STAMP_DIR)/ext-toolchain-installed
 
-EXTERNAL_LIBS=libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
-EXTERNAL_LIBS+=ld-uClibc.so
-else
-EXTERNAL_LIBS+=ld-linux.so libnss_files.so libnss_dns.so
+EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GCLIBC),y)
+EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
 endif
 
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 2/10 ext-toolchain: Fix ARCH_SYSROOT detection

In reply to Thomas Petazzoni

For the detection of the ARCH_SYSROOT_DIR (which contains the C library variant specific to the compiler flags), we used to pass only the -march argument instead of the full TARGET_CFLAGS. This was done because TARGET_CFLAGS contains --sysroot, and we don't want to tell here the compiler which sysroot to use, because we're specifically asking the compiler where the *normal* arch sysroot directory is.

Unfortunately, there are some multilib variants that aren't decided only based on -march, but also on -msoft-float or other compiler flags. Therefore, we take the opposite approach: pass the full TARGET_CFLAGS, from which we have stripped the --sysroot option.

For example, this allows a PowerPC CodeSourcery toolchain, on which we're using the soft-float multilib variant, to work properly as an external toolchain.

---
 package/Makefile.in                      |    4 ++--
 toolchain/external-toolchain/ext-tool.mk |   18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)
package/Makefile.in +2 -2
index 92b5710..5147dc8 100644
@@ -88,9 +88,9 @@ TARGET_LDFLAGS+= $(BR2_SYSROOT)
 
 #########################################################################
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
-TARGET_CFLAGS+=--sysroot $(STAGING_DIR)/
+TARGET_CFLAGS+=--sysroot=$(STAGING_DIR)/
 TARGET_CXXFLAGS=$(TARGET_CFLAGS)
-TARGET_LDFLAGS=--sysroot $(STAGING_DIR)/
+TARGET_LDFLAGS=--sysroot=$(STAGING_DIR)/
 TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
 endif
 #########################################################################
toolchain/external-toolchain/ext-tool.mk +9 -9
index 3943ceb..b1eee23 100644
@@ -270,9 +270,10 @@ endif # ! no threads
 # SYSROOT_DIR selection. We first try the -print-sysroot option,
 # available in gcc 4.4.x and in some Codesourcery toolchains. If this
 # option is not available, we fallback to the value of --with-sysroot
-# as visible in CROSS-gcc -v. We don't pass the -march= option to gcc
-# as we want the "main" sysroot, which contains all variants of the C
-# library in the case of multilib toolchains.
+# as visible in CROSS-gcc -v. We don't pass any option to gcc that
+# could select a multilib variant as we want the "main" sysroot, which
+# contains all variants of the C library in the case of multilib
+# toolchains.
 SYSROOT_DIR=$(shell $(TARGET_CC) -print-sysroot 2>/dev/null)
 ifeq ($(SYSROOT_DIR),)
 SYSROOT_DIR=$(shell readlink -f $$(LANG=C $(TARGET_CC) -print-file-name=libc.a |sed -r -e 's:usr/lib/libc\.a::;'))
@@ -281,15 +282,14 @@ endif
 # Now, find if the toolchain specifies a sub-directory for the
 # specific architecture variant we're interested in. This is the case
 # with multilib toolchain, when the selected architecture variant is
-# not the default one. To do so, we ask the compiler by passing the
-# appropriate -march= flags. ARCH_SUBDIR will contain the
+# not the default one. To do so, we ask the compiler by passing all
+# flags, except the --sysroot flag since we want to the compiler to
+# tell us where its original sysroot is. ARCH_SUBDIR will contain the
 # subdirectory, in the main SYSROOT_DIR, that corresponds to the
 # selected architecture variant. ARCH_SYSROOT_DIR will contain the
 # full path to this location.
-ifneq ($(CC_TARGET_ARCH_),)
-TARGET_CC_ARCH_CFLAGS+=-march=$(CC_TARGET_ARCH_)
-endif
-ARCH_SUBDIR=$(shell $(TARGET_CC) $(TARGET_CC_ARCH_CFLAGS) -print-multi-directory)
+TARGET_CFLAGS_NO_SYSROOT=$(filter-out --sysroot=%,$(TARGET_CFLAGS))
+ARCH_SUBDIR=$(shell $(TARGET_CC) $(TARGET_CFLAGS_NO_SYSROOT) -print-multi-directory)
 ARCH_SYSROOT_DIR=$(SYSROOT_DIR)/$(ARCH_SUBDIR)
 
 $(STAMP_DIR)/ext-toolchain-installed:
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 3/10 external-toolchain: only copy existing directories of the sysroot

In reply to Thomas Petazzoni

Instead of copying all directories in "etc lib sbin usr", check that each of them exists before doing the copy. This is only to avoid an harmless error message.

---
 toolchain/external-toolchain/ext-tool.mk |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +3 -1
index b1eee23..9c1ec8f 100644
@@ -120,7 +120,9 @@ copy_toolchain_sysroot = \
 	ARCH_SYSROOT_DIR="$(strip $2)"; \
 	ARCH_SUBDIR="$(strip $3)"; \
 	for i in etc lib sbin usr ; do \
-		cp -a $${ARCH_SYSROOT_DIR}/$$i $(STAGING_DIR)/ ; \
+		if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \
+			cp -a $${ARCH_SYSROOT_DIR}/$$i $(STAGING_DIR)/ ; \
+		fi ; \
 	done ; \
 	if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
 		if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 4/10 external-toolchain: support 64 bits glibc toolchains

In reply to Thomas Petazzoni

On 64 bits glibc toolchains, the dynamic loader is named ld-linux-x86-64.so and not simply ld-linux.so. So, adjust the detection of the C library accordingly.

---
 toolchain/external-toolchain/ext-tool.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +1 -1
index 9c1ec8f..a181f25 100644
@@ -157,7 +157,7 @@ check_glibc_feature = \
 #
 check_glibc = \
 	SYSROOT_DIR="$(strip $1)"; \
-	if ! test -f $${SYSROOT_DIR}/lib/ld-linux.so.* -o -f $${SYSROOT_DIR}/lib/ld.so.* ; then \
+	if ! test -f $${SYSROOT_DIR}/lib/ld-linux*.so.* -o -f $${SYSROOT_DIR}/lib/ld.so.* ; then \
 		echo "Incorrect selection of the C library"; \
 		exit -1; \
 	fi; \
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 5/10 external-toolchain: create lib64 symlinks if needed

In reply to Thomas Petazzoni

Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the target and staging directories. This is needed for some 64 bits toolchains such as the Crosstool-NG toolchains, for which the path to the dynamic loader and other libraries is /lib64, but the libraries are stored in /lib.

---
 toolchain/external-toolchain/ext-tool.mk |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
toolchain/external-toolchain/ext-tool.mk +17 -0
index a181f25..d5a64b5 100644
@@ -133,6 +133,19 @@ copy_toolchain_sysroot = \
 	find $(STAGING_DIR) -type d | xargs chmod 755
 
 #
+# Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the
+# target and staging directories. This is needed for some 64 bits
+# toolchains such as the Crosstool-NG toolchains, for which the path
+# to the dynamic loader and other libraries is /lib64, but the
+# libraries are stored in /lib.
+#
+create_lib64_symlinks = \
+	(cd $(TARGET_DIR) ;      ln -s lib lib64) ; \
+	(cd $(TARGET_DIR)/usr ;  ln -s lib lib64) ; \
+	(cd $(STAGING_DIR) ;     ln -s lib lib64) ; \
+	(cd $(STAGING_DIR)/usr ; ln -s lib lib64)
+
+#
 # Check the availability of a particular glibc feature. We assume that
 # all Buildroot toolchain options are supported by glibc, so we just
 # check that they are enabled.
@@ -319,4 +332,8 @@ endif
 	done
 	@echo "Copy external toolchain sysroot to staging..."
 	$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR),$(ARCH_SYSROOT_DIR),$(ARCH_SUBDIR))
+	# Create lib64 symbolic links if needed
+	$(Q)if [ -L $(ARCH_SYSROOT_DIR)/lib64 ] ; then \
+		$(call create_lib64_symlinks) ; \
+	fi
 	@touch $@
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH 6/10 external-toolchain: mention MIPS and PowerPC CodeSourcery toolchains

In reply to Thomas Petazzoni
---
 toolchain/external-toolchain/ext-tool.mk |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +3 -1
index d5a64b5..d591781 100644
@@ -7,7 +7,9 @@
 #
 #  * Toolchains generated by Crosstool-NG
 #  * Toolchains generated by Buildroot
-#  * ARM toolchains made available by Codesourcery
+#  * ARM, MIPS and PowerPC toolchains made available by
+#    Codesourcery. For the MIPS toolchain, the -muclibc variant isn't
+#    supported yet, only the default glibc-based variant is.
 #
 # The basic principle is the following
 #
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH 7/10 external-toolchain: recognize uClibc 64 bits toolchains

In reply to Thomas Petazzoni

With uClibc 64 bits toolchain, the dynamic loader is named ld64-uClibc.so.0 and not ld-uClibc.so.0. So, this commit adjust the uClibc detection code for external toolchains.

---
 toolchain/external-toolchain/ext-tool.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +1 -1
index d591781..3996184 100644
@@ -216,7 +216,7 @@ check_uclibc_feature = \
 #
 check_uclibc = \
 	SYSROOT_DIR="$(strip $1)"; \
-	if ! test -f $${SYSROOT_DIR}/lib/ld-uClibc.so.* ; then \
+	if ! test -f $${SYSROOT_DIR}/lib/ld*-uClibc.so.* ; then \
 		echo "Incorrect selection of the C library"; \
 		exit -1; \
 	fi; \
Signature · 1 line
1.7.0.4
#14 lore raw

PATCH 8/10 uclibc: add patch to fix fcntl64() on 64 bits targets

In reply to Thomas Petazzoni

The patch is already in upstream uClibc, in the master branch, at
http://git.buildroot.net/uClibc/commit/?id=6f1daaaf2d94c1e6184add44eda38b0781b88cf0.

---
 ...ibc-0.9.31-fix-fcntl64-for-64-bit-targets.patch |   34 ++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 toolchain/uClibc/uClibc-0.9.31-fix-fcntl64-for-64-bit-targets.patch
toolchain/uClibc/uClibc-0.9.31-fix-fcntl64-for-64-bit-targets.patch new file +34 -0
new file mode 100644
index 0000000..763bfd3
@@ -0,0 +1,34 @@
+From 6f1daaaf2d94c1e6184add44eda38b0781b88cf0 Mon Sep 17 00:00:00 2001
+From: Rob Landley <[email protected]>
+Date: Sun, 16 May 2010 21:41:36 +0000
+Subject: Fix fcntl64 for 64 bit targets.
+
+64 bit targets often don't have a separate fcntl64() system call, because they don't need one.
+
+Signed-off-by: Rob Landley <[email protected]>
+Signed-off-by: Austin Foxley <[email protected]>
+---
+diff --git a/include/fcntl.h b/include/fcntl.h
+index e37073f..3cfb25f 100644
+--- a/include/fcntl.h
++++ b/include/fcntl.h
+@@ -73,7 +73,7 @@ __BEGIN_DECLS
+ 
+    This function is a cancellation point and therefore not marked with
+    __THROW.  */
+-#ifndef __USE_FILE_OFFSET64
++#if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
+ extern int fcntl (int __fd, int __cmd, ...);
+ libc_hidden_proto(fcntl)
+ #else
+@@ -83,7 +83,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
+ #  define fcntl fcntl64
+ # endif
+ #endif
+-#ifdef __USE_LARGEFILE64
++#if defined(__USE_LARGEFILE64) && !defined(__LP64__)
+ extern int fcntl64 (int __fd, int __cmd, ...);
+ libc_hidden_proto(fcntl64)
+ #endif
+--
+cgit v0.8.2.1
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH 9/10 external-toolchain: handle libstdc++/libgcc_s for BR toolchains

In reply to Thomas Petazzoni

Most toolchains have their libraries either in /lib or /usr/lib relative to their ARCH_SYSROOT_DIR. Buildroot toolchains, however, have basic libraries in /lib, and libstdc++/libgcc_s in /usr/<target-name>/lib(64).

---
 toolchain/external-toolchain/ext-tool.mk |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +10 -1
index 3996184..1c84893 100644
@@ -42,6 +42,11 @@
 # directory to the target directory. Also optionaly strips the
 # library.
 #
+# Most toolchains have their libraries either in /lib or /usr/lib
+# relative to their ARCH_SYSROOT_DIR. Buildroot toolchains, however,
+# have basic libraries in /lib, and libstdc++/libgcc_s in
+# /usr/<target-name>/lib(64).
+#
 # $1: arch specific sysroot directory
 # $2: library name
 # $3: destination directory
@@ -52,7 +57,11 @@ copy_toolchain_lib_root = \
 	LIB="$(strip $2)"; \
 	STRIP="$(strip $4)"; \
  \
-	LIBS=`(cd $${ARCH_SYSROOT_DIR}; find . -path "./lib/$${LIB}.*" -o -path "./usr/lib/$${LIB}.*")` ; \
+	LIBS=`(cd $${ARCH_SYSROOT_DIR}; \
+		find -L . -path "./lib/$${LIB}.*"     -o \
+			  -path "./usr/lib/$${LIB}.*" -o \
+			  -path "./usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*/$${LIB}.*" \
+		)` ; \
 	for FILE in $${LIBS} ; do \
 		LIB=`basename $${FILE}`; \
 		LIBDIR=`dirname $${FILE}` ; \
Signature · 1 line
1.7.0.4
#16 lore raw

PATCH 10/10 external-toolchain: hardcode the destination directory for a library

In reply to Thomas Petazzoni

Until now, the function copy_toolchain_lib_root was copying a given library to the target filesystem by assuming that it should be at the same place it was in the toolchain sysroot.

However, with Buildroot hiding libstdc++ in /usr/<target-name>/lib(64), this isn't correct, and it is probably safer not to rely on the toolchain organization anyway.

Therefore :

* Instead of having a single EXTERNAL_LIBS variable, we now have LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS, which respectively list the libraries that should be copied to /lib and /usr/lib. As of today, only libstdc++ is part of the second list.

* The copy_toolchain_lib_root takes another argument, which is the destination directory of the library, relative to $(TARGET_DIR)

---
 toolchain/external-toolchain/ext-tool.mk |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
toolchain/external-toolchain/ext-tool.mk +17 -13
index 1c84893..7ca138b 100644
@@ -49,12 +49,13 @@
 #
 # $1: arch specific sysroot directory
 # $2: library name
-# $3: destination directory
+# $3: destination directory of the libary, relative to $(TARGET_DIR)
 # $4: strip (y|n), default is to strip
 #
 copy_toolchain_lib_root = \
 	ARCH_SYSROOT_DIR="$(strip $1)"; \
 	LIB="$(strip $2)"; \
+	DESTDIR="$(strip $3)" ; \
 	STRIP="$(strip $4)"; \
  \
 	LIBS=`(cd $${ARCH_SYSROOT_DIR}; \
@@ -67,17 +68,17 @@ copy_toolchain_lib_root = \
 		LIBDIR=`dirname $${FILE}` ; \
 		while test \! -z "$${LIB}"; do \
 			FULLPATH="$${ARCH_SYSROOT_DIR}/$${LIBDIR}/$${LIB}" ; \
-			rm -fr $(TARGET_DIR)/$${LIBDIR}/$${LIB}; \
-			mkdir -p $(TARGET_DIR)/$${LIBDIR}; \
+			rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
+			mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
 			if test -h $${FULLPATH} ; then \
-				cp -d $${FULLPATH} $(TARGET_DIR)/$${LIBDIR}/; \
+				cp -d $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/; \
 			elif test -f $${FULLPATH}; then \
-				$(INSTALL) -D -m0755 $${FULLPATH} $(TARGET_DIR)/$${LIBDIR}/$${LIB}; \
+				$(INSTALL) -D -m0755 $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
 				case "$${STRIP}" in \
 				(0 | n | no) \
 ;; \
 				(*) \
-					$(TARGET_CROSS)strip "$(TARGET_DIR)/$${LIBDIR}/$${LIB}"; \
+					$(TARGET_CROSS)strip "$(TARGET_DIR)/$${DESTDIR}/$${LIB}"; \
 ;; \
 				esac; \
 			else \
@@ -277,19 +278,19 @@ check_cross_compiler_exists = \
 
 uclibc: dependencies $(STAMP_DIR)/ext-toolchain-installed
 
-EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
+LIB_EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GCLIBC),y)
-EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
+LIB_EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
 endif
 
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
-EXTERNAL_LIBS+=libstdc++.so
+USR_LIB_EXTERNAL_LIBS+=libstdc++.so
 endif
 
 ifneq ($(BR2_PTHREADS_NONE),y)
-EXTERNAL_LIBS+=libpthread.so
+LIB_EXTERNAL_LIBS+=libpthread.so
 ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
-EXTERNAL_LIBS+=libthread_db.so
+LIB_EXTERNAL_LIBS+=libthread_db.so
 endif # gdbserver
 endif # ! no threads
 
@@ -338,8 +339,11 @@ else
 endif
 	mkdir -p $(TARGET_DIR)/lib
 	@echo "Copy external toolchain libraries to target..."
-	$(Q)for libs in $(EXTERNAL_LIBS); do \
-		$(call copy_toolchain_lib_root,$(ARCH_SYSROOT_DIR),$$libs,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
+	$(Q)for libs in $(LIB_EXTERNAL_LIBS); do \
+		$(call copy_toolchain_lib_root,$(ARCH_SYSROOT_DIR),$$libs,/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
+	done
+	$(Q)for libs in $(USR_LIB_EXTERNAL_LIBS); do \
+		$(call copy_toolchain_lib_root,$(ARCH_SYSROOT_DIR),$$libs,/usr/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
 	done
 	@echo "Copy external toolchain sysroot to staging..."
 	$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR),$(ARCH_SYSROOT_DIR),$(ARCH_SUBDIR))
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH 7/10 external-toolchain: recognize uClibc 64 bits toolchains

In reply to Thomas Petazzoni
Quoted 6 lines · On Monday 05 July 2010 18:59:00 Thomas Petazzoni wrote:

With uClibc 64 bits toolchain, the dynamic loader is named ld64-uClibc.so.0 and not ld-uClibc.so.0. So, this commit adjust the uClibc detection code for external toolchains.

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.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/10 ext-toolchains: take into account other Glibc dynamic loader variants

In reply to Thomas Petazzoni
Quoted 7 lines · On Monday 05 July 2010 18:58:54 Thomas Petazzoni wrote:

External toolchains using Glibc have different names for the dynamic loader. Some of them name it ld-linux.so.*, while some others (such as the PowerPC and MIPS CodeSourcery toolchains) name it simply ld.so.*.

Therefore, we fix the glibc detection code to handle this case.

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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 2/10 ext-toolchain: Fix ARCH_SYSROOT detection

In reply to Thomas Petazzoni
Quoted 12 lines · On Monday 05 July 2010 18:58:55 Thomas Petazzoni wrote:

For the detection of the ARCH_SYSROOT_DIR (which contains the C library variant specific to the compiler flags), we used to pass only the -march argument instead of the full TARGET_CFLAGS. This was done because TARGET_CFLAGS contains --sysroot, and we don't want to tell here the compiler which sysroot to use, because we're specifically asking the compiler where the *normal* arch sysroot directory is.

Unfortunately, there are some multilib variants that aren't decided only based on -march, but also on -msoft-float or other compiler flags. Therefore, we take the opposite approach: pass the full TARGET_CFLAGS, from which we have stripped the --sysroot option.

Quoted 5 lines

For example, this allows a PowerPC CodeSourcery toolchain, on which we're using the soft-float multilib variant, to work properly as an external toolchain.

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.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 3/10 external-toolchain: only copy existing directories of the sysroot

In reply to Thomas Petazzoni
Quoted 5 lines · On Monday 05 July 2010 18:58:56 Thomas Petazzoni wrote:

Instead of copying all directories in "etc lib sbin usr", check that each of them exists before doing the copy. This is only to avoid an harmless error message.

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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 4/10 external-toolchain: support 64 bits glibc toolchains

In reply to Thomas Petazzoni
Quoted 5 lines · On Monday 05 July 2010 18:58:57 Thomas Petazzoni wrote:

On 64 bits glibc toolchains, the dynamic loader is named ld-linux-x86-64.so and not simply ld-linux.so. So, adjust the detection of the C library accordingly.

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.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

PATCH 5/10 external-toolchain: create lib64 symlinks if needed

In reply to Thomas Petazzoni
Quoted 21 lines · On Monday 05 July 2010 18:58:58 Thomas Petazzoni wrote:

Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the target and staging directories. This is needed for some 64 bits toolchains such as the Crosstool-NG toolchains, for which the path to the dynamic loader and other libraries is /lib64, but the libraries are stored in /lib.

---
 toolchain/external-toolchain/ext-tool.mk |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
toolchain/external-toolchain/ext-tool.mk +2 -0
index a181f25..d5a64b5 100644
@@ -133,6 +133,19 @@ copy_toolchain_sysroot = \
 	find $(STAGING_DIR) -type d | xargs chmod 755
 
 #
+# Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the
+# target and staging directories. This is needed for some 64 bits

toolchain/external-toolchain/ext-tool.mk copy_toolchain_sysroot = \ · line 147

Quoted 10 lines
toolchain/external-toolchain/ext-tool.mk +10 -0
+# toolchains such as the Crosstool-NG toolchains, for which the path
+# to the dynamic loader and other libraries is /lib64, but the
+# libraries are stored in /lib.
+#
+create_lib64_symlinks = \
+	(cd $(TARGET_DIR) ;      ln -s lib lib64) ; \
+	(cd $(TARGET_DIR)/usr ;  ln -s lib lib64) ; \
+	(cd $(STAGING_DIR) ;     ln -s lib lib64) ; \
+	(cd $(STAGING_DIR)/usr ; ln -s lib lib64)
+

Maybe it's too late, but what if some of the lib64 directories really *are* directories? It would be better to make the symlinks conditionnal to whether the destination exists or not.

toolchain/external-toolchain/ext-tool.mk endif · line 339

Quoted 13 lines
toolchain/external-toolchain/ext-tool.mk +5 -0
+#
 # Check the availability of a particular glibc feature. We assume that
 # all Buildroot toolchain options are supported by glibc, so we just
 # check that they are enabled.
@@ -319,4 +332,8 @@ endif
 	done
 	@echo "Copy external toolchain sysroot to staging..."
 	$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR),$(ARCH_SYSROOT_DIR),$(ARCH_SUBDIR))
+	# Create lib64 symbolic links if needed
+	$(Q)if [ -L $(ARCH_SYSROOT_DIR)/lib64 ] ; then \
+		$(call create_lib64_symlinks) ; \
+	fi
 	@touch $@

If this is to fix crosstool-NG toolchains only, then the lib64 directories *will* be symlinks everywhere... So:

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.  |
'------------------------------^-------^------------------^--------------------'
#17 lore raw
In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Hello,
Thomas> Here is a new version of my ext-toolchain-fixes branch, which fixes Thomas> the problem noted by Peter on the sysroot detection code.

Thomas> We switch to --sysroot=/path/to instead of --sysroot /path/to, which Thomas> eases the filtering of this option, which is needed to find out the Thomas> original location of the toolchain sysroot.

Committed, thanks!

Signature · 1 line
Bye, Peter Korsgaard