All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
@ 2013-10-12 10:14 Thomas Petazzoni
  2013-10-12 10:19 ` Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2013-10-12 10:14 UTC (permalink / raw
  To: buildroot

The Angstrom toolchains available at
http://www.angstrom-distribution.org/toolchains/ are not usable as
external toolchains in Buildroot, because they are not pure toolchains
with just the C library, but instead complete SDKs with many
cross-compiled libraries (Gtk, Qt, glib, neon, sqlite, X.org, and many
more, approximately 200 MB of libraries).

Buildroot cannot use such toolchains, and while this is documented in
our manual, some users still try to do this. Today, one such user came
on the IRC channel, reporting a build problem, which we started
investigating, only to realize after a long time that he was using an
Angstrom toolchain.

To avoid this problem in the future, we explicitly check if the
toolchain is from Angstrom by looking at the vendor part of the tuple
exposed by the toolchain: as soon as it is
<something>-angstrom-<something-else>, we reject the toolchain with an
explanation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/helpers.mk                               | 18 ++++++++++++++++++
 toolchain/toolchain-external/toolchain-external.mk |  1 +
 2 files changed, 19 insertions(+)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 95120cd..d81e561 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -324,3 +324,21 @@ check_cross_compiler_exists = \
 		echo "Cannot execute cross-compiler '$${__CROSS_CC}'" ; \
 		exit 1 ; \
 	fi
+
+#
+# Check for toolchains known to not work with Buildroot. To check for
+# Angstrom toolchains, we're taking the "Target: " line in the output
+# of gcc -v, and look at the vendor part of the tuple.
+#
+# $1: cross-gcc path
+#
+check_wrong_toolchain = \
+	__CROSS_CC=$(strip $1) ; \
+	vendor=`$${__CROSS_CC} -v 2>&1 | sed -n '/^Target/s/Target: [^-]*-\([^-]*\)-.*/\1/p'` ; \
+	if test $${vendor} = "angstrom" ; then \
+		echo "Angstrom toolchains are not pure toolchains: they contain" ; \
+		echo "many other libraries than just the C library, which makes" ; \
+		echo "them unsuitable as external toolchains for build systems" ; \
+		echo "such as Buildroot" ; \
+		exit 1 ; \
+	fi
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index b5b1ce7..102bcfd 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -371,6 +371,7 @@ endif
 # type of C library and all C library features.
 define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
 	$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
+	$(Q)$(call check_wrong_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
 	$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
 	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:(usr/)?lib(32|64)?/(.*/)?libc\.a::'` ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
-- 
1.8.1.2

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

* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
  2013-10-12 10:14 [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains Thomas Petazzoni
@ 2013-10-12 10:19 ` Yann E. MORIN
  2013-10-13  7:29 ` Thomas De Schampheleire
  2013-10-13 10:48 ` Eric Bénard
  2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2013-10-12 10:19 UTC (permalink / raw
  To: buildroot

Thomas, All,

On 2013-10-12 12:14 +0200, Thomas Petazzoni spake thusly:
> The Angstrom toolchains available at
> http://www.angstrom-distribution.org/toolchains/ are not usable as
> external toolchains in Buildroot, because they are not pure toolchains
> with just the C library, but instead complete SDKs with many
> cross-compiled libraries (Gtk, Qt, glib, neon, sqlite, X.org, and many
> more, approximately 200 MB of libraries).
> 
> Buildroot cannot use such toolchains, and while this is documented in
> our manual, some users still try to do this. Today, one such user came
> on the IRC channel, reporting a build problem, which we started
> investigating, only to realize after a long time that he was using an
> Angstrom toolchain.
> 
> To avoid this problem in the future, we explicitly check if the
> toolchain is from Angstrom by looking at the vendor part of the tuple
> exposed by the toolchain: as soon as it is
> <something>-angstrom-<something-else>, we reject the toolchain with an
> explanation.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

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

> ---
>  toolchain/helpers.mk                               | 18 ++++++++++++++++++
>  toolchain/toolchain-external/toolchain-external.mk |  1 +
>  2 files changed, 19 insertions(+)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 95120cd..d81e561 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -324,3 +324,21 @@ check_cross_compiler_exists = \
>  		echo "Cannot execute cross-compiler '$${__CROSS_CC}'" ; \
>  		exit 1 ; \
>  	fi
> +
> +#
> +# Check for toolchains known to not work with Buildroot. To check for
> +# Angstrom toolchains, we're taking the "Target: " line in the output
> +# of gcc -v, and look at the vendor part of the tuple.
> +#
> +# $1: cross-gcc path
> +#
> +check_wrong_toolchain = \
> +	__CROSS_CC=$(strip $1) ; \
> +	vendor=`$${__CROSS_CC} -v 2>&1 | sed -n '/^Target/s/Target: [^-]*-\([^-]*\)-.*/\1/p'` ; \
> +	if test $${vendor} = "angstrom" ; then \
> +		echo "Angstrom toolchains are not pure toolchains: they contain" ; \
> +		echo "many other libraries than just the C library, which makes" ; \
> +		echo "them unsuitable as external toolchains for build systems" ; \
> +		echo "such as Buildroot" ; \
> +		exit 1 ; \
> +	fi
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index b5b1ce7..102bcfd 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -371,6 +371,7 @@ endif
>  # type of C library and all C library features.
>  define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
>  	$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
> +	$(Q)$(call check_wrong_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
>  	$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
>  	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:(usr/)?lib(32|64)?/(.*/)?libc\.a::'` ; \
>  	if test -z "$${SYSROOT_DIR}" ; then \
> -- 
> 1.8.1.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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] 6+ messages in thread

* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
  2013-10-12 10:14 [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains Thomas Petazzoni
  2013-10-12 10:19 ` Yann E. MORIN
@ 2013-10-13  7:29 ` Thomas De Schampheleire
  2013-10-13 10:48 ` Eric Bénard
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas De Schampheleire @ 2013-10-13  7:29 UTC (permalink / raw
  To: buildroot

Hi Thomas,

On Sat, Oct 12, 2013 at 12:14 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> The Angstrom toolchains available at
> http://www.angstrom-distribution.org/toolchains/ are not usable as
> external toolchains in Buildroot, because they are not pure toolchains
> with just the C library, but instead complete SDKs with many
> cross-compiled libraries (Gtk, Qt, glib, neon, sqlite, X.org, and many
> more, approximately 200 MB of libraries).
>
> Buildroot cannot use such toolchains, and while this is documented in
> our manual, some users still try to do this. Today, one such user came
> on the IRC channel, reporting a build problem, which we started
> investigating, only to realize after a long time that he was using an
> Angstrom toolchain.
>
> To avoid this problem in the future, we explicitly check if the
> toolchain is from Angstrom by looking at the vendor part of the tuple
> exposed by the toolchain: as soon as it is
> <something>-angstrom-<something-else>, we reject the toolchain with an
> explanation.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  toolchain/helpers.mk                               | 18 ++++++++++++++++++
>  toolchain/toolchain-external/toolchain-external.mk |  1 +
>  2 files changed, 19 insertions(+)
>
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 95120cd..d81e561 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -324,3 +324,21 @@ check_cross_compiler_exists = \
>                 echo "Cannot execute cross-compiler '$${__CROSS_CC}'" ; \
>                 exit 1 ; \
>         fi
> +
> +#
> +# Check for toolchains known to not work with Buildroot. To check for

I think it is more common to say 'known not to work' (nit)

> +# Angstrom toolchains, we're taking the "Target: " line in the output
> +# of gcc -v, and look at the vendor part of the tuple.

Is there a reason why you're not using 'gcc -dumpmachine'?
This directly prints the tuple...

> +#
> +# $1: cross-gcc path
> +#
> +check_wrong_toolchain = \

This is just nitting about names, but I find 'wrong' odd here. What
about 'unusable'?

> +       __CROSS_CC=$(strip $1) ; \
> +       vendor=`$${__CROSS_CC} -v 2>&1 | sed -n '/^Target/s/Target: [^-]*-\([^-]*\)-.*/\1/p'` ; \
> +       if test $${vendor} = "angstrom" ; then \

I think that you should put $${vendor}} in quotes here. Suppose it
returns an empty string for one reason or the other, then you'll get a
syntax failure.

> +               echo "Angstrom toolchains are not pure toolchains: they contain" ; \
> +               echo "many other libraries than just the C library, which makes" ; \
> +               echo "them unsuitable as external toolchains for build systems" ; \
> +               echo "such as Buildroot" ; \
> +               exit 1 ; \
> +       fi
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index b5b1ce7..102bcfd 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -371,6 +371,7 @@ endif
>  # type of C library and all C library features.
>  define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
>         $(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
> +       $(Q)$(call check_wrong_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
>         $(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
>         SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:(usr/)?lib(32|64)?/(.*/)?libc\.a::'` ; \
>         if test -z "$${SYSROOT_DIR}" ; then \


Best regards,
Thomas

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

* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
  2013-10-12 10:14 [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains Thomas Petazzoni
  2013-10-12 10:19 ` Yann E. MORIN
  2013-10-13  7:29 ` Thomas De Schampheleire
@ 2013-10-13 10:48 ` Eric Bénard
  2013-10-13 13:41   ` Thomas Petazzoni
  2 siblings, 1 reply; 6+ messages in thread
From: Eric Bénard @ 2013-10-13 10:48 UTC (permalink / raw
  To: buildroot

Hi Thomas,

Le Sat, 12 Oct 2013 12:14:42 +0200,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> To avoid this problem in the future, we explicitly check if the
> toolchain is from Angstrom by looking at the vendor part of the tuple
> exposed by the toolchain: as soon as it is
> <something>-angstrom-<something-else>, we reject the toolchain with an
> explanation.
> 
maybe you should also check for at least "oe" and "poky" as these are
the vendor part of toolchains generated with plain OE-Core or
Yocto/Poky.

Eric

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

* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
  2013-10-13 10:48 ` Eric Bénard
@ 2013-10-13 13:41   ` Thomas Petazzoni
  2013-10-13 13:50     ` Eric Bénard
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2013-10-13 13:41 UTC (permalink / raw
  To: buildroot

Dear Eric B?nard,

On Sun, 13 Oct 2013 12:48:03 +0200, Eric B?nard wrote:

> Le Sat, 12 Oct 2013 12:14:42 +0200,
> Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> > To avoid this problem in the future, we explicitly check if the
> > toolchain is from Angstrom by looking at the vendor part of the tuple
> > exposed by the toolchain: as soon as it is
> > <something>-angstrom-<something-else>, we reject the toolchain with an
> > explanation.
> > 
> maybe you should also check for at least "oe" and "poky" as these are
> the vendor part of toolchains generated with plain OE-Core or
> Yocto/Poky.

Hum, right. Are those available in the form of tarballs, like the
angstrom toolchain available at
http://www.angstrom-distribution.org/toolchains/ ? I know you can
generate such tarballs with OE or Yocto, but unless these tarballs are
available pre-built on the web, I guess it's pretty unlikely that such
toolchains get used as external toolchains in Buildroot.

Ideally, we would need to check if the toolchain is not a pure
toolchain, but it's quite hard to check. We would have to verify if the
toolchain does *not* have more than what it should have, but doing that
in an exhaustive way is quite difficult.

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

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

* [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains
  2013-10-13 13:41   ` Thomas Petazzoni
@ 2013-10-13 13:50     ` Eric Bénard
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Bénard @ 2013-10-13 13:50 UTC (permalink / raw
  To: buildroot

Le Sun, 13 Oct 2013 15:41:06 +0200,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> Dear Eric B?nard,
> 
> On Sun, 13 Oct 2013 12:48:03 +0200, Eric B?nard wrote:
> 
> > Le Sat, 12 Oct 2013 12:14:42 +0200,
> > Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> > > To avoid this problem in the future, we explicitly check if the
> > > toolchain is from Angstrom by looking at the vendor part of the tuple
> > > exposed by the toolchain: as soon as it is
> > > <something>-angstrom-<something-else>, we reject the toolchain with an
> > > explanation.
> > > 
> > maybe you should also check for at least "oe" and "poky" as these are
> > the vendor part of toolchains generated with plain OE-Core or
> > Yocto/Poky.
> 
> Hum, right. Are those available in the form of tarballs, like the
> angstrom toolchain available at
> http://www.angstrom-distribution.org/toolchains/ ? I know you can
> generate such tarballs with OE or Yocto, but unless these tarballs are
> available pre-built on the web, I guess it's pretty unlikely that such
> toolchains get used as external toolchains in Buildroot.
> 
http://downloads.yoctoproject.org/releases/yocto/yocto-1.4/toolchain/

Eric

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

end of thread, other threads:[~2013-10-13 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-12 10:14 [Buildroot] [PATCH] toolchain-external: add a specific check to avoid Angstrom toolchains Thomas Petazzoni
2013-10-12 10:19 ` Yann E. MORIN
2013-10-13  7:29 ` Thomas De Schampheleire
2013-10-13 10:48 ` Eric Bénard
2013-10-13 13:41   ` Thomas Petazzoni
2013-10-13 13:50     ` Eric Bénard

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.