Skip to contentSkip to conversation

toolchain/external: use -dumpversion to check gcc version

PATCH New Krzysztof Konopko 3 participants 5 messages Mar 9, 2017 – Mar 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain/external: use -dumpversion to check gcc version

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.

---
 toolchain/helpers.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/helpers.mk +1 -1
index 6f8723079..6044b7e5f 100644
@@ -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}" ; \

--
2.11.0

This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at http://www.youview.com

#1 lore raw

PATCH 1/1 toolchain/external: use -dumpversion to check gcc version

Hello,

Quoted 8 lines · Krzysztof Konopko

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.

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

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

PATCH 1/1 toolchain/external: use -dumpversion to check gcc version

Hello,

Quoted 15 lines · Thomas Petazzoni
Quoted 8 lines · Krzysztof Konopko

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.

Quoted 5 lines
---
 toolchain/helpers.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)  
Quoted 3 lines

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

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

PATCH 1/1 toolchain/external: use -dumpversion to check gcc version

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 3 lines

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.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 toolchain/external: use -dumpversion to check gcc version

In reply to Thomas Petazzoni
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 15 lines · Thomas Petazzoni
Quoted 13 lines · Krzysztof Konopko

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.

---
 toolchain/helpers.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)  
Quoted 8 lines
Quoted 3 lines

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.

Signature · 1 line
Bye, Peter Korsgaard