Valgrind – dynamic code analysis tool – part VI – configure: error: please use gcc >= 3.0 or clang >= 2.9

This post is trying to figure out the reason why configure of valgrind may report the error like this – configure: error: please use gcc >= 3.0 or clang >= 2.9 and the stupid workaround to make the building go thru.

5123 $as_echo_n “checking for a supported version of gcc… ” >&6; }
   5124
   5125 # Try to get the gcc version, sed-ing out some unexpected stuff
   5126 # that appears with the default gcc on OSX 10.6 and 10.7 respectively.
   5127 # Without this, the version number comes out as 686, 10 or 11 😦
   5128 #
   5129 # i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
   5130 # i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
   5131 #
   5132 gcc_version=`${CC} –version
   5133              | head -n 1
   5134              | $SED ‘s/i686-apple-darwin10//’
   5135              | $SED ‘s/i686-apple-darwin11//’
   5136              | $SED ‘s/^[^0-9]*([0-9.]*).*$/1/’`
   5137
   5138 is_clang=”notclang”
   5139 if test “x`${CC} –version | head -n 1 | $SED ‘s/(clang) version.*/1/’`” = “xclang” ; then
   5140    is_clang=”clang”
   5141 fi
   5142
   5143 case “${is_clang}-${gcc_version}” in
   5144      notclang-3.*)
   5145         { $as_echo “$as_me:${as_lineno-$LINENO}: result: ok (${gcc_version})” >&5
   5146 $as_echo “ok (${gcc_version})” >&6; }
   5147         ;;
   5148      notclang-4.*)
   5149         { $as_echo “$as_me:${as_lineno-$LINENO}: result: ok (${gcc_version})” >&5
   5150 $as_echo “ok (${gcc_version})” >&6; }
   5151         ;;
   5152      clang-2.9)
   5153         { $as_echo “$as_me:${as_lineno-$LINENO}: result: ok (clang-${gcc_version})” >&5
   5154 $as_echo “ok (clang-${gcc_version})” >&6; }
   5155         ;;
   5156      *)
   5157         { $as_echo “$as_me:${as_lineno-$LINENO}: result: no (${gcc_version})” >&5
   5158 $as_echo “no (${gcc_version})” >&6; }
   5159         as_fn_error “please use gcc >= 3.0 or clang >= 2.9” “$LINENO” 5
   5160         ;;
   5161 esac
   5162

Above red lines are the issued code in configure of valgrind (3.7.0). Generally, the sed line was trying to hunt for the first number as gcc’s version from command ‘gcc -version’. Whether it works or not depends on different distribution of ‘gcc’.

/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind: cat lx86bld.out3
x86_64-redhat-linux-gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind: cat lx86bld.out3 | head -n 1 | sed ‘s/i686-apple-darwin10//’ | sed ‘s/i686-apple-darwin11//’ | sed ‘s/^[^0-9]*([0-9.]*).*$/1/’
86
/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind

/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind: cat lx86bld.out4
i386-redhat-linux-gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind: cat lx86bld.out4 | head -n 1 | sed ‘s/i686-apple-darwin10//’ | sed ‘s/i686-apple-darwin11//’ | sed ‘s/^[
^0-9]*([0-9.]*).*$/1/’
386
/home_nbu/daveti/R2614/valgrind/sde/tpp/valgrind

[root@localhost ~]# gcc –version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost ~]# gcc –version | head -n 1 | sed ‘s/i686-apple-darwin10//’ | sed ‘s/i686-apple-darwin11//’ | sed ‘s/^[^0-9]*([0-9.]*).*$/1/’
4.1.2
[root@localhost ~]#

The stupid workaround would be commenting the gcc version checking code above, though we could think about a better sed line, like hunting for the first number after ‘(GCC)’.

About daveti

Interested in kernel hacking, compilers, machine learning and guitars.
This entry was posted in Static Code Analysis and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.