All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2 v3] toolchain: misc fixes (branch yem/toolchain-fixes)
@ 2015-03-17 15:14 Yann E. MORIN
  2015-03-17 15:14 ` [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains Yann E. MORIN
  2015-03-17 15:14 ` [Buildroot] [PATCH 2/2 v3] toolchain: fix installing gconv libs with multi-arch toolchain Yann E. MORIN
  0 siblings, 2 replies; 4+ messages in thread
From: Yann E. MORIN @ 2015-03-17 15:14 UTC (permalink / raw)
  To: buildroot

Hello All!

This series introduces two fixes in the external toolchain handling:

  - reject "distro-class" toolchains, i.e. the  cross-oolchains packaged
    in Debian and its derivatives, since those toolchains are both
    non-relocatable and tainted with a lot of crap (i.e. non-libc
    libraries) which make them unfit for use by Buildroot;

  - try harder to find the gconv modules for those multi-arch
    toolchains, since there may be gconv modules for each variant, and
    thus would be located out-side the main sysroot.

Changes v2 -> v3:
  - update comment for distro-class toolchains  (Thomas, Arnout)
  - use TOOLCHAIN_EXTERNAL_PREFIX instead of asking gcc  (Thomas)


Regards,
Yann E. MORIN.


The following changes since commit 9b8481671e9d0c6abc90d669f99c6925eda86c96:

  package/dovecot: bump version to 2.2.16 (2015-03-17 13:03:02 +0100)

are available in the git repository at:

  git://git.busybox.net/~ymorin/git/buildroot yem/toolchain-fixes

for you to fetch changes up to 1d2730901d20f1f9bfcfde77883a385b49c73b00:

  toolchain: fix installing gconv libs with multi-arch toolchain (2015-03-17 15:04:23 +0100)

----------------------------------------------------------------
Yann E. MORIN (2):
      toolchain/external: do not accept distro-class toolchains
      toolchain: fix installing gconv libs with multi-arch toolchain

 toolchain/helpers.mk   |  8 ++++++++
 toolchain/toolchain.mk | 26 ++++++++++++++++++--------
 2 files changed, 26 insertions(+), 8 deletions(-)

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

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

* [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains
  2015-03-17 15:14 [Buildroot] [PATCH 0/2 v3] toolchain: misc fixes (branch yem/toolchain-fixes) Yann E. MORIN
@ 2015-03-17 15:14 ` Yann E. MORIN
  2015-04-04 15:03   ` Thomas Petazzoni
  2015-03-17 15:14 ` [Buildroot] [PATCH 2/2 v3] toolchain: fix installing gconv libs with multi-arch toolchain Yann E. MORIN
  1 sibling, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2015-03-17 15:14 UTC (permalink / raw)
  To: buildroot

Distro toolchains, i.ie. toolchains coing with distributions, will
almost invariably be unsuitable for use with Buildroot:
  - they are mostly non-relocatable;
  - their sysroot is tainted with a lot of extra libraries.

Especially, the toolchains coming with Ubuntu (really, all the Debian
familly of distros) are configured with --sysroot=/ which makes them
non-relocatable, and they already contain quite some libraries that
conflict (in any combination of version, API or ABI) with what Buildroot
wants to build (i.e. extra libraries, some not even present in
Buildroot...) but also their mere preence when Buildroot does not expect
them to be already built (so that a package would enable features when
it should not).

So, try to detect those toolchains and black-list them; inform the user
that the toolchain is unusable for the reasons mentioned above.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
Changes v1 -> v2:
  - update the comment to specify both non-relocatable and polution
    (Thomas and Arnout)
---
 toolchain/helpers.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 3121da4..3afb6d6 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -347,6 +347,14 @@ check_unusable_toolchain = \
 		echo "them unsuitable as external toolchains for build systems" ; \
 		echo "such as Buildroot." ; \
 		exit 1 ; \
+	fi; \
+	with_sysroot=`$${__CROSS_CC} -v 2>&1 |sed -r -e '/.* --with-sysroot=([^[:space:]]+)[[:space:]].*/!d; s//\1/'`; \
+	if test "$${with_sysroot}"  = "/" ; then \
+		echo "Distribution toolchains are unsuitable for use by Buildroot," ; \
+		echo "as they were configured in a way that makes them non-relocatable,"; \
+		echo "and contain a lot of pre-built libraries that would conflict with"; \
+		echo "the ones Buildroot wants to build."; \
+		exit 1; \
 	fi
 
 #
-- 
1.9.1

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

* [Buildroot] [PATCH 2/2 v3] toolchain: fix installing gconv libs with multi-arch toolchain
  2015-03-17 15:14 [Buildroot] [PATCH 0/2 v3] toolchain: misc fixes (branch yem/toolchain-fixes) Yann E. MORIN
  2015-03-17 15:14 ` [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains Yann E. MORIN
@ 2015-03-17 15:14 ` Yann E. MORIN
  1 sibling, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2015-03-17 15:14 UTC (permalink / raw)
  To: buildroot

For a multi-arch toolchain, gconv modules are in a sub-directory named
after the machine gcc targets. This is the case, for example, for the
Linaro ARM 2014.09 toolchain, which has the gconv modules in (relative
to the sysroot):
    /usr/lib/arm-linux-gnueabihf/gconv

while the Sourcery CodeBench ARM 2014.05 (non-multi-arch) has them in:
    /usr/lib/gconv

So, to catter for both cases, search both paths. We want to favour the
machine-specific gconv modules over potentially existing "generic" ones,
so we first search that (if it exists) and fallback to looking in the
generic location.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
Changes v2 -> v3:
  - use TOOLCHAIN_EXTERNAL_PREFIX instead of computing it again

Changes v1 -> v2:
  - also handle the case where the gconv modules list is specified

---
Notes: I'm not too happy about the use of "gcc -dumpmachine", but
that's the only solution I found that worked on my use-case. I tried
duplicating the ARCH_SUBDIR trick from toolchain-external, but that
did not work...
---
 toolchain/toolchain.mk | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk
index 3f9900b..0a35909 100644
--- a/toolchain/toolchain.mk
+++ b/toolchain/toolchain.mk
@@ -17,28 +17,38 @@ endif
 ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y)
 GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))
 define COPY_GCONV_LIBS
-	$(Q)if [ -z "$(GCONV_LIBS)" ]; then \
-		$(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/gconv/gconv-modules \
-				      $(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
-		$(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/gconv/*.so \
+	$(Q)found_gconv=no; \
+	for d in $(TOOLCHAIN_EXTERNAL_PREFIX) ''; do \
+		[ -d "$(STAGING_DIR)/usr/lib/$${d}/gconv" ] || continue; \
+		found_gconv=yes; \
+		break; \
+	done; \
+	if [ "$${found_gconv}" = "no" ]; then \
+		printf "Unable to find gconv modules\n" >&2; \
+		exit 1; \
+	fi; \
+	if [ -z "$(GCONV_LIBS)" ]; then \
+		$(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
+				      $(TARGET_DIR)/usr/lib/gconv/gconv-modules && \
+		$(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/$${d}/gconv/*.so \
 				   $(TARGET_DIR)/usr/lib/gconv \
 		|| exit 1; \
 	else \
 		for l in $(GCONV_LIBS); do \
-			$(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/gconv/$${l}.so \
+			$(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so \
 					      $(TARGET_DIR)/usr/lib/gconv/$${l}.so \
 			|| exit 1; \
-			$(TARGET_READELF) -d $(STAGING_DIR)/usr/lib/gconv/$${l}.so |\
+			$(TARGET_READELF) -d $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so |\
 			sort -u |\
 			sed -e '/.*(NEEDED).*\[\(.*\.so\)\]$$/!d; s//\1/;' |\
 			while read lib; do \
-				 $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/gconv/$${lib} \
+				 $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${lib} \
 						       $(TARGET_DIR)/usr/lib/gconv/$${lib} \
 				 || exit 1; \
 			done; \
 		done; \
 		./support/scripts/expunge-gconv-modules "$(GCONV_LIBS)" \
-			<$(STAGING_DIR)/usr/lib/gconv/gconv-modules \
+			<$(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
 			>$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
 	fi
 endef
-- 
1.9.1

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

* [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains
  2015-03-17 15:14 ` [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains Yann E. MORIN
@ 2015-04-04 15:03   ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2015-04-04 15:03 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Tue, 17 Mar 2015 16:14:55 +0100, Yann E. MORIN wrote:

> +	with_sysroot=`$${__CROSS_CC} -v 2>&1 |sed -r -e '/.* --with-sysroot=([^[:space:]]+)[[:space:]].*/!d; s//\1/'`; \

I found this sed expression a bit complicated, but maybe there's no
other choice. So I've applied this.

Thanks,

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

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

end of thread, other threads:[~2015-04-04 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 15:14 [Buildroot] [PATCH 0/2 v3] toolchain: misc fixes (branch yem/toolchain-fixes) Yann E. MORIN
2015-03-17 15:14 ` [Buildroot] [PATCH 1/2 v3] toolchain/external: do not accept distro-class toolchains Yann E. MORIN
2015-04-04 15:03   ` Thomas Petazzoni
2015-03-17 15:14 ` [Buildroot] [PATCH 2/2 v3] toolchain: fix installing gconv libs with multi-arch toolchain Yann E. MORIN

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.