Boost C++ Libraries: Ticket #4667: boost-build: configuration of toolset gcc does not enforce requested versions and accepts non-existing commands https://svn.boost.org/trac10/ticket/4667 <p> When one configures toolset gcc with a non-existing command it is accepted and an error is not reported until compilation starts. </p> <p> When one configures toolset gcc with a version but no command (e.g. from the command line), boost build silently uses default command g++ without any version checking. </p> <p> Examples: </p> <p> a) </p> <ul><li>in ~/user-config.jam insert "using gcc : 4.1 : gcc-4.1-FORCE-ERROR ;" </li><li>run bjam --toolset=gcc-4.1 --debug-configuration -d+2 </li></ul><p> result: configuration of gcc-4.1 notices the not-found command but contuinues and later all compilations fail due to a "command not found" </p> <p> b) </p> <ul><li>add "using gcc : 9.9 ;" to ~/user-config.jam and run "bjam" </li></ul><p> OR </p> <ul><li>run bjam --toolset=gcc-9.9 --debug-configuration -d+2 </li></ul><p> result: auto configuration silently uses command "g++" but the version "9.9" is nontheless used in build paths tricking the user into thinking the requested compiler version was actually used. This is especially dangerous as any typo in the version on the command line does result in using the default compiler instead of a previously configured one. </p> <p> What should happen: </p> <ul><li>If only a version is given, boost build should try to deduce the correct command: </li></ul><p> "g++-VERSION" and "g++" with matching version should be considered in that order. </p> <ul><li>boost build should inform the user if the requested compiler command/version is not available and stop with an error. </li></ul><p> I have attached a patch that changes tools/gcc.jam into what I think it should look like. </p> <p> Note: Several mails on the mailing list suggest that a similar problem exists with toolset msvc and probably other toolsets, too. For example using toolset=msvc-8 instead of toolset=msvc-8.0 seems to use some default version instead of using 8.0 or failing. As msvc configuration code seems quite different, I have not looked further into this. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4667 Trac 1.4.3 mhassert@… Tue, 21 Sep 2010 13:37:01 GMT attachment set https://svn.boost.org/trac10/ticket/4667 https://svn.boost.org/trac10/ticket/4667 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">tools_gcc.jam.patch</span> </li> </ul> <p> Patch for configuration of toolset gcc </p> Ticket mhassert@… Tue, 21 Sep 2010 15:36:02 GMT attachment set https://svn.boost.org/trac10/ticket/4667 https://svn.boost.org/trac10/ticket/4667 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">tools_gcc.jam_v2.patch</span> </li> </ul> <p> Second version of patch. Fixed tool search on windows. </p> Ticket mhassert@… Tue, 21 Sep 2010 15:40:55 GMT <link>https://svn.boost.org/trac10/ticket/4667#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:1</guid> <description> <p> My first patch failed to find tools on windows. I attached a fixed version tools_gcc.jam_v2.patch. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Wed, 22 Sep 2010 05:54:59 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/4667#comment:2 https://svn.boost.org/trac10/ticket/4667#comment:2 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Patches</span> </li> </ul> Ticket Vladimir Prus Mon, 27 Sep 2010 16:05:52 GMT <link>https://svn.boost.org/trac10/ticket/4667#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/65633" title="Add verification on gcc version and command. Most importantly, if ...">[65633]</a>) Add verification on gcc version and command. </p> <p> Most importantly, if version is specified and command is not, check for g++-$version and failing that, check if g++ -dumpversion returns the version we've asked about. </p> <p> Patch from Moritz Hassert. Addresses <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4667" title="#4667: Patches: boost-build: configuration of toolset gcc does not enforce requested ... (closed: fixed)">#4667</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Mon, 27 Sep 2010 16:39:47 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4667#comment:4 https://svn.boost.org/trac10/ticket/4667#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/65640" title="Relax the check between user-specified version and the one from 'g++'. ...">[65640]</a>) Relax the check between user-specified version and the one from 'g++'. </p> <p> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4667" title="#4667: Patches: boost-build: configuration of toolset gcc does not enforce requested ... (closed: fixed)">#4667</a>. </p> Ticket Vladimir Prus Mon, 27 Sep 2010 16:42:58 GMT <link>https://svn.boost.org/trac10/ticket/4667#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:5</guid> <description> <p> Moritz, </p> <p> thank you for the patch. I've checked in your patch. While playing with it I've noticed that the comparison between user-provided version and gcc output is pretty strict. If you specify '4.4', then the comparison fails because "g++ -dumpversion" reports 4.4.5. Since gcc developers don't even include the minor version in the binary name, this seems too strict check so I've checked in a follow-up patch to relax it. </p> <p> Thanks again, Volodya </p> </description> <category>Ticket</category> </item> <item> <author>mhassert@…</author> <pubDate>Mon, 27 Sep 2010 17:27:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4667#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:6</guid> <description> <p> Hi Volodya, </p> <p> thanks for accepting the patch and fixing the version comparison. It was indeed too strict. </p> <p> Now that I looked at the code again, I see another problem: </p> <p> At the moment, specifying a command without a path and without ".exe" suffix does not work on Windows, because check-tool-aux() in common.jam auto-appends ".exe" only when the given command features a path. Omitting only one of path or .exe should to work. (I can't test right now.) </p> <p> This behavior of check-tool-aux() seems kind of strange to me. </p> <p> Passing the user specified command as the second argument in line 73 would work in case of omitted path but won't work for commands with a path. At least as far as I understand the rule find-tool(). </p> <p> Moritz </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Tue, 28 Sep 2010 06:31:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4667#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:7</guid> <description> <p> Moritz, </p> <p> I agree that logic is somewhat strange. We should first compose a list of suffixes to try, and then use on both branches. The reason we have two branches, I think, is to avoid doing GLOB when a directory is explicitly specified. I am not sure whether ther performance hit of GLOB is worth this trouble. </p> <p> Are you interested in fixing this, or shall I try next time I get to windows? </p> </description> <category>Ticket</category> </item> <item> <author>mhassert@…</author> <pubDate>Tue, 28 Sep 2010 15:17:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4667#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4667#comment:8</guid> <description> <p> Volodya, </p> <p> I'm afraid I'm not sure exactly how to fix it. A few thoughts / questions: </p> <ul><li>Why does find-tool use "path.glob" while check-tool-aux uses "GLOB"? Is there a difference? </li><li>What's the check-tool wrapper for? </li><li>Should check-tool-aux convert the path with path.native like find-tool does? </li><li>The rules find-tool() and check-tool-aux() should be merged somehow because it seems find-tool does basically the same as the else part of check-tool-aux. And if we allow .bat and .cmd in check-tool-aux it should be allowed in find-tool, too. </li></ul> </description> <category>Ticket</category> </item> </channel> </rss>