All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/5] Align library locations in target and staging
@ 2016-02-12 19:20 Thomas De Schampheleire
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
                   ` (7 more replies)
  0 siblings, 8 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

As discussed on the Buildroot developer days, Buildroot installs some libraries
in a different location in target than in staging. This is specifically seen for
libstdc++ and libatomic.

This patch series tackles that problem and performs related cleanup.



Thomas De Schampheleire (5):
  toolchain-external: blackfin: install FDPIC libraries also to staging
  toolchain-external: remove unused calculation of ARCH_SUBDIR
  toolchain-external: extract installation of gdbserver to separate
    define
  toolchain-external: align library locations in target and staging dir
  toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

 package/glibc/glibc.mk                             |  2 +-
 toolchain/helpers.mk                               | 57 ++---------------
 toolchain/toolchain-external/Config.in             |  3 +-
 toolchain/toolchain-external/toolchain-external.mk | 71 ++++++++++------------
 4 files changed, 40 insertions(+), 93 deletions(-)

-- 
2.4.10

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

* [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
@ 2016-02-12 19:20 ` Thomas De Schampheleire
  2016-03-22 21:48   ` Romain Naour
                     ` (2 more replies)
  2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
                   ` (6 subsequent siblings)
  7 siblings, 3 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

For external Blackfin toolchains with BR2_BFIN_INSTALL_FDPIC_SHARED set,
the FDPIC shared libraries are currently only copied to the target
directory, not to staging.

For debugging purposes, an unstripped copy in staging is necessary.
Moreover, this change will simplify a subsequent change that lines up the
location of shared libraries between target and staging directories.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 6c3022a..ffdee49 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -656,6 +656,20 @@ endef
 # nonetheless requested the installation of the FDPIC libraries to the
 # target filesystem.
 ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED),y)
+define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
+	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to staging...") ; \
+	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
+	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+	FDPIC_SUPPORT_LIB_DIR="" ; \
+	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
+	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
+	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
+	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
+	        fi ; \
+	fi ; \
+	$(call copy_toolchain_sysroot,$${FDPIC_SYSROOT_DIR},$${FDPIC_SYSROOT_DIR},,$${FDPIC_LIB_DIR},$${FDPIC_SUPPORT_LIB_DIR})
+endef
 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
 	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
 	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
@@ -755,6 +769,7 @@ TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
 	$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
+	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
 endef
@@ -771,3 +786,4 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
 endef
 
 $(eval $(generic-package))
+
-- 
2.4.10

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

* [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
@ 2016-02-12 19:20 ` Thomas De Schampheleire
  2016-03-22 21:53   ` Romain Naour
                     ` (2 more replies)
  2016-02-12 19:20 ` [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define Thomas De Schampheleire
                   ` (5 subsequent siblings)
  7 siblings, 3 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

In TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS, ARCH_SUBDIR is calculated but not
used, and can thus be removed. Since SYSROOT_DIR is only used for the
calculation of ARCH_SUBDIR, it can be removed too.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 toolchain/toolchain-external/toolchain-external.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index ffdee49..9d88158 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -587,12 +587,7 @@ endef
 #                       to the target filesystem.
 
 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
-	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
-	if test -z "$${SYSROOT_DIR}" ; then \
-		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
-		exit 1 ; \
-	fi ; \
-	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
 	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
 	SUPPORT_LIB_DIR="" ; \
 	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
@@ -601,7 +596,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
 			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
 		fi ; \
 	fi ; \
-	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
 	if test -z "$(BR2_STATIC_LIBS)" ; then \
 		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
 		for libs in $(LIB_EXTERNAL_LIBS); do \
-- 
2.4.10

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

* [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
  2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
@ 2016-02-12 19:20 ` Thomas De Schampheleire
  2016-03-22 22:04   ` Romain Naour
  2016-04-25 21:02   ` Thomas Petazzoni
  2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
                   ` (4 subsequent siblings)
  7 siblings, 2 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

The installation of the gdbserver binary has no relation to the installation
of the target libraries. Moving it to a separate define improves the
understandability of the code and makes later refactoring easier.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 9d88158..d5445e5 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -604,7 +604,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
 		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
 			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
 		done ; \
-	fi ; \
+	fi
+endef
+
+define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
+	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
 	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
 		$(call MESSAGE,"Copying gdbserver") ; \
 		gdbserver_found=0 ; \
@@ -774,6 +779,7 @@ endef
 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
 	$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
+	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
 	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
-- 
2.4.10

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (2 preceding siblings ...)
  2016-02-12 19:20 ` [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define Thomas De Schampheleire
@ 2016-02-12 19:20 ` Thomas De Schampheleire
  2016-03-22 22:53   ` Romain Naour
                     ` (2 more replies)
  2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
                   ` (3 subsequent siblings)
  7 siblings, 3 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

The toolchain-external logic is roughly:
- populate the staging dir by rsyncing the entire ${ARCH_LIB_DIR} and
  usr/${ARCH_LIB_DIR} from sysroot.
- populate the target dir by explictly copying some libraries from sysroot
  into target/lib and some other libraries in target/usr/lib, the split
  being hardcoded into buildroot regardless of the location in the sysroot.

This means that a library libfoo could be located in:
  staging/lib/libfoo.so
  target/usr/lib/libfoo.so

When debugging an application that links against this library, gdb will
fruitlessly search for 'usr/lib/libfoo.so' in staging, and then suggest to
use 'set solib-search-path' which is a hack, really.

To solve the problem, we need to make sure that libraries from the toolchain
are installed in the same relative location in staging and target.
Achieve this by:
- replacing the convoluted search for libraries using for+find in sysroot
  with a simple find in staging.
- determining DESTDIR for each library individually based on the location in
  staging.
- treating LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS equivalently

These changes also allow for the removal of most arguments to
copy_toolchain_lib_root in the method itself and their callers.

Test procedure:
- set configuration for a given toolchain
- make clean toolchain
- find output/target | sort > /tmp/out-before
- apply patch
- make clean toolchain
- find output/target | sort > /tmp/out-after
- diff -u /tmp/out-before /tmp/out-after

The only changes should be some libraries moving from lib to usr/lib or vice
versa. Notable examples being libstdc++ and libatomic.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 package/glibc/glibc.mk                             |  2 +-
 toolchain/helpers.mk                               | 57 ++--------------------
 toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
 3 files changed, 15 insertions(+), 83 deletions(-)

Test notes:
I have executed the mentioned test procedure for all external toolchains
listed on http://autobuild.buildroot.org/toolchains/configs/, for the x86
ARMv7a Thumb2 EABIhf Linaro toolchain, and for an internal glibc toolchain.
An x86_64 qemu image was booted, both with internal and external toolchain.


diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index e60575f..bcec47f 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -117,7 +117,7 @@ endif
 
 define GLIBC_INSTALL_TARGET_CMDS
 	for libs in $(GLIBC_LIBS_LIB); do \
-		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
+		$(call copy_toolchain_lib_root,$$libs) ; \
 	done
 endef
 
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index ee878e8..d5dc16f 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -6,62 +6,15 @@
 # toolchain logic, and the glibc package, so care must be taken when
 # changing this function.
 #
-# Most toolchains (CodeSourcery ones) have their libraries either in
-# /lib or /usr/lib relative to their ARCH_SYSROOT_DIR, so we search
-# libraries in:
-#
-#  $${ARCH_LIB_DIR}
-#  usr/$${ARCH_LIB_DIR}
-#
-# Buildroot toolchains, however, have basic libraries in /lib, and
-# libstdc++/libgcc_s in /usr/<target-name>/lib(64), so we also need to
-# search libraries in:
-#
-#  usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR}
-#
-# Linaro toolchains have most libraries in lib/<target-name>/, so we
-# need to search libraries in:
-#
-#  $${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX)
-#
-# And recent Linaro toolchains have the GCC support libraries
-# (libstdc++, libgcc_s, etc.) into a separate directory, outside of
-# the sysroot, that we called the "SUPPORT_LIB_DIR", into which we
-# need to search as well.
-#
-# Thanks to ARCH_LIB_DIR we also take into account toolchains that
-# have the libraries in lib64 and usr/lib64.
-#
-# Please be very careful to check the major toolchain sources:
-# Buildroot, Crosstool-NG, CodeSourcery and Linaro before doing any
-# modification on the below logic.
-#
-# $1: arch specific sysroot directory
-# $2: support libraries directory (can be empty)
-# $3: library directory ('lib' or 'lib64') from which libraries must be copied
-# $4: library name
-# $5: destination directory of the libary, relative to $(TARGET_DIR)
+# $1: library name
 #
 copy_toolchain_lib_root = \
-	ARCH_SYSROOT_DIR="$(strip $1)"; \
-	SUPPORT_LIB_DIR="$(strip $2)" ; \
-	ARCH_LIB_DIR="$(strip $3)" ; \
-	LIB="$(strip $4)"; \
-	DESTDIR="$(strip $5)" ; \
+	LIB="$(strip $1)"; \
 \
-	for dir in \
-		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX) \
-		$${ARCH_SYSROOT_DIR}/usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR} \
-		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR} \
-		$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
-		$${SUPPORT_LIB_DIR} ; do \
-		LIBPATHS=`find $${dir} -maxdepth 1 -name "$${LIB}" 2>/dev/null` ; \
-		if test -n "$${LIBPATHS}" ; then \
-			break ; \
-		fi \
-	done ; \
-	mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
+	LIBPATHS=`find $(STAGING_DIR) -follow -name "$${LIB}" 2>/dev/null` ; \
 	for LIBPATH in $${LIBPATHS} ; do \
+		DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/,," | xargs dirname` ; \
+		mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
 		while true ; do \
 			LIBNAME=`basename $${LIBPATH}`; \
 			LIBDIR=`dirname $${LIBPATH}` ; \
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index d5445e5..a333c32 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -585,24 +585,16 @@ endef
 #                       our sysroot, and the directory will also be
 #                       considered when searching libraries for copy
 #                       to the target filesystem.
+#
+# Please be very careful to check the major toolchain sources:
+# Buildroot, Crosstool-NG, CodeSourcery and Linaro
+# before doing any modification on the below logic.
 
 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
-	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
-	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
-	SUPPORT_LIB_DIR="" ; \
-	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
-		LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
-		if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \
-			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
-		fi ; \
-	fi ; \
-	if test -z "$(BR2_STATIC_LIBS)" ; then \
+	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
 		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
-		for libs in $(LIB_EXTERNAL_LIBS); do \
-			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
-		done ; \
-		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
-			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
+		for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
+			$(call copy_toolchain_lib_root,$$libs); \
 		done ; \
 	fi
 endef
@@ -671,21 +663,8 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
 endef
 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
 	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
-	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
-	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
-	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
-	FDPIC_SUPPORT_LIB_DIR="" ; \
-	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
-	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
-	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
-	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
-	        fi ; \
-	fi ; \
-	for libs in $(LIB_EXTERNAL_LIBS); do \
-	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib); \
-	done ; \
-	for libs in $(USR_LIB_EXTERNAL_LIBS); do \
-	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr/lib); \
+	for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
+		$(call copy_toolchain_lib_root,$$libs); \
 	done
 endef
 endif
-- 
2.4.10

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

* [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (3 preceding siblings ...)
  2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
@ 2016-02-12 19:20 ` Thomas De Schampheleire
  2016-03-22 22:58   ` Romain Naour
                     ` (2 more replies)
  2016-03-10  8:02 ` [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (2 subsequent siblings)
  7 siblings, 3 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-02-12 19:20 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

With the alignment of toolchain library location in target and staging,
there is no need anymore for the distinction between LIB_EXTERNAL_LIBS and
USR_LIB_EXTERNAL_LIBS. Unify them into TOOLCHAIN_EXTERNAL_LIBS.

Related, update the help text of
BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 toolchain/toolchain-external/Config.in             |  3 +--
 toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 7ba3929..9d81a2e 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -1006,8 +1006,7 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
 	help
 	  If your external toolchain provides extra libraries that
 	  need to be copied to the target filesystem, enter them
-	  here, separated by spaces. They will be copied to the
-	  target's /lib directory.
+	  here, separated by spaces.
 
 endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM
 
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index a333c32..bd1a807 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -64,33 +64,33 @@
 #  of Buildroot is handled identical for the 2 toolchain types.
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
-LIB_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy)
-LIB_EXTERNAL_LIBS += ld-linux-armhf.so.*
+TOOLCHAIN_EXTERNAL_LIBS += ld-linux-armhf.so.*
 else
-LIB_EXTERNAL_LIBS += ld*.so.*
+TOOLCHAIN_EXTERNAL_LIBS += ld*.so.*
 endif
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-LIB_EXTERNAL_LIBS += libpthread.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.*
 ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
-LIB_EXTERNAL_LIBS += libthread_db.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libthread_db.so.*
 endif # gdbserver
 endif # ! no threads
 endif
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
-LIB_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
 endif
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
-LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libc.so libgcc_s.so.*
 endif
 
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
-USR_LIB_EXTERNAL_LIBS += libstdc++.so.*
+TOOLCHAIN_EXTERNAL_LIBS += libstdc++.so.*
 endif
 
-LIB_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
+TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS))
 
 # Details about sysroot directory selection.
 #
@@ -593,7 +593,7 @@ endef
 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
 	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
 		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
-		for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
+		for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \
 			$(call copy_toolchain_lib_root,$$libs); \
 		done ; \
 	fi
@@ -663,7 +663,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
 endef
 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
 	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
-	for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
+	for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \
 		$(call copy_toolchain_lib_root,$$libs); \
 	done
 endef
-- 
2.4.10

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (4 preceding siblings ...)
  2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
@ 2016-03-10  8:02 ` Thomas De Schampheleire
  2016-03-27 20:39 ` Arnout Vandecappelle
  2016-04-25 21:17 ` Thomas Petazzoni
  7 siblings, 0 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-03-10  8:02 UTC (permalink / raw)
  To: buildroot

On Fri, Feb 12, 2016 at 8:20 PM, Thomas De Schampheleire
<patrickdepinguin@gmail.com> wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> As discussed on the Buildroot developer days, Buildroot installs some libraries
> in a different location in target than in staging. This is specifically seen for
> libstdc++ and libatomic.
>
> This patch series tackles that problem and performs related cleanup.
>
>
>
> Thomas De Schampheleire (5):
>   toolchain-external: blackfin: install FDPIC libraries also to staging
>   toolchain-external: remove unused calculation of ARCH_SUBDIR
>   toolchain-external: extract installation of gdbserver to separate
>     define
>   toolchain-external: align library locations in target and staging dir
>   toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>
>  package/glibc/glibc.mk                             |  2 +-
>  toolchain/helpers.mk                               | 57 ++---------------
>  toolchain/toolchain-external/Config.in             |  3 +-
>  toolchain/toolchain-external/toolchain-external.mk | 71 ++++++++++------------
>  4 files changed, 40 insertions(+), 93 deletions(-)


It occurred to me that there has not been any feedback on this
toolchain-related patch series :-)
Anyone could spare some time to look at it?

Thanks,
Thomas

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

* [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
@ 2016-03-22 21:48   ` Romain Naour
  2016-03-27 16:20   ` Arnout Vandecappelle
  2016-04-25 21:00   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Romain Naour @ 2016-03-22 21:48 UTC (permalink / raw)
  To: buildroot

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> For external Blackfin toolchains with BR2_BFIN_INSTALL_FDPIC_SHARED set,
> the FDPIC shared libraries are currently only copied to the target
> directory, not to staging.
> 
> For debugging purposes, an unstripped copy in staging is necessary.
> Moreover, this change will simplify a subsequent change that lines up the
> location of shared libraries between target and staging directories.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> ---
>  toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 6c3022a..ffdee49 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -656,6 +656,20 @@ endef
>  # nonetheless requested the installation of the FDPIC libraries to the
>  # target filesystem.
>  ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED),y)
> +define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
> +	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to staging...") ; \
> +	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> +	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	FDPIC_SUPPORT_LIB_DIR="" ; \
> +	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> +	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> +	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
> +	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> +	        fi ; \
> +	fi ; \
> +	$(call copy_toolchain_sysroot,$${FDPIC_SYSROOT_DIR},$${FDPIC_SYSROOT_DIR},,$${FDPIC_LIB_DIR},$${FDPIC_SUPPORT_LIB_DIR})
> +endef
>  define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
>  	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
>  	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> @@ -755,6 +769,7 @@ TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
>  define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
>  	$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
> +	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
>  endef
> @@ -771,3 +786,4 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
>  endef
>  
>  $(eval $(generic-package))
> +
> 

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

* [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR
  2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
@ 2016-03-22 21:53   ` Romain Naour
  2016-03-27 20:34   ` Arnout Vandecappelle
  2016-04-21 21:30   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Romain Naour @ 2016-03-22 21:53 UTC (permalink / raw)
  To: buildroot

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> In TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS, ARCH_SUBDIR is calculated but not
> used, and can thus be removed. Since SYSROOT_DIR is only used for the
> calculation of ARCH_SUBDIR, it can be removed too.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> ---
>  toolchain/toolchain-external/toolchain-external.mk | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index ffdee49..9d88158 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -587,12 +587,7 @@ endef
>  #                       to the target filesystem.
>  
>  define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
> -	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
> -	if test -z "$${SYSROOT_DIR}" ; then \
> -		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
> -		exit 1 ; \
> -	fi ; \
> -	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>  	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>  	SUPPORT_LIB_DIR="" ; \
>  	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> @@ -601,7 +596,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>  			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
>  		fi ; \
>  	fi ; \
> -	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
>  	if test -z "$(BR2_STATIC_LIBS)" ; then \
>  		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
>  		for libs in $(LIB_EXTERNAL_LIBS); do \
> 

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

* [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define
  2016-02-12 19:20 ` [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define Thomas De Schampheleire
@ 2016-03-22 22:04   ` Romain Naour
  2016-03-27 16:43     ` Arnout Vandecappelle
  2016-04-25 21:02   ` Thomas Petazzoni
  1 sibling, 1 reply; 33+ messages in thread
From: Romain Naour @ 2016-03-22 22:04 UTC (permalink / raw)
  To: buildroot

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> The installation of the gdbserver binary has no relation to the installation
> of the target libraries. Moving it to a separate define improves the
> understandability of the code and makes later refactoring easier.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 9d88158..d5445e5 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -604,7 +604,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>  		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
>  			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
>  		done ; \
> -	fi ; \
> +	fi
> +endef
> +

It's a good idea but can we instead define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
only when BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY is set to y ?

ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y)
define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
...

> +define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>  	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \

This allow to remove this line ^^^

Best regards,
Romain

>  		$(call MESSAGE,"Copying gdbserver") ; \
>  		gdbserver_found=0 ; \
> @@ -774,6 +779,7 @@ endef
>  define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
>  	$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
> +	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
>  	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
> 

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
@ 2016-03-22 22:53   ` Romain Naour
  2016-03-27 20:34   ` Arnout Vandecappelle
  2016-04-25 21:08   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Romain Naour @ 2016-03-22 22:53 UTC (permalink / raw)
  To: buildroot

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> The toolchain-external logic is roughly:
> - populate the staging dir by rsyncing the entire ${ARCH_LIB_DIR} and
>   usr/${ARCH_LIB_DIR} from sysroot.
> - populate the target dir by explictly copying some libraries from sysroot
>   into target/lib and some other libraries in target/usr/lib, the split
>   being hardcoded into buildroot regardless of the location in the sysroot.
> 
> This means that a library libfoo could be located in:
>   staging/lib/libfoo.so
>   target/usr/lib/libfoo.so
> 
> When debugging an application that links against this library, gdb will
> fruitlessly search for 'usr/lib/libfoo.so' in staging, and then suggest to
> use 'set solib-search-path' which is a hack, really.
> 
> To solve the problem, we need to make sure that libraries from the toolchain
> are installed in the same relative location in staging and target.
> Achieve this by:
> - replacing the convoluted search for libraries using for+find in sysroot
>   with a simple find in staging.
> - determining DESTDIR for each library individually based on the location in
>   staging.
> - treating LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS equivalently
> 
> These changes also allow for the removal of most arguments to
> copy_toolchain_lib_root in the method itself and their callers.
> 
> Test procedure:
> - set configuration for a given toolchain
> - make clean toolchain
> - find output/target | sort > /tmp/out-before
> - apply patch
> - make clean toolchain
> - find output/target | sort > /tmp/out-after
> - diff -u /tmp/out-before /tmp/out-after
> 
> The only changes should be some libraries moving from lib to usr/lib or vice
> versa. Notable examples being libstdc++ and libatomic.

Using an arbitrary toolchain (BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 2015.11)

The only diff is:

before:
output/target/usr/lib/libstdc++.so.6
output/target/usr/lib/libstdc++.so.6.0.21
output/target/usr/lib/libstdc++.so.6.0.21-gdb.py

after:
output/target/lib/libstdc++.so.6
output/target/lib/libstdc++.so.6.0.21
output/target/lib/libstdc++.so.6.0.21-gdb.py

Now libstdc++.so.6 is located in the same directory on the target than the
toolchain sysroot (/lib/libstdc++.so.6).

toolchain sysroot:
ext-toolchain/aarch64-linux-gnu/libc/lib/libstdc++.so.6.0.21
ext-toolchain/aarch64-linux-gnu/libc/lib/libstdc++.so.6

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  package/glibc/glibc.mk                             |  2 +-
>  toolchain/helpers.mk                               | 57 ++--------------------
>  toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
>  3 files changed, 15 insertions(+), 83 deletions(-)
> 
> Test notes:
> I have executed the mentioned test procedure for all external toolchains
> listed on http://autobuild.buildroot.org/toolchains/configs/, for the x86
> ARMv7a Thumb2 EABIhf Linaro toolchain, and for an internal glibc toolchain.
> An x86_64 qemu image was booted, both with internal and external toolchain.
> 
> 
> diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
> index e60575f..bcec47f 100644
> --- a/package/glibc/glibc.mk
> +++ b/package/glibc/glibc.mk
> @@ -117,7 +117,7 @@ endif
>  
>  define GLIBC_INSTALL_TARGET_CMDS
>  	for libs in $(GLIBC_LIBS_LIB); do \
> -		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
> +		$(call copy_toolchain_lib_root,$$libs) ; \
>  	done
>  endef
>  
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index ee878e8..d5dc16f 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -6,62 +6,15 @@
>  # toolchain logic, and the glibc package, so care must be taken when
>  # changing this function.
>  #
> -# Most toolchains (CodeSourcery ones) have their libraries either in
> -# /lib or /usr/lib relative to their ARCH_SYSROOT_DIR, so we search
> -# libraries in:
> -#
> -#  $${ARCH_LIB_DIR}
> -#  usr/$${ARCH_LIB_DIR}
> -#
> -# Buildroot toolchains, however, have basic libraries in /lib, and
> -# libstdc++/libgcc_s in /usr/<target-name>/lib(64), so we also need to
> -# search libraries in:
> -#
> -#  usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR}
> -#
> -# Linaro toolchains have most libraries in lib/<target-name>/, so we
> -# need to search libraries in:
> -#
> -#  $${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX)
> -#
> -# And recent Linaro toolchains have the GCC support libraries
> -# (libstdc++, libgcc_s, etc.) into a separate directory, outside of
> -# the sysroot, that we called the "SUPPORT_LIB_DIR", into which we
> -# need to search as well.
> -#
> -# Thanks to ARCH_LIB_DIR we also take into account toolchains that
> -# have the libraries in lib64 and usr/lib64.
> -#
> -# Please be very careful to check the major toolchain sources:
> -# Buildroot, Crosstool-NG, CodeSourcery and Linaro before doing any
> -# modification on the below logic.
> -#
> -# $1: arch specific sysroot directory
> -# $2: support libraries directory (can be empty)
> -# $3: library directory ('lib' or 'lib64') from which libraries must be copied
> -# $4: library name
> -# $5: destination directory of the libary, relative to $(TARGET_DIR)
> +# $1: library name
>  #
>  copy_toolchain_lib_root = \
> -	ARCH_SYSROOT_DIR="$(strip $1)"; \
> -	SUPPORT_LIB_DIR="$(strip $2)" ; \
> -	ARCH_LIB_DIR="$(strip $3)" ; \
> -	LIB="$(strip $4)"; \
> -	DESTDIR="$(strip $5)" ; \
> +	LIB="$(strip $1)"; \
>  \
> -	for dir in \
> -		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX) \
> -		$${ARCH_SYSROOT_DIR}/usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR} \
> -		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR} \
> -		$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
> -		$${SUPPORT_LIB_DIR} ; do \
> -		LIBPATHS=`find $${dir} -maxdepth 1 -name "$${LIB}" 2>/dev/null` ; \
> -		if test -n "$${LIBPATHS}" ; then \
> -			break ; \
> -		fi \
> -	done ; \
> -	mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
> +	LIBPATHS=`find $(STAGING_DIR) -follow -name "$${LIB}" 2>/dev/null` ; \
>  	for LIBPATH in $${LIBPATHS} ; do \
> +		DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/,," | xargs dirname` ; \
> +		mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
>  		while true ; do \
>  			LIBNAME=`basename $${LIBPATH}`; \
>  			LIBDIR=`dirname $${LIBPATH}` ; \
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index d5445e5..a333c32 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -585,24 +585,16 @@ endef
>  #                       our sysroot, and the directory will also be
>  #                       considered when searching libraries for copy
>  #                       to the target filesystem.
> +#
> +# Please be very careful to check the major toolchain sources:
> +# Buildroot, Crosstool-NG, CodeSourcery and Linaro
> +# before doing any modification on the below logic.
>  
>  define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
> -	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	SUPPORT_LIB_DIR="" ; \
> -	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> -		LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> -		if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \
> -			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> -		fi ; \
> -	fi ; \
> -	if test -z "$(BR2_STATIC_LIBS)" ; then \
> +	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
>  		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
> -		for libs in $(LIB_EXTERNAL_LIBS); do \
> -			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
> -		done ; \
> -		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
> -			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
> +		for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +			$(call copy_toolchain_lib_root,$$libs); \
>  		done ; \
>  	fi
>  endef
> @@ -671,21 +663,8 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
>  endef
>  define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
>  	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
> -	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> -	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	FDPIC_SUPPORT_LIB_DIR="" ; \
> -	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> -	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> -	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
> -	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> -	        fi ; \
> -	fi ; \
> -	for libs in $(LIB_EXTERNAL_LIBS); do \
> -	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib); \
> -	done ; \
> -	for libs in $(USR_LIB_EXTERNAL_LIBS); do \
> -	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr/lib); \
> +	for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +		$(call copy_toolchain_lib_root,$$libs); \
>  	done
>  endef
>  endif
> 

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

* [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
  2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
@ 2016-03-22 22:58   ` Romain Naour
  2016-03-27 20:36   ` Arnout Vandecappelle
  2016-04-25 21:16   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Romain Naour @ 2016-03-22 22:58 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> With the alignment of toolchain library location in target and staging,
> there is no need anymore for the distinction between LIB_EXTERNAL_LIBS and
> USR_LIB_EXTERNAL_LIBS. Unify them into TOOLCHAIN_EXTERNAL_LIBS.
> 
> Related, update the help text of
> BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS.
> 

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/Config.in             |  3 +--
>  toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
>  2 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
> index 7ba3929..9d81a2e 100644
> --- a/toolchain/toolchain-external/Config.in
> +++ b/toolchain/toolchain-external/Config.in
> @@ -1006,8 +1006,7 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
>  	help
>  	  If your external toolchain provides extra libraries that
>  	  need to be copied to the target filesystem, enter them
> -	  here, separated by spaces. They will be copied to the
> -	  target's /lib directory.
> +	  here, separated by spaces.
>  
>  endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM
>  
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index a333c32..bd1a807 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -64,33 +64,33 @@
>  #  of Buildroot is handled identical for the 2 toolchain types.
>  
>  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
> -LIB_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
>  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy)
> -LIB_EXTERNAL_LIBS += ld-linux-armhf.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += ld-linux-armhf.so.*
>  else
> -LIB_EXTERNAL_LIBS += ld*.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += ld*.so.*
>  endif
>  ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> -LIB_EXTERNAL_LIBS += libpthread.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.*
>  ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
> -LIB_EXTERNAL_LIBS += libthread_db.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libthread_db.so.*
>  endif # gdbserver
>  endif # ! no threads
>  endif
>  
>  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
> -LIB_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
>  endif
>  
>  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
> -LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libc.so libgcc_s.so.*
>  endif
>  
>  ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
> -USR_LIB_EXTERNAL_LIBS += libstdc++.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libstdc++.so.*
>  endif
>  
> -LIB_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
> +TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS))
>  
>  # Details about sysroot directory selection.
>  #
> @@ -593,7 +593,7 @@ endef
>  define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>  	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
>  		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
> -		for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +		for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \
>  			$(call copy_toolchain_lib_root,$$libs); \
>  		done ; \
>  	fi
> @@ -663,7 +663,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
>  endef
>  define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
>  	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
> -	for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +	for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \
>  		$(call copy_toolchain_lib_root,$$libs); \
>  	done
>  endef
> 

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

* [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
  2016-03-22 21:48   ` Romain Naour
@ 2016-03-27 16:20   ` Arnout Vandecappelle
  2016-04-25 21:00   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 16:20 UTC (permalink / raw)
  To: buildroot

On 02/12/16 20:20, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> For external Blackfin toolchains with BR2_BFIN_INSTALL_FDPIC_SHARED set,
> the FDPIC shared libraries are currently only copied to the target
> directory, not to staging.
>
> For debugging purposes, an unstripped copy in staging is necessary.
> Moreover, this change will simplify a subsequent change that lines up the
> location of shared libraries between target and staging directories.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Quick build-test done.

  Regards,
  Arnout

> ---
>   toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 6c3022a..ffdee49 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -656,6 +656,20 @@ endef
>   # nonetheless requested the installation of the FDPIC libraries to the
>   # target filesystem.
>   ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED),y)
> +define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
> +	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to staging...") ; \
> +	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> +	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	FDPIC_SUPPORT_LIB_DIR="" ; \
> +	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> +	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> +	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
> +	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> +	        fi ; \
> +	fi ; \
> +	$(call copy_toolchain_sysroot,$${FDPIC_SYSROOT_DIR},$${FDPIC_SYSROOT_DIR},,$${FDPIC_LIB_DIR},$${FDPIC_SUPPORT_LIB_DIR})
> +endef
>   define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
>   	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
>   	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> @@ -755,6 +769,7 @@ TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
>   define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
>   	$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
>   	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
> +	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC)
>   	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
>   	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
>   endef
> @@ -771,3 +786,4 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
>   endef
>
>   $(eval $(generic-package))
> +
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define
  2016-03-22 22:04   ` Romain Naour
@ 2016-03-27 16:43     ` Arnout Vandecappelle
  0 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 16:43 UTC (permalink / raw)
  To: buildroot

On 03/22/16 23:04, Romain Naour wrote:
> Hi Thomas, all,
>
> Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :
>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> The installation of the gdbserver binary has no relation to the installation
>> of the target libraries. Moving it to a separate define improves the
>> understandability of the code and makes later refactoring easier.
>>
>> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>> ---
>>   toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
>> index 9d88158..d5445e5 100644
>> --- a/toolchain/toolchain-external/toolchain-external.mk
>> +++ b/toolchain/toolchain-external/toolchain-external.mk
>> @@ -604,7 +604,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>>   		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
>>   			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
>>   		done ; \
>> -	fi ; \
>> +	fi
>> +endef
>> +
>
> It's a good idea but can we instead define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
> only when BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY is set to y ?
>
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y)
> define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
> ...

  While you do that: I think it would be better to have TARGET in the name, so 
TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER.


>
>> +define TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER
>> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>> +	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>>   	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
>
> This allow to remove this line ^^^
>
> Best regards,
> Romain
>
>>   		$(call MESSAGE,"Copying gdbserver") ; \
>>   		gdbserver_found=0 ; \
>> @@ -774,6 +779,7 @@ endef
>>   define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
>>   	$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
>>   	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
>> +	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER)
>>   	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
>>   	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)

  These two should ideally also have TARGET in their name, but that's a separate 
change of course.


  Regards,
  Arnout


>>   	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
>>
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
  2016-03-22 22:53   ` Romain Naour
@ 2016-03-27 20:34   ` Arnout Vandecappelle
  2016-04-25 21:15     ` Thomas Petazzoni
  2016-04-25 21:08   ` Thomas Petazzoni
  2 siblings, 1 reply; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 20:34 UTC (permalink / raw)
  To: buildroot

On 02/12/16 20:20, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> The toolchain-external logic is roughly:
> - populate the staging dir by rsyncing the entire ${ARCH_LIB_DIR} and
>    usr/${ARCH_LIB_DIR} from sysroot.
> - populate the target dir by explictly copying some libraries from sysroot
>    into target/lib and some other libraries in target/usr/lib, the split
>    being hardcoded into buildroot regardless of the location in the sysroot.
>
> This means that a library libfoo could be located in:
>    staging/lib/libfoo.so
>    target/usr/lib/libfoo.so
>
> When debugging an application that links against this library, gdb will
> fruitlessly search for 'usr/lib/libfoo.so' in staging, and then suggest to
> use 'set solib-search-path' which is a hack, really.
>
> To solve the problem, we need to make sure that libraries from the toolchain
> are installed in the same relative location in staging and target.
> Achieve this by:
> - replacing the convoluted search for libraries using for+find in sysroot
>    with a simple find in staging.
> - determining DESTDIR for each library individually based on the location in
>    staging.
> - treating LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS equivalently
>
> These changes also allow for the removal of most arguments to
> copy_toolchain_lib_root in the method itself and their callers.
>
> Test procedure:
> - set configuration for a given toolchain
> - make clean toolchain
> - find output/target | sort > /tmp/out-before
> - apply patch
> - make clean toolchain
> - find output/target | sort > /tmp/out-after
> - diff -u /tmp/out-before /tmp/out-after
>
> The only changes should be some libraries moving from lib to usr/lib or vice
> versa. Notable examples being libstdc++ and libatomic.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Minor improvements below, but they could be separate patches.

> ---
>   package/glibc/glibc.mk                             |  2 +-
>   toolchain/helpers.mk                               | 57 ++--------------------
>   toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
>   3 files changed, 15 insertions(+), 83 deletions(-)

  -65 net lines, that's the kind of patch I like!

>
> Test notes:
> I have executed the mentioned test procedure for all external toolchains
> listed on http://autobuild.buildroot.org/toolchains/configs/, for the x86
> ARMv7a Thumb2 EABIhf Linaro toolchain, and for an internal glibc toolchain.
> An x86_64 qemu image was booted, both with internal and external toolchain.
>
>
> diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
> index e60575f..bcec47f 100644
> --- a/package/glibc/glibc.mk
> +++ b/package/glibc/glibc.mk
> @@ -117,7 +117,7 @@ endif
>
>   define GLIBC_INSTALL_TARGET_CMDS
>   	for libs in $(GLIBC_LIBS_LIB); do \
> -		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
> +		$(call copy_toolchain_lib_root,$$libs) ; \
>   	done
>   endef
>
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index ee878e8..d5dc16f 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -6,62 +6,15 @@
>   # toolchain logic, and the glibc package, so care must be taken when
>   # changing this function.
>   #
> -# Most toolchains (CodeSourcery ones) have their libraries either in
> -# /lib or /usr/lib relative to their ARCH_SYSROOT_DIR, so we search
> -# libraries in:
> -#
> -#  $${ARCH_LIB_DIR}
> -#  usr/$${ARCH_LIB_DIR}
> -#
> -# Buildroot toolchains, however, have basic libraries in /lib, and
> -# libstdc++/libgcc_s in /usr/<target-name>/lib(64), so we also need to
> -# search libraries in:
> -#
> -#  usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR}
> -#
> -# Linaro toolchains have most libraries in lib/<target-name>/, so we
> -# need to search libraries in:
> -#
> -#  $${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX)
> -#
> -# And recent Linaro toolchains have the GCC support libraries
> -# (libstdc++, libgcc_s, etc.) into a separate directory, outside of
> -# the sysroot, that we called the "SUPPORT_LIB_DIR", into which we
> -# need to search as well.
> -#
> -# Thanks to ARCH_LIB_DIR we also take into account toolchains that
> -# have the libraries in lib64 and usr/lib64.
> -#
> -# Please be very careful to check the major toolchain sources:
> -# Buildroot, Crosstool-NG, CodeSourcery and Linaro before doing any
> -# modification on the below logic.
> -#
> -# $1: arch specific sysroot directory
> -# $2: support libraries directory (can be empty)
> -# $3: library directory ('lib' or 'lib64') from which libraries must be copied
> -# $4: library name
> -# $5: destination directory of the libary, relative to $(TARGET_DIR)
> +# $1: library name
>   #
>   copy_toolchain_lib_root = \
> -	ARCH_SYSROOT_DIR="$(strip $1)"; \
> -	SUPPORT_LIB_DIR="$(strip $2)" ; \
> -	ARCH_LIB_DIR="$(strip $3)" ; \
> -	LIB="$(strip $4)"; \
> -	DESTDIR="$(strip $5)" ; \
> +	LIB="$(strip $1)"; \
>   \
> -	for dir in \
> -		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR}/$(TOOLCHAIN_EXTERNAL_PREFIX) \
> -		$${ARCH_SYSROOT_DIR}/usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR} \
> -		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR} \
> -		$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
> -		$${SUPPORT_LIB_DIR} ; do \
> -		LIBPATHS=`find $${dir} -maxdepth 1 -name "$${LIB}" 2>/dev/null` ; \
> -		if test -n "$${LIBPATHS}" ; then \
> -			break ; \
> -		fi \
> -	done ; \
> -	mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
> +	LIBPATHS=`find $(STAGING_DIR) -follow -name "$${LIB}" 2>/dev/null` ; \

  -follow is documented as depracated, use -L instead. But why do we need this? 
I tried without it and it seems to work just the same. I also don't think the 
error redirect is needed anymore (at least when the -follow is removed).


>   	for LIBPATH in $${LIBPATHS} ; do \
> +		DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/,," | xargs dirname` ; \

  I would have written this as

DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/\(.*\)/[^/]*,\1,"` ; \

but perhaps I'm too much of a regexp lover :-)

> +		mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
>   		while true ; do \

  I wonder if the loop is still needed now. As far as I can see, the idea of 
this loop was to make sure that the library pointed to was also copied. But 
since we now copy everything even if it is not in the expected lib path, it 
shouldn't be needed anymore. Except if the library pointed to doesn't match the 
glob pattern we are searching for... Anyway, that's something for a separate patch.

>   			LIBNAME=`basename $${LIBPATH}`; \
>   			LIBDIR=`dirname $${LIBPATH}` ; \
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index d5445e5..a333c32 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -585,24 +585,16 @@ endef
>   #                       our sysroot, and the directory will also be
>   #                       considered when searching libraries for copy
>   #                       to the target filesystem.
> +#
> +# Please be very careful to check the major toolchain sources:
> +# Buildroot, Crosstool-NG, CodeSourcery and Linaro
> +# before doing any modification on the below logic.
>
>   define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
> -	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	SUPPORT_LIB_DIR="" ; \
> -	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> -		LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> -		if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \
> -			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> -		fi ; \
> -	fi ; \
> -	if test -z "$(BR2_STATIC_LIBS)" ; then \
> +	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \

  This can now be converted into a make condition instead of a shell condition, 
which simplifies the logic even more. Well, actually, it could have been a make 
condition from the start because all of the above doesn't do anything except set 
some variables...


  Regards,
  Arnout

>   		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
> -		for libs in $(LIB_EXTERNAL_LIBS); do \
> -			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
> -		done ; \
> -		for libs in $(USR_LIB_EXTERNAL_LIBS); do \
> -			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
> +		for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +			$(call copy_toolchain_lib_root,$$libs); \
>   		done ; \
>   	fi
>   endef
> @@ -671,21 +663,8 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC
>   endef
>   define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
>   	$(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \
> -	FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \
> -	FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> -	FDPIC_SUPPORT_LIB_DIR="" ; \
> -	if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> -	        FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
> -	        if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
> -	                FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
> -	        fi ; \
> -	fi ; \
> -	for libs in $(LIB_EXTERNAL_LIBS); do \
> -	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib); \
> -	done ; \
> -	for libs in $(USR_LIB_EXTERNAL_LIBS); do \
> -	        $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr/lib); \
> +	for libs in $(LIB_EXTERNAL_LIBS) $(USR_LIB_EXTERNAL_LIBS); do \
> +		$(call copy_toolchain_lib_root,$$libs); \
>   	done
>   endef
>   endif
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR
  2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
  2016-03-22 21:53   ` Romain Naour
@ 2016-03-27 20:34   ` Arnout Vandecappelle
  2016-03-27 23:10     ` Arnout Vandecappelle
  2016-04-21 21:30   ` Thomas Petazzoni
  2 siblings, 1 reply; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 20:34 UTC (permalink / raw)
  To: buildroot

  I'm sorry, I still have comments...

On 02/12/16 20:20, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> In TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS, ARCH_SUBDIR is calculated but not
> used, and can thus be removed. Since SYSROOT_DIR is only used for the
> calculation of ARCH_SUBDIR, it can be removed too.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>   toolchain/toolchain-external/toolchain-external.mk | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index ffdee49..9d88158 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -587,12 +587,7 @@ endef
>   #                       to the target filesystem.
>
>   define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
> -	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
> -	if test -z "$${SYSROOT_DIR}" ; then \
> -		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \

  This was the only place where we gave that error message, so it should be kept.

  That said, it probably wouldn't have shown anyway, because we would already 
error out with an incomprehensible error message in the configure step. Bottom 
line: move it to the configure step first.

  Otherwise, it looks good however. So, since it anyway didn't work properly 
before, I'll already give this patch my

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Regards,
  Arnout

> -		exit 1 ; \
> -	fi ; \
> -	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>   	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>   	SUPPORT_LIB_DIR="" ; \
>   	if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
> @@ -601,7 +596,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>   			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
>   		fi ; \
>   	fi ; \
> -	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
>   	if test -z "$(BR2_STATIC_LIBS)" ; then \
>   		$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
>   		for libs in $(LIB_EXTERNAL_LIBS); do \
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
  2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
  2016-03-22 22:58   ` Romain Naour
@ 2016-03-27 20:36   ` Arnout Vandecappelle
  2016-04-25 21:16   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 20:36 UTC (permalink / raw)
  To: buildroot

On 02/12/16 20:20, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire<thomas.de.schampheleire@gmail.com>
>
> With the alignment of toolchain library location in target and staging,
> there is no need anymore for the distinction between LIB_EXTERNAL_LIBS and
> USR_LIB_EXTERNAL_LIBS. Unify them into TOOLCHAIN_EXTERNAL_LIBS.
>
> Related, update the help text of
> BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS.
>
> Signed-off-by: Thomas De Schampheleire<thomas.de.schampheleire@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Regards,
  Arnout

> ---
>   toolchain/toolchain-external/Config.in             |  3 +--
>   toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
>   2 files changed, 12 insertions(+), 13 deletions(-)


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (5 preceding siblings ...)
  2016-03-10  8:02 ` [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
@ 2016-03-27 20:39 ` Arnout Vandecappelle
  2016-03-27 20:52   ` Romain Naour
  2016-03-29 14:21   ` Thomas De Schampheleire
  2016-04-25 21:17 ` Thomas Petazzoni
  7 siblings, 2 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 20:39 UTC (permalink / raw)
  To: buildroot

On 02/12/16 20:20, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> As discussed on the Buildroot developer days, Buildroot installs some libraries
> in a different location in target than in staging. This is specifically seen for
> libstdc++ and libatomic.
>
> This patch series tackles that problem and performs related cleanup.
>
>
>
> Thomas De Schampheleire (5):
>    toolchain-external: blackfin: install FDPIC libraries also to staging
>    toolchain-external: remove unused calculation of ARCH_SUBDIR
>    toolchain-external: extract installation of gdbserver to separate
>      define
>    toolchain-external: align library locations in target and staging dir
>    toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>
>   package/glibc/glibc.mk                             |  2 +-
>   toolchain/helpers.mk                               | 57 ++---------------
>   toolchain/toolchain-external/Config.in             |  3 +-
>   toolchain/toolchain-external/toolchain-external.mk | 71 ++++++++++------------
>   4 files changed, 40 insertions(+), 93 deletions(-)
>

  I've also done a review and a test of the entire series. There is a bit of 
reworking suggested by Romain in patch 3/5, the removal of -follow that I 
suggest in patch 4/5, and I would like to re-instate the --sysroot check in 
patch 2/5, but that's it.

  ThomasDS, will you respin or do we apply and make changes afterwards?


  Regards,
  Arnout
-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-03-27 20:39 ` Arnout Vandecappelle
@ 2016-03-27 20:52   ` Romain Naour
  2016-03-27 23:08     ` Arnout Vandecappelle
  2016-03-29 14:21   ` Thomas De Schampheleire
  1 sibling, 1 reply; 33+ messages in thread
From: Romain Naour @ 2016-03-27 20:52 UTC (permalink / raw)
  To: buildroot

Hello Arnout, ThomasDS, All,

Le 27/03/2016 22:39, Arnout Vandecappelle a ?crit :
> On 02/12/16 20:20, Thomas De Schampheleire wrote:
>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> As discussed on the Buildroot developer days, Buildroot installs some libraries
>> in a different location in target than in staging. This is specifically seen for
>> libstdc++ and libatomic.
>>
>> This patch series tackles that problem and performs related cleanup.
>>
>>
>>
>> Thomas De Schampheleire (5):
>>    toolchain-external: blackfin: install FDPIC libraries also to staging
>>    toolchain-external: remove unused calculation of ARCH_SUBDIR
>>    toolchain-external: extract installation of gdbserver to separate
>>      define
>>    toolchain-external: align library locations in target and staging dir
>>    toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>>
>>   package/glibc/glibc.mk                             |  2 +-
>>   toolchain/helpers.mk                               | 57 ++---------------
>>   toolchain/toolchain-external/Config.in             |  3 +-
>>   toolchain/toolchain-external/toolchain-external.mk | 71 ++++++++++------------
>>   4 files changed, 40 insertions(+), 93 deletions(-)
>>
> 
>  I've also done a review and a test of the entire series. There is a bit of
> reworking suggested by Romain in patch 3/5, the removal of -follow that I
> suggest in patch 4/5, and I would like to re-instate the --sysroot check in
> patch 2/5, but that's it.

What do you think about moving the sysroot check to a helper function like I
propose in this series ? (Which needs to be rebased after ThomasDS's series as well)

http://patchwork.ozlabs.org/patch/576578/
http://patchwork.ozlabs.org/patch/576580/

Thoughts ?

Best regards,
Romain

> 
>  ThomasDS, will you respin or do we apply and make changes afterwards?
> 
> 
>  Regards,
>  Arnout

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-03-27 20:52   ` Romain Naour
@ 2016-03-27 23:08     ` Arnout Vandecappelle
  0 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 23:08 UTC (permalink / raw)
  To: buildroot

On 03/27/16 22:52, Romain Naour wrote:
> Hello Arnout, ThomasDS, All,
>
> Le 27/03/2016 22:39, Arnout Vandecappelle a ?crit :
>> On 02/12/16 20:20, Thomas De Schampheleire wrote:
>>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>>
>>> As discussed on the Buildroot developer days, Buildroot installs some libraries
>>> in a different location in target than in staging. This is specifically seen for
>>> libstdc++ and libatomic.
>>>
>>> This patch series tackles that problem and performs related cleanup.
>>>
>>>
>>>
>>> Thomas De Schampheleire (5):
>>>     toolchain-external: blackfin: install FDPIC libraries also to staging
>>>     toolchain-external: remove unused calculation of ARCH_SUBDIR
>>>     toolchain-external: extract installation of gdbserver to separate
>>>       define
>>>     toolchain-external: align library locations in target and staging dir
>>>     toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>>>
>>>    package/glibc/glibc.mk                             |  2 +-
>>>    toolchain/helpers.mk                               | 57 ++---------------
>>>    toolchain/toolchain-external/Config.in             |  3 +-
>>>    toolchain/toolchain-external/toolchain-external.mk | 71 ++++++++++------------
>>>    4 files changed, 40 insertions(+), 93 deletions(-)
>>>
>>
>>   I've also done a review and a test of the entire series. There is a bit of
>> reworking suggested by Romain in patch 3/5, the removal of -follow that I
>> suggest in patch 4/5, and I would like to re-instate the --sysroot check in
>> patch 2/5, but that's it.
>
> What do you think about moving the sysroot check to a helper function like I
> propose in this series ? (Which needs to be rebased after ThomasDS's series as well)

  That's a good solution, indeed. Actually, I had already applied those patches 
and missed that the check was now still done in the configure step but just as 
part of check_unusable_toolchain.

  Regards,
  Arnout

>
> http://patchwork.ozlabs.org/patch/576578/
> http://patchwork.ozlabs.org/patch/576580/
>
> Thoughts ?
>
> Best regards,
> Romain
>
>>
>>   ThomasDS, will you respin or do we apply and make changes afterwards?
>>
>>
>>   Regards,
>>   Arnout
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR
  2016-03-27 20:34   ` Arnout Vandecappelle
@ 2016-03-27 23:10     ` Arnout Vandecappelle
  0 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 23:10 UTC (permalink / raw)
  To: buildroot

On 03/27/16 22:34, Arnout Vandecappelle wrote:
>   I'm sorry, I still have comments...
>
> On 02/12/16 20:20, Thomas De Schampheleire wrote:
>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> In TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS, ARCH_SUBDIR is calculated but not
>> used, and can thus be removed. Since SYSROOT_DIR is only used for the
>> calculation of ARCH_SUBDIR, it can be removed too.
>>
>> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>> ---
>>   toolchain/toolchain-external/toolchain-external.mk | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/toolchain/toolchain-external/toolchain-external.mk
>> b/toolchain/toolchain-external/toolchain-external.mk
>> index ffdee49..9d88158 100644
>> --- a/toolchain/toolchain-external/toolchain-external.mk
>> +++ b/toolchain/toolchain-external/toolchain-external.mk
>> @@ -587,12 +587,7 @@ endef
>>   #                       to the target filesystem.
>>
>>   define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>> -    $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))"
>> ; \
>> -    if test -z "$${SYSROOT_DIR}" ; then \
>> -        @echo "External toolchain doesn't support --sysroot. Cannot use." ; \
>
>   This was the only place where we gave that error message, so it should be kept.
>
>   That said, it probably wouldn't have shown anyway, because we would already
> error out with an incomprehensible error message in the configure step. Bottom
> line: move it to the configure step first.

  As discussed with Romain, please disregard this comment, the check is indeed 
still there in the configure step.

>
>   Otherwise, it looks good however. So, since it anyway didn't work properly
> before, I'll already give this patch my
>
> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  So this clearly still stands.

  Regards,
  Arnout

>
>   Regards,
>   Arnout
>
>> -        exit 1 ; \
>> -    fi ; \
>> -    ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)
>> $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>> +    $(Q)ARCH_SYSROOT_DIR="$(call
>> toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"
>> ; \
>>       ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC)
>> $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>>       SUPPORT_LIB_DIR="" ; \
>>       if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ;
>> then \
>> @@ -601,7 +596,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>>               SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r
>> -e 's:libstdc\+\+\.a::'` ; \
>>           fi ; \
>>       fi ; \
>> -    ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e
>> "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
>>       if test -z "$(BR2_STATIC_LIBS)" ; then \
>>           $(call MESSAGE,"Copying external toolchain libraries to target...") ; \
>>           for libs in $(LIB_EXTERNAL_LIBS); do \
>>
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-03-27 20:39 ` Arnout Vandecappelle
  2016-03-27 20:52   ` Romain Naour
@ 2016-03-29 14:21   ` Thomas De Schampheleire
  2016-03-29 14:33     ` Arnout Vandecappelle
  1 sibling, 1 reply; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-03-29 14:21 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On Sun, Mar 27, 2016 at 10:39 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 02/12/16 20:20, Thomas De Schampheleire wrote:
>>
>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> As discussed on the Buildroot developer days, Buildroot installs some
>> libraries
>> in a different location in target than in staging. This is specifically
>> seen for
>> libstdc++ and libatomic.
>>
>> This patch series tackles that problem and performs related cleanup.
>>
>>
>>
>> Thomas De Schampheleire (5):
>>    toolchain-external: blackfin: install FDPIC libraries also to staging
>>    toolchain-external: remove unused calculation of ARCH_SUBDIR
>>    toolchain-external: extract installation of gdbserver to separate
>>      define
>>    toolchain-external: align library locations in target and staging dir
>>    toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>>
>>   package/glibc/glibc.mk                             |  2 +-
>>   toolchain/helpers.mk                               | 57
>> ++---------------
>>   toolchain/toolchain-external/Config.in             |  3 +-
>>   toolchain/toolchain-external/toolchain-external.mk | 71
>> ++++++++++------------
>>   4 files changed, 40 insertions(+), 93 deletions(-)
>>
>
>  I've also done a review and a test of the entire series. There is a bit of
> reworking suggested by Romain in patch 3/5, the removal of -follow that I
> suggest in patch 4/5, and I would like to re-instate the --sysroot check in
> patch 2/5, but that's it.
>
>  ThomasDS, will you respin or do we apply and make changes afterwards?

I think it makes sense to respin to keep history clean, unless you
prefer to apply first and deblock Romain. That is also fine by me. I
just need some time to do the respin and retest.

Thanks for the review both you and Romain, I really appreciate it.

/Thomas

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-03-29 14:21   ` Thomas De Schampheleire
@ 2016-03-29 14:33     ` Arnout Vandecappelle
  0 siblings, 0 replies; 33+ messages in thread
From: Arnout Vandecappelle @ 2016-03-29 14:33 UTC (permalink / raw)
  To: buildroot



On 03/29/16 16:21, Thomas De Schampheleire wrote:
> Hi Arnout,
>
> On Sun, Mar 27, 2016 at 10:39 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
[snip]
>>   I've also done a review and a test of the entire series. There is a bit of
>> reworking suggested by Romain in patch 3/5, the removal of -follow that I
>> suggest in patch 4/5, and I would like to re-instate the --sysroot check in
>> patch 2/5, but that's it.
>>
>>   ThomasDS, will you respin or do we apply and make changes afterwards?
>
> I think it makes sense to respin to keep history clean, unless you
> prefer to apply first and deblock Romain. That is also fine by me. I
> just need some time to do the respin and retest.

  No, better if you do the respin. It's not going to take you months to retest, 
right?


> Thanks for the review both you and Romain, I really appreciate it.

  You're welcome. It was actually a lot less work than I feared.

  Regards,
  Arnout

-- 
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR
  2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
  2016-03-22 21:53   ` Romain Naour
  2016-03-27 20:34   ` Arnout Vandecappelle
@ 2016-04-21 21:30   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-21 21:30 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:23 +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> In TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS, ARCH_SUBDIR is calculated but not
> used, and can thus be removed. Since SYSROOT_DIR is only used for the
> calculation of ARCH_SUBDIR, it can be removed too.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/toolchain-external.mk | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging
  2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
  2016-03-22 21:48   ` Romain Naour
  2016-03-27 16:20   ` Arnout Vandecappelle
@ 2016-04-25 21:00   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:00 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:22 +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> For external Blackfin toolchains with BR2_BFIN_INSTALL_FDPIC_SHARED set,
> the FDPIC shared libraries are currently only copied to the target
> directory, not to staging.
> 
> For debugging purposes, an unstripped copy in staging is necessary.
> Moreover, this change will simplify a subsequent change that lines up the
> location of shared libraries between target and staging directories.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define
  2016-02-12 19:20 ` [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define Thomas De Schampheleire
  2016-03-22 22:04   ` Romain Naour
@ 2016-04-25 21:02   ` Thomas Petazzoni
  1 sibling, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:02 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:24 +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> The installation of the gdbserver binary has no relation to the installation
> of the target libraries. Moving it to a separate define improves the
> understandability of the code and makes later refactoring easier.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

I've done the following changes:

    [Thomas:
     - move the BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY condition as a make
       condition rather than a shell condition, as suggested by Romain
       Naour.
     - rename the TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER variable to
       TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER as suggested by Arnout.]

and applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
  2016-03-22 22:53   ` Romain Naour
  2016-03-27 20:34   ` Arnout Vandecappelle
@ 2016-04-25 21:08   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:08 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:25 +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> The toolchain-external logic is roughly:
> - populate the staging dir by rsyncing the entire ${ARCH_LIB_DIR} and
>   usr/${ARCH_LIB_DIR} from sysroot.
> - populate the target dir by explictly copying some libraries from sysroot
>   into target/lib and some other libraries in target/usr/lib, the split
>   being hardcoded into buildroot regardless of the location in the sysroot.
> 
> This means that a library libfoo could be located in:
>   staging/lib/libfoo.so
>   target/usr/lib/libfoo.so
> 
> When debugging an application that links against this library, gdb will
> fruitlessly search for 'usr/lib/libfoo.so' in staging, and then suggest to
> use 'set solib-search-path' which is a hack, really.
> 
> To solve the problem, we need to make sure that libraries from the toolchain
> are installed in the same relative location in staging and target.
> Achieve this by:
> - replacing the convoluted search for libraries using for+find in sysroot
>   with a simple find in staging.
> - determining DESTDIR for each library individually based on the location in
>   staging.
> - treating LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS equivalently
> 
> These changes also allow for the removal of most arguments to
> copy_toolchain_lib_root in the method itself and their callers.
> 
> Test procedure:
> - set configuration for a given toolchain
> - make clean toolchain
> - find output/target | sort > /tmp/out-before
> - apply patch
> - make clean toolchain
> - find output/target | sort > /tmp/out-after
> - diff -u /tmp/out-before /tmp/out-after
> 
> The only changes should be some libraries moving from lib to usr/lib or vice
> versa. Notable examples being libstdc++ and libatomic.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  package/glibc/glibc.mk                             |  2 +-
>  toolchain/helpers.mk                               | 57 ++--------------------
>  toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
>  3 files changed, 15 insertions(+), 83 deletions(-)

I've made a few changes:

    [Thomas:
     - use -L instead of -follow in the find invocation, as suggested by
       Arnout.
     - move the BR2_STATIC_LIBS condition as a make condition rather than
       a shell condition, as suggested by Arnout.]

And applied, thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-03-27 20:34   ` Arnout Vandecappelle
@ 2016-04-25 21:15     ` Thomas Petazzoni
  2016-04-26 11:32       ` Thomas De Schampheleire
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 27 Mar 2016 22:34:24 +0200, Arnout Vandecappelle wrote:

> >   package/glibc/glibc.mk                             |  2 +-
> >   toolchain/helpers.mk                               | 57 ++--------------------
> >   toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
> >   3 files changed, 15 insertions(+), 83 deletions(-)
> 
>   -65 net lines, that's the kind of patch I like!

Me too!


> > +	LIBPATHS=`find $(STAGING_DIR) -follow -name "$${LIB}" 2>/dev/null` ; \
> 
>   -follow is documented as depracated, use -L instead. But why do we need this? 

I've applied after changing -follow to -L. Note that the -L needs to be
*before* $(STAGING_DIR), since the difference between -follow and -L is
that -L only applies to the arguments that *follow* it. And since
$(STAGING_DIR) is a symbolic link, we need -L before it.

> I tried without it and it seems to work just the same. I also don't think the 
> error redirect is needed anymore (at least when the -follow is removed).

I've left it as-is for now, those can be handled later if needed.

> >   	for LIBPATH in $${LIBPATHS} ; do \
> > +		DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/,," | xargs dirname` ; \
> 
>   I would have written this as
> 
> DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/\(.*\)/[^/]*,\1,"` ; \
> 
> but perhaps I'm too much of a regexp lover :-)

Yeah, I think I find Thomas DS version easier to understand.

> > +		mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
> >   		while true ; do \
> 
>   I wonder if the loop is still needed now. As far as I can see, the idea of 
> this loop was to make sure that the library pointed to was also copied. But 
> since we now copy everything even if it is not in the expected lib path, it 
> shouldn't be needed anymore. Except if the library pointed to doesn't match the 
> glob pattern we are searching for... Anyway, that's something for a separate patch.

The library pointed to doesn't always match the glob pattern. Let's
take the case of uClibc. The pattern for the C library itself is:

	libc.so.*

But for uClibc, we have:

	libc.so.1 -> libuClibc-1.0.12.so

and libuClibc-1.0.12.so doesn't match libc.so.*.


> > +	$(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
> 
>   This can now be converted into a make condition instead of a shell condition, 
> which simplifies the logic even more. Well, actually, it could have been a make 
> condition from the start because all of the above doesn't do anything except set 
> some variables...

Before the previous patch, the installation of gdbserver was done as
part of the same variable, so that's why a make condition was not used.
But I've converted it to a make condition, now that it is possible.

Thanks for the review!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
  2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
  2016-03-22 22:58   ` Romain Naour
  2016-03-27 20:36   ` Arnout Vandecappelle
@ 2016-04-25 21:16   ` Thomas Petazzoni
  2 siblings, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:16 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:26 +0100, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> With the alignment of toolchain library location in target and staging,
> there is no need anymore for the distinction between LIB_EXTERNAL_LIBS and
> USR_LIB_EXTERNAL_LIBS. Unify them into TOOLCHAIN_EXTERNAL_LIBS.
> 
> Related, update the help text of
> BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  toolchain/toolchain-external/Config.in             |  3 +--
>  toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
>  2 files changed, 12 insertions(+), 13 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
                   ` (6 preceding siblings ...)
  2016-03-27 20:39 ` Arnout Vandecappelle
@ 2016-04-25 21:17 ` Thomas Petazzoni
  2016-04-26  7:50   ` Thomas De Schampheleire
  7 siblings, 1 reply; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-25 21:17 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 12 Feb 2016 20:20:21 +0100, Thomas De Schampheleire wrote:

> Thomas De Schampheleire (5):
>   toolchain-external: blackfin: install FDPIC libraries also to staging
>   toolchain-external: remove unused calculation of ARCH_SUBDIR
>   toolchain-external: extract installation of gdbserver to separate
>     define
>   toolchain-external: align library locations in target and staging dir
>   toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

The entire series is applied. I've also applied two additional cleanups
(see below). Thanks a lot for your work on this series. Not only it
makes the thing more functional, but it also makes the code simpler.
Definitely very good.

Thanks to Arnout and Romain for reviewing those not-so-simple changes!

commit ed2a15b79136db815e034aa9e5aa0635e91222ec
Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date:   Mon Apr 25 22:53:11 2016 +0200

    toolchain-external: remove useless shell continuations
    
    When a message with MESSAGE, we can print it as the first command of
    the command sequence, and in this case, we don't need to use a shell
    continuation.
    
    In one case, the call to MESSAGE is moved a few lines up in the
    sequence of commands.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

commit 12584c2c701fab1478da547dc85b69c3377e6d25
Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date:   Mon Apr 25 22:12:43 2016 +0200

    toolchain-external: rename Blackfin related special variables
    
    As suggested by Arnout, this commit renames:
    
     - TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC to
       TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FDPIC
    
     - TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT to
       TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FLAT
    
    Which makes it clear that those variables are installing libraries to
    the target, and make their naming more consistent with the naming of
    other variables in the file.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-04-25 21:17 ` Thomas Petazzoni
@ 2016-04-26  7:50   ` Thomas De Schampheleire
  2016-04-26  8:28     ` Thomas Petazzoni
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-04-26  7:50 UTC (permalink / raw)
  To: buildroot

On Mon, Apr 25, 2016 at 11:17 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Fri, 12 Feb 2016 20:20:21 +0100, Thomas De Schampheleire wrote:
>
>> Thomas De Schampheleire (5):
>>   toolchain-external: blackfin: install FDPIC libraries also to staging
>>   toolchain-external: remove unused calculation of ARCH_SUBDIR
>>   toolchain-external: extract installation of gdbserver to separate
>>     define
>>   toolchain-external: align library locations in target and staging dir
>>   toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS
>
> The entire series is applied. I've also applied two additional cleanups
> (see below). Thanks a lot for your work on this series. Not only it
> makes the thing more functional, but it also makes the code simpler.
> Definitely very good.
>
> Thanks to Arnout and Romain for reviewing those not-so-simple changes!


Thomas, Arnout, Romain: many thanks indeed for your review and apply
effort, I greatly appreciate it!
As you noticed, I did not yet have the time to apply the suggested
changes, but ThomasP took care of it now.

Thanks!
Thomas

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

* [Buildroot] [PATCH 0/5] Align library locations in target and staging
  2016-04-26  7:50   ` Thomas De Schampheleire
@ 2016-04-26  8:28     ` Thomas Petazzoni
  0 siblings, 0 replies; 33+ messages in thread
From: Thomas Petazzoni @ 2016-04-26  8:28 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 26 Apr 2016 09:50:08 +0200, Thomas De Schampheleire wrote:

> Thomas, Arnout, Romain: many thanks indeed for your review and apply
> effort, I greatly appreciate it!

You're welcome. Thanks for your patience!

> As you noticed, I did not yet have the time to apply the suggested
> changes, but ThomasP took care of it now.

There were some additional suggestions/questions from Arnout on PATCH
4/5. I replied to some of them, but there are still a few
questions/suggestions left.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir
  2016-04-25 21:15     ` Thomas Petazzoni
@ 2016-04-26 11:32       ` Thomas De Schampheleire
  0 siblings, 0 replies; 33+ messages in thread
From: Thomas De Schampheleire @ 2016-04-26 11:32 UTC (permalink / raw)
  To: buildroot

On Mon, Apr 25, 2016 at 11:15 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Sun, 27 Mar 2016 22:34:24 +0200, Arnout Vandecappelle wrote:
>
>> >   package/glibc/glibc.mk                             |  2 +-
>> >   toolchain/helpers.mk                               | 57 ++--------------------
>> >   toolchain/toolchain-external/toolchain-external.mk | 39 ++++-----------
>> >   3 files changed, 15 insertions(+), 83 deletions(-)
>>
>>   -65 net lines, that's the kind of patch I like!
>
> Me too!
>
>
>> > +   LIBPATHS=`find $(STAGING_DIR) -follow -name "$${LIB}" 2>/dev/null` ; \
>>
>>   -follow is documented as depracated, use -L instead. But why do we need this?
>
> I've applied after changing -follow to -L. Note that the -L needs to be
> *before* $(STAGING_DIR), since the difference between -follow and -L is
> that -L only applies to the arguments that *follow* it. And since
> $(STAGING_DIR) is a symbolic link, we need -L before it.

I was not aware about -L and agree that it is the right solution. I
used -follow just to make sure that STAGING_DIR is entered. It seems
to work without just because STAGING_DIR happens to be defined with a
trailing slash, in which case its contents are evaluated anyhow by
find. I considered this dependency too fragile and wanted it to work
even if someone optimizes away the trailing slash. Another solution
would be to add a trailing slash manually as $(STAGING_DIR)/ but -L is
much cleaner.

>
>> I tried without it and it seems to work just the same. I also don't think the
>> error redirect is needed anymore (at least when the -follow is removed).
>
> I've left it as-is for now, those can be handled later if needed.
>
>> >     for LIBPATH in $${LIBPATHS} ; do \
>> > +           DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/,," | xargs dirname` ; \
>>
>>   I would have written this as
>>
>> DESTDIR=`echo $${LIBPATH} | sed "s,^$(STAGING_DIR)/\(.*\)/[^/]*,\1,"` ; \
>>
>> but perhaps I'm too much of a regexp lover :-)
>
> Yeah, I think I find Thomas DS version easier to understand.
>
>> > +           mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
>> >             while true ; do \
>>
>>   I wonder if the loop is still needed now. As far as I can see, the idea of
>> this loop was to make sure that the library pointed to was also copied. But
>> since we now copy everything even if it is not in the expected lib path, it
>> shouldn't be needed anymore. Except if the library pointed to doesn't match the
>> glob pattern we are searching for... Anyway, that's something for a separate patch.
>
> The library pointed to doesn't always match the glob pattern. Let's
> take the case of uClibc. The pattern for the C library itself is:
>
>         libc.so.*
>
> But for uClibc, we have:
>
>         libc.so.1 -> libuClibc-1.0.12.so
>
> and libuClibc-1.0.12.so doesn't match libc.so.*.
>
>
>> > +   $(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \
>>
>>   This can now be converted into a make condition instead of a shell condition,
>> which simplifies the logic even more. Well, actually, it could have been a make
>> condition from the start because all of the above doesn't do anything except set
>> some variables...
>
> Before the previous patch, the installation of gdbserver was done as
> part of the same variable, so that's why a make condition was not used.
> But I've converted it to a make condition, now that it is possible.


I agree with all other responses raised by ThomasP. I don't see any
other open points, but please let me know if I missed something.

Thanks,
Thomas

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

end of thread, other threads:[~2016-04-26 11:32 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12 19:20 [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
2016-02-12 19:20 ` [Buildroot] [PATCH 1/5] toolchain-external: blackfin: install FDPIC libraries also to staging Thomas De Schampheleire
2016-03-22 21:48   ` Romain Naour
2016-03-27 16:20   ` Arnout Vandecappelle
2016-04-25 21:00   ` Thomas Petazzoni
2016-02-12 19:20 ` [Buildroot] [PATCH 2/5] toolchain-external: remove unused calculation of ARCH_SUBDIR Thomas De Schampheleire
2016-03-22 21:53   ` Romain Naour
2016-03-27 20:34   ` Arnout Vandecappelle
2016-03-27 23:10     ` Arnout Vandecappelle
2016-04-21 21:30   ` Thomas Petazzoni
2016-02-12 19:20 ` [Buildroot] [PATCH 3/5] toolchain-external: extract installation of gdbserver to separate define Thomas De Schampheleire
2016-03-22 22:04   ` Romain Naour
2016-03-27 16:43     ` Arnout Vandecappelle
2016-04-25 21:02   ` Thomas Petazzoni
2016-02-12 19:20 ` [Buildroot] [PATCH 4/5] toolchain-external: align library locations in target and staging dir Thomas De Schampheleire
2016-03-22 22:53   ` Romain Naour
2016-03-27 20:34   ` Arnout Vandecappelle
2016-04-25 21:15     ` Thomas Petazzoni
2016-04-26 11:32       ` Thomas De Schampheleire
2016-04-25 21:08   ` Thomas Petazzoni
2016-02-12 19:20 ` [Buildroot] [PATCH 5/5] toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS Thomas De Schampheleire
2016-03-22 22:58   ` Romain Naour
2016-03-27 20:36   ` Arnout Vandecappelle
2016-04-25 21:16   ` Thomas Petazzoni
2016-03-10  8:02 ` [Buildroot] [PATCH 0/5] Align library locations in target and staging Thomas De Schampheleire
2016-03-27 20:39 ` Arnout Vandecappelle
2016-03-27 20:52   ` Romain Naour
2016-03-27 23:08     ` Arnout Vandecappelle
2016-03-29 14:21   ` Thomas De Schampheleire
2016-03-29 14:33     ` Arnout Vandecappelle
2016-04-25 21:17 ` Thomas Petazzoni
2016-04-26  7:50   ` Thomas De Schampheleire
2016-04-26  8:28     ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.