[Fwd: [1.34.0 beta] GCC toolset version/flavor detection patch. (attn Thomas Witt)]

Volodya, can you have a look at this. I am inclined to put it in RC_1_34_0 if you think it's OK. Thomas -------- Original Message -------- Subject: [1.34.0 beta] GCC toolset version/flavor detection patch. (attn Thomas Witt) Date: Wed, 02 May 2007 22:25:39 -0500 From: Rene Rivera <grafikrobot@gmail.com> Reply-To: boost@lists.boost.org Organization: Redshift Software, Inc. To: boost@lists.boost.org Newsgroups: gmane.comp.lib.boost.devel The problem: Boost.Build currently uses "gcc --version" and some parsing of that to autodetect the version and flavor (only mingw is relevant so far). But the output of that command is extremely variable. A user tried doing a "bjam --toolset=gcc install" with a more mainline MinGW 4.1.2 build and got errors. I tried the same, and although I didn't get errors, I got both bad version number and strange directory names. The solution: Change Boost.Build to use "gcc -dumpversion" and "gcc -dumpmachine". Before I was reticent to make such a change because according to the public GCC docs it's only there on versions 3.1 onward. But Antonio Fiuman, from the #boost channel, found it was implemented as far back as version 2.8.1. So I'm suggesting we make the following change to fix the above problem: Index: tools/build/v2/tools/gcc.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v retrieving revision 1.89 diff -u -r1.89 gcc.jam --- tools/build/v2/tools/gcc.jam 3 Apr 2007 17:10:53 -0000 1.89 +++ tools/build/v2/tools/gcc.jam 3 May 2007 02:48:10 -0000 @@ -81,10 +81,11 @@ # The 'command' variable can have multiple elements. When calling # the SHELL builtin we need a single string. local command-string = $(command:J=" ") ; - local command-info = [ MATCH "^[^ ]+[ ]+[^ ]+[ ]+([^ ]+)[^(]*[(]?([^)]*)" - : [ SHELL "$(command-string) --version" ] ] ; - version ?= $(command-info[1]) ; - switch $(command-info[2]:L) + local machine = [ MATCH "^([^ ]+)" + : [ SHELL "$(command-string) -dumpmachine" ] ] ; + version ?= [ MATCH "^([0-9.]+)" + : [ SHELL "$(command-string) -dumpversion" ] ] ; + switch $(machine:L) { case *mingw* : flavor ?= mingw ; } =================================================================== NOTE: Even though this problem only showed up on the MinGW GCC it is likely not confined to MinGW, nor Windows. The patch is tested with MinGW 3.4.5, MinGW 4.1.2, and GCC 4.1.2 on Ubuntu Linux. OK to commit, to HEAD and RC_1_34_0? -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost -- Thomas Witt witt@acm.org

Thomas Witt wrote:
Volodya,
can you have a look at this. I am inclined to put it in RC_1_34_0 if you think it's OK.
......
Index: tools/build/v2/tools/gcc.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v retrieving revision 1.89 diff -u -r1.89 gcc.jam --- tools/build/v2/tools/gcc.jam 3 Apr 2007 17:10:53 -0000 1.89 +++ tools/build/v2/tools/gcc.jam 3 May 2007 02:48:10 -0000 @@ -81,10 +81,11 @@ # The 'command' variable can have multiple elements. When # calling the SHELL builtin we need a single string. local command-string = $(command:J=" ") ; - local command-info = [ MATCH "^[^ ]+[ ]+[^ ]+[ ]+([^ ]+)[^(]*[(]?([^)]*)" - : [ SHELL "$(command-string) --version" ] ] ; - version ?= $(command-info[1]) ; - switch $(command-info[2]:L) + local machine = [ MATCH "^([^ ]+)" + : [ SHELL "$(command-string) -dumpmachine" ] ] ; + version ?= [ MATCH "^([0-9.]+)" + : [ SHELL "$(command-string) -dumpversion" ] ] ; + switch $(machine:L) { case *mingw* : flavor ?= mingw ; }
This change appears to be safe to me. - Volodya
participants (2)
-
Thomas Witt
-
Vladimir Prus