[Buildroot] [git commit] support/scripts/dependencies.sh: improve g++ test to avoid misleading output

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Dec 8 21:32:21 UTC 2014

commit: http://git.buildroot.net/buildroot/commit/?id=d1607dc7dfc2c5397ff6b67ebd18d25c6184f650
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

When g++ is not installed, a misleading error message turns up because
of a bad combination of an unquoted shell variable and control flow.

 ~/buildroot$ make
 You may have to install 'g++' on your build machine
 /home/testuser/buildroot/support/dependencies/dependencies.sh: 136: [: -lt: unexpected operator

  - fixed commit log, as per the suggestion of Yann E. Morin.
  - don't change existing empty new lines, suggested by Yann.
  - use positive logic in the newly added test, suggested by Yann.]

Signed-off-by: Jens Stimpfle <debian at jstimpfle.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
 support/dependencies/dependencies.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index af5ce0e..44e212d 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -133,7 +133,9 @@ if [ ! -z "$CXXCOMPILER" ] ; then
 		echo "You may have to install 'g++' on your build machine"
+if [ -n "$CXXCOMPILER_VERSION" ] ; then
 	CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/\..*//g")
 	CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
 	if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then

More information about the buildroot mailing list