Boost C++ Libraries: Ticket #3630: building bjam with custom CFLAGS fails if $CFLAGS contains extra white space https://svn.boost.org/trac10/ticket/3630 <p> Steps to reproduce: </p> <p> cd boost_1_41_1_beta1/tools/jam/src/<br /> export CFLAGS="-O2 -pipe"<br /> export CC="x86_64-pc-linux-gnu-gcc"<br /> ./build.sh cc<br /> </p> <p> Output:<br /> [...]<br /> [COMPILE] bin.linuxx86_64/bjam<br /> x86_64-pc-linux-gnu-gcc: : No such file or directory<br /> expand.c: In function 'var_expand':<br /> expand.c:85: warning: field precision should have type 'int', but argument 2 has type 'long int'<br /> variable.c: In function 'var_string_to_file':<br /> variable.c:408: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result<br /> variable.c:409: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result<br /> </p> <blockquote> <p> "x86_64-pc-linux-gnu-gcc" -o bin.linuxx86_64/bjam "-DNDEBUG" "-DOPT_HEADER_CACHE_EXT" "-DOPT_GRAPH_DEBUG_EXT" "-DOPT_SEMAPHORE" "-DOPT_AT_FILES" "-DOPT_DEBUG_PROFILE" "-DOPT_FIX_TARGET_VARIABLES_EXT" "-DOPT_IMPROVED_PATIENCE_EXT" "-DYYSTACKSIZE=5000" "-O2" "" "-pipe" "-s" "-O" "command.c" "compile.c" "debug.c" "expand.c" "glob.c" "hash.c" "hcache.c" "headers.c" "hdrmacro.c" "jam.c" "jambase.c" "jamgram.c" "lists.c" "make.c" "make1.c" "mem.c" "newstr.c" "option.c" "output.c" "parse.c" "regexp.c" "rules.c" "scan.c" "search.c" "subst.c" "w32_getreg.c" "timestamp.c" "variable.c" "modules.c" "strings.c" "filesys.c" "builtins.c" "pwd.c" "class.c" "native.c" "modules/set.c" "modules/path.c" "modules/regex.c" "modules/property-set.c" "modules/sequence.c" "modules/order.c" "execunix.c" "fileunix.c" "pathunix.c"<br /> </p> </blockquote> <p> ...failed [COMPILE] bin.linuxx86_64/bjam...<br /> ...failed updating 1 target...<br /> </p> <p> What happens is that the extra white space gets converted into a "", which gcc doesn't like. There are bug reports on the gentoo bugzilla for boost 1.35 <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>, 1.39, 1.40 and it's present in 1.41.0_beta1. It was also reported that the problem occurs with LDFLAGS [1, comment 27].<br /> </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> <a class="ext-link" href="https://bugs.gentoo.org/show_bug.cgi?id=265402"><span class="icon">​</span>https://bugs.gentoo.org/show_bug.cgi?id=265402</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3630 Trac 1.4.3 ohnobinki@… Sun, 06 Dec 2009 02:07:14 GMT cc set https://svn.boost.org/trac10/ticket/3630#comment:1 https://svn.boost.org/trac10/ticket/3630#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">ohnobinki@…</span> added </li> </ul> Ticket ohnobinki@… Sun, 06 Dec 2009 07:13:27 GMT attachment set https://svn.boost.org/trac10/ticket/3630 https://svn.boost.org/trac10/ticket/3630 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-build-flags-unescape.patch</span> </li> </ul> <p> fixes compilation for &gt;=boost-build-0.39 for me </p> Ticket René Rivera Thu, 07 Jan 2010 03:10:01 GMT version, component, milestone changed; owner set https://svn.boost.org/trac10/ticket/3630#comment:2 https://svn.boost.org/trac10/ticket/3630#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">René Rivera</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost.Jam 3.1.16</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">bjam</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.41.0</span> → <span class="trac-field-new">Boost.Jam 3.1.18</span> </li> </ul> Ticket Vladimir Prus Sun, 10 Jan 2010 21:05:33 GMT owner, component changed https://svn.boost.org/trac10/ticket/3630#comment:3 https://svn.boost.org/trac10/ticket/3630#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">René Rivera</span> to <span class="trac-author">Vladimir Prus</span> </li> <li><strong>component</strong> <span class="trac-field-old">bjam</span> → <span class="trac-field-new">build</span> </li> </ul> Ticket René Rivera Thu, 04 Mar 2010 16:28:50 GMT owner, component changed https://svn.boost.org/trac10/ticket/3630#comment:4 https://svn.boost.org/trac10/ticket/3630#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Vladimir Prus</span> to <span class="trac-author">René Rivera</span> </li> <li><strong>component</strong> <span class="trac-field-old">build</span> → <span class="trac-field-new">bjam</span> </li> </ul> Ticket René Rivera Fri, 19 Mar 2010 15:04:50 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3630#comment:5 https://svn.boost.org/trac10/ticket/3630#comment:5 <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">worksforme</span> </li> </ul> <p> I can't seem to reproduce the problem on the latest bjam 3.1.18. Although I don't have access to a Gentoo system, so I'm only trying it on a MacOSX bash. I don't see the extra "" in CFLAGS when I force the cc toolset. </p> Ticket Sebastian Mingramm <s.mingramm@…> Mon, 22 Mar 2010 08:22:08 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/3630#comment:6 https://svn.boost.org/trac10/ticket/3630#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">worksforme</span> </li> </ul> <p> The problem is still there. For some reason the CFLAGS in my steps to reproduce don't contain extra white spaces. You need something like: </p> <p> export CFLAGS="-O2 -pipe " </p> <p> This happens with the bjam shipped with boost 1.42 on linux with bash 4.0.35 (older bash versions were affected too). </p> Ticket René Rivera Mon, 22 Mar 2010 15:26:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3630#comment:7 https://svn.boost.org/trac10/ticket/3630#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</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/60768" title="Fix possible problems when trailing or leading whitespace is added to ...">[60768]</a>) Fix possible problems when trailing or leading whitespace is added to the env vars used, for example CC and CFLAGS when using the cc toolset. Even though I can't get compilation to fail even with the extra whitespace during building it does seem to fail for some compilers that don't ignore the whitespace arguments. (Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3630" title="#3630: Bugs: building bjam with custom CFLAGS fails if $CFLAGS contains extra white ... (closed: fixed)">#3630</a>) </p> Ticket Sebastian Mingramm <s.mingramm@…> Mon, 22 Mar 2010 19:00:14 GMT <link>https://svn.boost.org/trac10/ticket/3630#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3630#comment:8</guid> <description> <p> The patch works, thank you. Could you please add LDFLAGS to list of checked variables? It's affected too. </p> </description> <category>Ticket</category> </item> <item> <author>Sebastian Mingramm <s.mingramm@…></author> <pubDate>Mon, 22 Mar 2010 19:04:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3630#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3630#comment:9</guid> <description> <p> Oh, I missed that we inject the user's LDFLAGS through the LIBS variable. That means LIBS needs to be in this list. Thank you. </p> </description> <category>Ticket</category> </item> <item> <author>ohnobinki@…</author> <pubDate>Tue, 20 Jul 2010 17:06:52 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/3630#comment:10 https://svn.boost.org/trac10/ticket/3630#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> I think that LIBS still needs to be fixed(?) </p> Ticket René Rivera Thu, 31 Mar 2011 00:58:00 GMT component changed https://svn.boost.org/trac10/ticket/3630#comment:11 https://svn.boost.org/trac10/ticket/3630#comment:11 <ul> <li><strong>component</strong> <span class="trac-field-old">bjam</span> → <span class="trac-field-new">build</span> </li> </ul> Ticket René Rivera Fri, 02 Jan 2015 16:22:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3630#comment:12 https://svn.boost.org/trac10/ticket/3630#comment:12 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Turns out this was <a class="ext-link" href="https://github.com/boostorg/build/commit/b372169a1ae367f040f4ada4b5a4ac37935e3aa6"><span class="icon">​</span>fixed</a> long ago. </p> Ticket