Skip to contentSkip to conversation

Align library locations in target and staging

PATCH New Thomas De Schampheleire 4 participants 33 messages Feb 12, 2016 – Apr 26, 2016

lore
Share & tools
lore
#0 lore raw

cover Align library locations in target and staging

From: Thomas De Schampheleire <[email protected]>

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

PATCH 1/5 toolchain-external: blackfin: install FDPIC libraries also to staging

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
toolchain/toolchain-external/toolchain-external.mk +16 -0
index 6c3022a..ffdee49 100644
@@ -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))
+
Signature · 1 line
2.4.10
#2 lore raw

PATCH 1/5 toolchain-external: blackfin: install FDPIC libraries also to staging

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 11 lines

From: Thomas De Schampheleire <[email protected]>

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.

Best regards,
Romain

Quoted 43 lines
---
 toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
toolchain/toolchain-external/toolchain-external.mk +16 -0
index 6c3022a..ffdee49 100644
@@ -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))
+
#3 lore raw

PATCH 1/5 toolchain-external: blackfin: install FDPIC libraries also to staging

In reply to Thomas De Schampheleire
Quoted 11 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

Quick build-test done.

Regards,
Arnout

Quoted 43 lines
---
  toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
toolchain/toolchain-external/toolchain-external.mk +16 -0
index 6c3022a..ffdee49 100644
@@ -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))
+
Signature · 6 lines
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
#4 lore raw

PATCH 1/5 toolchain-external: blackfin: install FDPIC libraries also to staging

In reply to Thomas De Schampheleire

Hello,

Quoted 6 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

Quoted 8 lines

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 2/5 toolchain-external: remove unused calculation of ARCH_SUBDIR

In reply to Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
toolchain/toolchain-external/toolchain-external.mk +1 -7
index ffdee49..9d88158 100644
@@ -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 \
Signature · 1 line
2.4.10
#6 lore raw

PATCH 2/5 toolchain-external: remove unused calculation of ARCH_SUBDIR

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 7 lines

From: Thomas De Schampheleire <[email protected]>

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.

Best regards,
Romain

Quoted 31 lines
---
 toolchain/toolchain-external/toolchain-external.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
toolchain/toolchain-external/toolchain-external.mk +1 -7
index ffdee49..9d88158 100644
@@ -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 \
#7 lore raw

PATCH 2/5 toolchain-external: remove unused calculation of ARCH_SUBDIR

In reply to Thomas De Schampheleire

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

Quoted 16 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
  toolchain/toolchain-external/toolchain-external.mk | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index ffdee49..9d88158 100644

toolchain/toolchain-external/toolchain-external.mk endef · line 592

Quoted 6 lines
toolchain/toolchain-external/toolchain-external.mk +0 -3
@@ -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

Regards,
Arnout

Quoted 16 lines
toolchain/toolchain-external/toolchain-external.mk +1 -4
-		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 \
Signature · 6 lines
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
#8 lore raw

PATCH 2/5 toolchain-external: remove unused calculation of ARCH_SUBDIR

Quoted 30 lines · Arnout Vandecappelle

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

Quoted 17 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
  toolchain/toolchain-external/toolchain-external.mk | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index ffdee49..9d88158 100644

toolchain/toolchain-external/toolchain-external.mk endef · line 593

Quoted 7 lines
toolchain/toolchain-external/toolchain-external.mk +0 -3
@@ -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.

Quoted 3 lines

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.

Quoted 5 lines

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

So this clearly still stands.

Regards,
Arnout

Quoted 29 lines

Regards,
Arnout

Quoted 23 lines
toolchain/toolchain-external/toolchain-external.mk +1 -3
-        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 \

toolchain/toolchain-external/toolchain-external.mk +0 -2
@@ -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 \
Signature · 6 lines
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
#9 lore raw

PATCH 2/5 toolchain-external: remove unused calculation of ARCH_SUBDIR

In reply to Thomas De Schampheleire

Hello,

Quoted 10 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw

PATCH 3/5 toolchain-external: extract installation of gdbserver to separate define

In reply to Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +7 -1
index 9d88158..d5445e5 100644
@@ -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)
Signature · 1 line
2.4.10
#11 lore raw

PATCH 3/5 toolchain-external: extract installation of gdbserver to separate define

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 16 lines

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index 9d88158..d5445e5 100644

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS · line 609

Quoted 7 lines
toolchain/toolchain-external/toolchain-external.mk +3 -1
@@ -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
...

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS · line 613

Quoted 4 lines
toolchain/toolchain-external/toolchain-external.mk +3 -0
+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

Quoted 11 lines
toolchain/toolchain-external/toolchain-external.mk +1 -0
 		$(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)
#12 lore raw

PATCH 3/5 toolchain-external: extract installation of gdbserver to separate define

Quoted 30 lines · Romain Naour

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 16 lines

From: Thomas De Schampheleire <[email protected]>

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.

---
  toolchain/toolchain-external/toolchain-external.mk | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index 9d88158..d5445e5 100644

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS · line 609

Quoted 7 lines
toolchain/toolchain-external/toolchain-external.mk +3 -1
@@ -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 ?

Quoted 3 lines

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.

Quoted 11 lines

toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS · line 613

Quoted 5 lines
toolchain/toolchain-external/toolchain-external.mk +3 -0
+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

Quoted 9 lines

toolchain/toolchain-external/toolchain-external.mk endef · line 784

Quoted 9 lines
toolchain/toolchain-external/toolchain-external.mk +1 -0
  		$(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

Quoted 8 lines

toolchain/toolchain-external/toolchain-external.mk endef · line 785

Quoted 2 lines
toolchain/toolchain-external/toolchain-external.mk +0 -0
  	$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
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
#13 lore raw

PATCH 3/5 toolchain-external: extract installation of gdbserver to separate define

In reply to Thomas De Schampheleire

Hello,

Quoted 10 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#14 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

In reply to Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

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

package/glibc/glibc.mk +1 -1
index e60575f..bcec47f 100644
@@ -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
 
toolchain/helpers.mk +5 -52

67 lines not on this page · raw message

toolchain/toolchain-external/toolchain-external.mk +9 -30
index d5445e5..a333c32 100644
@@ -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
Signature · 1 line
2.4.10
#15 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

Hi Thomas, all,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 38 lines

From: Thomas De Schampheleire <[email protected]>

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

Quoted 2 lines

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

Best regards,
Romain

Quoted 161 lines
---
 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.

package/glibc/glibc.mk +1 -1
index e60575f..bcec47f 100644
@@ -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
 
toolchain/helpers.mk +5 -52
index ee878e8..d5dc16f 100644
@@ -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}` ; \
toolchain/toolchain-external/toolchain-external.mk +9 -30
index d5445e5..a333c32 100644
@@ -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
#16 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

In reply to Thomas De Schampheleire
Quoted 38 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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

Quoted 4 lines

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

Minor improvements below, but they could be separate patches.

Quoted 5 lines
---
  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!

Quoted 77 lines

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.

package/glibc/glibc.mk +1 -1
index e60575f..bcec47f 100644
@@ -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
 
toolchain/helpers.mk +2 -43
index ee878e8..d5dc16f 100644
@@ -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} \

toolchain/helpers.mk line 14

Quoted 10 lines
toolchain/helpers.mk +1 -9
-		$${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).

toolchain/helpers.mk line 16

Quoted 2 lines
toolchain/helpers.mk +1 -0
  	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 :-)

toolchain/helpers.mk line 18

Quoted 2 lines
toolchain/helpers.mk +1 -0
+		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.

Quoted 17 lines
toolchain/helpers.mk +0 -0
  			LIBNAME=`basename $${LIBPATH}`; \
  			LIBDIR=`dirname $${LIBPATH}` ; \
toolchain/toolchain-external/toolchain-external.mk +4 -1
index d5445e5..a333c32 100644
@@ -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))" ; \

toolchain/toolchain-external/toolchain-external.mk endef · line 594

Quoted 10 lines
toolchain/toolchain-external/toolchain-external.mk +1 -9
-	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

Quoted 36 lines
toolchain/toolchain-external/toolchain-external.mk +4 -20
  		$(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
Signature · 6 lines
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
#17 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

Hello,

Quoted 6 lines · Arnout Vandecappelle
Quoted 4 lines
  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!

Quoted 3 lines

toolchain/helpers.mk line 14

Quoted 1 line
toolchain/helpers.mk +1 -0
+	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.

Quoted 2 lines

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.

Quoted 8 lines

toolchain/helpers.mk line 16

Quoted 2 lines
  	for LIBPATH in $${LIBPATHS} ; do \
toolchain/helpers.mk +1 -0
+		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.

Quoted 8 lines

toolchain/helpers.mk line 18

Quoted 2 lines
toolchain/helpers.mk +1 -0
+		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.*.

Quoted 6 lines

toolchain/toolchain-external/toolchain-external.mk endef · line 594

Quoted 1 line
toolchain/toolchain-external/toolchain-external.mk +1 -0
+	$(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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#18 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

Quoted 14 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Arnout Vandecappelle
Quoted 4 lines
  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!

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 40 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 2 lines
    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.

Quoted 8 lines
Quoted 2 lines
+           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.*.

Quoted 2 lines
Quoted 1 line

+ $(Q)if test -z "$(BR2_STATIC_LIBS)" ; then \

Quoted 8 lines
Quoted 4 lines

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

#19 lore raw

PATCH 4/5 toolchain-external: align library locations in target and staging dir

In reply to Thomas De Schampheleire

Hello,

Quoted 41 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

Quoted 6 lines
---
 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#20 lore raw

PATCH 5/5 toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

In reply to Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

---
 toolchain/toolchain-external/Config.in             |  3 +--
 toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 13 deletions(-)
toolchain/toolchain-external/Config.in +1 -2
index 7ba3929..9d81a2e 100644
@@ -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
 
toolchain/toolchain-external/toolchain-external.mk +11 -11
index a333c32..bd1a807 100644
@@ -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
Signature · 1 line
2.4.10
#21 lore raw

PATCH 5/5 toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

Hi Thomas,

Le 12/02/2016 20:20, Thomas De Schampheleire a ?crit :

Quoted 9 lines

From: Thomas De Schampheleire <[email protected]>

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.

Best regards,
Romain

Quoted 86 lines
---
 toolchain/toolchain-external/Config.in             |  3 +--
 toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 13 deletions(-)
toolchain/toolchain-external/Config.in +1 -2
index 7ba3929..9d81a2e 100644
@@ -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
 
toolchain/toolchain-external/toolchain-external.mk +11 -11
index a333c32..bd1a807 100644
@@ -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
#22 lore raw

PATCH 5/5 toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

In reply to Thomas De Schampheleire
Quoted 10 lines · Thomas De Schampheleire

From: Thomas De Schampheleire<[email protected]>

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.

Regards,
Arnout

Quoted 4 lines
---
  toolchain/toolchain-external/Config.in             |  3 +--
  toolchain/toolchain-external/toolchain-external.mk | 22 +++++++++++-----------
  2 files changed, 12 insertions(+), 13 deletions(-)
Signature · 6 lines
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
#23 lore raw

PATCH 5/5 toolchain-external: unify LIB_EXTERNAL_LIBS and USR_LIB_EXTERNAL_LIBS

In reply to Thomas De Schampheleire

Hello,

Quoted 6 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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.

Quoted 8 lines

Related, update the help text of
BR2_TOOLCHAIN_EXTRA_TOOLCHAIN_EXTERNAL_LIBS.

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#24 lore raw

cover Align library locations in target and staging

In reply to Thomas De Schampheleire
Quoted 18 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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

Quoted 5 lines
 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

#25 lore raw

cover Align library locations in target and staging

In reply to Thomas De Schampheleire
Quoted 18 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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

Quoted 6 lines
  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

Signature · 6 lines
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
#26 lore raw

cover Align library locations in target and staging

Hello Arnout, ThomasDS, All,

Le 27/03/2016 22:39, Arnout Vandecappelle a ?crit :

Quoted 26 lines · Thomas De Schampheleire
Quoted 18 lines

From: Thomas De Schampheleire <[email protected]>

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

Quoted 6 lines
  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(-)
Quoted 4 lines

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

Quoted 6 lines

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

Regards,
Arnout

#27 lore raw

cover Align library locations in target and staging

Quoted 29 lines · Romain Naour

Hello Arnout, ThomasDS, All,

Le 27/03/2016 22:39, Arnout Vandecappelle a ?crit :

Quoted 26 lines · Thomas De Schampheleire
Quoted 24 lines

From: Thomas De Schampheleire <[email protected]>

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(-)
Quoted 7 lines
Quoted 4 lines

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

Quoted 17 lines

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

Thoughts ?

Best regards,
Romain

Quoted 6 lines

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

Regards,
Arnout

Signature · 6 lines
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
#28 lore raw

cover Align library locations in target and staging

In reply to Arnout Vandecappelle

Hi Arnout,

Quoted 31 lines · Arnout Vandecappelle
Quoted 21 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

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

Quoted 8 lines
  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(-)
Quoted 6 lines

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

#29 lore raw

cover Align library locations in target and staging

Quoted 3 lines · Thomas De Schampheleire

Hi Arnout,

On Sun, Mar 27, 2016 at 10:39 PM, Arnout Vandecappelle <[email protected]> wrote:

[snip]

Quoted 10 lines
Quoted 6 lines

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?

Quoted 1 line

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

Signature · 6 lines
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
#30 lore raw

cover Align library locations in target and staging

In reply to Thomas De Schampheleire

Hello,

Quoted 7 lines · Thomas De Schampheleire

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 <[email protected]>
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.

commit 12584c2c701fab1478da547dc85b69c3377e6d25

Author: Thomas Petazzoni <[email protected]>
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.

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#31 lore raw

cover Align library locations in target and staging

Quoted 12 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Thomas De Schampheleire

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

Quoted 6 lines

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

#32 lore raw

cover Align library locations in target and staging

Hello,

Quoted 2 lines · Thomas De Schampheleire

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

You're welcome. Thanks for your patience!

Quoted 2 lines

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

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