Bug 286384 - valgrind 3.7.0: configure fails "checking for a supported version of gcc" when compiler is called x86_64-pc-linux-gnu-gcc
Summary: valgrind 3.7.0: configure fails "checking for a supported version of gcc" whe...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.7.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 01:25 UTC by blueness
Modified: 2019-03-03 01:34 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix gcc regex to get version (581 bytes, patch)
2011-11-12 01:27 UTC, blueness
Details
Another approach (2.45 KB, patch)
2011-11-13 14:55 UTC, Wouter van Kesteren
Details
Patch matching braces. (1.28 KB, patch)
2011-11-17 16:28 UTC, Christophe Lyon
Details
Fix compiler version check (1.93 KB, patch)
2011-11-18 19:52 UTC, Bart Van Assche
Details

Note You need to log in before you can comment on or make changes to this bug.
Description blueness 2011-11-12 01:25:45 UTC
Version:           3.7.0
OS:                Linux

When building valgrind within a portage environment on a gentoo system, CC="x86_64-pc-linux-gnu-gcc" on amd64.  This causes the configure script to fail when parsing the compiler version using gcc_version=`${CC} --version | head -n 1 ... | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`  The regular expression matches the first 86 rather than the version number, eg 4.5.1.  This can be fixed by modifying the regular expression in configure.in to 's/.*\s\([.0-9]*\)$/\1/'.  Patch attached.

Reproducible: Always
Comment 1 blueness 2011-11-12 01:27:11 UTC
Created attachment 65536 [details]
Fix gcc regex to get version
Comment 2 Wouter van Kesteren 2011-11-13 14:55:57 UTC
Created attachment 65588 [details]
Another approach

I have also made a patch for this and i believe mine is a bit more fleshed out and better explained. So i figured id offer it up as an alternative.
Comment 3 Christophe Lyon 2011-11-17 16:28:46 UTC
Created attachment 65786 [details]
Patch matching braces.
Comment 4 Christophe Lyon 2011-11-17 16:30:20 UTC
The patch "another approach" does not work because it maches the version number which is between braces, which is provided by --pkgversion= of GCC's configure script. The provider of GCC can choose an arbitrary string here.

For instance, Code Sourcery's 2011.03 release prints:
arm-none-eabi-gcc (Sourcery G++ Lite 2011.03-42) 4.5.2

And the above mentioned patch returns 2011.03-42.

For GCC, the 'right' version number is the one after the string in braces.

For Clang, I don't know.

I propose the 3rd patch (matching braces)
Comment 5 Bart Van Assche 2011-11-18 19:52:26 UTC
Created attachment 65829 [details]
Fix compiler version check

Proposed patch - tested with gcc only. Should work for clang too.
Comment 6 Bart Van Assche 2011-11-22 18:42:55 UTC
Should be fixed by r12274 (trunk) - thanks for all the contributed patches.