Boost C++ Libraries: Ticket #12356: Failed build for msvc 11.0 with global setup script in combination with rewrite option https://svn.boost.org/trac10/ticket/12356 <p> <strong>Problem:</strong> The compilation of Boost with the utilization of a global setup script, that should be cached in C:\Temp, results in the error: "error: rewriting setup script for the second time". By the way, this error would be only shown, if one adds the line: </p> <pre class="wiki">import Errors ; </pre><p> in front of the proper error line in the file msvc.jam. Nevertheless the error occurs. </p> <hr /> <p> <strong>Prerequisite:</strong> </p> <ul><li>user-config.jam: <pre class="wiki">using msvc : 11.0 : : &lt;setup&gt;"C:\prepareEnvironment.bat" &lt;rewrite-setup-scripts&gt;always ; </pre></li></ul><hr /> <p> <strong>Reason:</strong> A closer look to the file msvc.jam shows that the global setup script is used to build the cache files for the standard as well as the phone setup in C:Ttemp. Although this is not bad, the circumstance that the script argument is additionally equal for both, the situation ends then badly with two problems. The first one is identified by the impossibility to differentiate the requests in the global setup scripts, and the second one leads to the reported error, becauser the generated name of the two different cache file is equal (C:\Temp\b2_msvc_prepareEnvironment_x86.cmd). The corresponding lines of code are: msvc.jam(985): </p> <pre class="wiki">local cpu = i386 amd64 ia64 arm ... local global-setup = [ feature.get-values &lt;setup&gt; : $(options) ] ; global-setup = $(global-setup[1]) ; local global-setup-phone = $(global-setup) ; ... local phone-cpu = i386 arm ; </pre><hr /> <p> <strong>Solution:</strong> Simply enable a second global script for the phone setup, which needs to have a different name, and/or append an additional postfix to the generated names of the cache files. This solution seems to be good, because the standard scripts in the Microsoft Visual Studio are also different (vcvarsall.bat versus vcvarsphoneall.bat). </p> <pre class="wiki">local global-setup = [ feature.get-values &lt;setup&gt; : $(options) ] ; global-setup = $(global-setup[1]) ; local global-setup-phone = [ feature.get-values &lt;setup-phone&gt; : $(options) ] ; global-setup-phone = $(global-setup-phone[1]) ; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12356 Trac 1.4.3