Message ID | 20170309080136.4799-1-kris@youview.com |
---|---|
State | Accepted |
Headers | show |
Hello, On Thu, 9 Mar 2017 09:01:36 +0100, Krzysztof Konopko wrote: > Currently, `--version` option is used and later matched with a regex to get > the actual gcc version. There's a dedicated gcc option to do exactly that: > `-dumpversion`. > > Also `--version` may return a string customised by a vendor that provides > the toolchain, which makes the current regex approach error prone. In > fact, this situation has been seen with a real customised toolchain. > > Signed-off-by: Krzysztof Konopko <kris@youview.com> > Signed-off-by: Tomasz Szkutkowski <tomasz.szkutkowski@youview.com> > --- > toolchain/helpers.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to master, thanks. I was worried that -dumpversion might have been a recent gcc option, but I found it in gcc 3.4 documentation, so we're good. Thanks a lot! Thomas
Hello, On Thu, 9 Mar 2017 21:27:54 +0100, Thomas Petazzoni wrote: > On Thu, 9 Mar 2017 09:01:36 +0100, Krzysztof Konopko wrote: > > Currently, `--version` option is used and later matched with a regex to get > > the actual gcc version. There's a dedicated gcc option to do exactly that: > > `-dumpversion`. > > > > Also `--version` may return a string customised by a vendor that provides > > the toolchain, which makes the current regex approach error prone. In > > fact, this situation has been seen with a real customised toolchain. > > > > Signed-off-by: Krzysztof Konopko <kris@youview.com> > > Signed-off-by: Tomasz Szkutkowski <tomasz.szkutkowski@youview.com> > > --- > > toolchain/helpers.mk | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Applied to master, thanks. I was worried that -dumpversion might have > been a recent gcc option, but I found it in gcc 3.4 documentation, so > we're good. Peter: this commit might also be useful on the LTS, it allows the external toolchain code to be more compatible with different toolchains. Of course, you might want to wait a few days to see if we get some feedback after it has been applied on master. Thomas
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes: Hi, >> Applied to master, thanks. I was worried that -dumpversion might have >> been a recent gcc option, but I found it in gcc 3.4 documentation, so >> we're good. > Peter: this commit might also be useful on the LTS, it allows the > external toolchain code to be more compatible with different > toolchains. Of course, you might want to wait a few days to see if we > get some feedback after it has been applied on master. Yes, I've flagged it locally. I'll apply it this weekend if nothing blows up in the autobuilders.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes: > Hello, > On Thu, 9 Mar 2017 21:27:54 +0100, Thomas Petazzoni wrote: >> On Thu, 9 Mar 2017 09:01:36 +0100, Krzysztof Konopko wrote: >> > Currently, `--version` option is used and later matched with a regex to get >> > the actual gcc version. There's a dedicated gcc option to do exactly that: >> > `-dumpversion`. >> > >> > Also `--version` may return a string customised by a vendor that provides >> > the toolchain, which makes the current regex approach error prone. In >> > fact, this situation has been seen with a real customised toolchain. >> > >> > Signed-off-by: Krzysztof Konopko <kris@youview.com> >> > Signed-off-by: Tomasz Szkutkowski <tomasz.szkutkowski@youview.com> >> > --- >> > toolchain/helpers.mk | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> >> Applied to master, thanks. I was worried that -dumpversion might have >> been a recent gcc option, but I found it in gcc 3.4 documentation, so >> we're good. > Peter: this commit might also be useful on the LTS, it allows the > external toolchain code to be more compatible with different > toolchains. Of course, you might want to wait a few days to see if we > get some feedback after it has been applied on master. Looks ok to me, so committed to 2017.02.x, thanks.
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 6f8723079..6044b7e5f 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -148,7 +148,7 @@ check_gcc_version = \ if [ -z "$${expected_version}" ]; then \ exit 0 ; \ fi; \ - real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/;'` ; \ + real_version=`$(1) -dumpversion` ; \ if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \ printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \ "$${expected_version}" "$${real_version}" ; \