Skip to content

Commit cbbff17

Browse files
committed
suppress compiler warnings on Windows to test pipe-stall hypothesis
-O1 is confirmed applied via the override directive (the failing log now shows only -O1 in the compile line, no -O2 anywhere), but the build still fails at the same point with no literal out-of-memory message anywhere in the log, and the whole 6-model compile completes in ~12 seconds -- implausibly fast for genuinely heavy Stan template compilation, and unchanged by MAKEFLAGS=-j1. This points away from pure compiler memory exhaustion and toward the R-side build monitor losing sync with the compiler's stdout: each stanExports_*.cc produces on the order of 30,000+ lines of Eigen/Boost/StanHeaders template-instantiation warnings under -Wall, and Windows named pipes have much smaller default buffers than Unix. Add -w to rule this out.
1 parent 6675cf1 commit cbbff17

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

NEWS.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
version, which only exists from R 4.4.0 (related to #43).
1515
* Fixed intermittent R CMD check failures on Windows CI ("Build process
1616
failed" during compilation of the six bundled Stan models' heavy
17-
Eigen/Boost/StanHeaders template instantiations), by lowering
18-
optimisation from R's Windows default (`-O2`) to `-O1` via a new
19-
`src/Makevars.win`, substantially reducing peak compiler memory. This
20-
uses an `override CXX17FLAGS = ...` directive, since R's own
21-
`etc/Makeconf` is included *after* `Makevars.win` and a plain `=`
22-
assignment there would otherwise silently overwrite a plain
23-
reassignment made here. Also forced serial compilation
24-
(`MAKEFLAGS=-j1`) and enlarged the Windows runner's pagefile as
25-
additional safeguards.
17+
Eigen/Boost/StanHeaders template instantiations), via a new
18+
`src/Makevars.win`: lowered optimisation from R's Windows default
19+
(`-O2`) to `-O1`, and suppressed compiler warnings (`-w`), since the
20+
Eigen/Boost/StanHeaders headers generate an enormous volume of
21+
template-instantiation warnings that may overwhelm the small stdout
22+
pipe buffers on Windows. This uses an `override CXX17FLAGS = ...`
23+
directive, since R's own `etc/Makeconf` is included *after*
24+
`Makevars.win` and a plain `=` assignment there would otherwise
25+
silently overwrite a plain reassignment made here. Also forced serial
26+
compilation (`MAKEFLAGS=-j1`) and enlarged the Windows runner's
27+
pagefile as additional safeguards.
2628

2729
## Minor improvements
2830

src/Makevars.win

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ CXX_STD = CXX17
2727
# The `override` directive is immune to being reset by any later plain
2828
# assignment, regardless of inclusion order, which is exactly what's
2929
# needed here.
30-
override CXX17FLAGS = -O1 -Wall -mfpmath=sse -msse2 -mstackrealign
30+
#
31+
# -O1 alone (this override confirmed working via CI logs, dropping -O2
32+
# entirely) did not fix the Windows failure on its own. Also add -w to
33+
# suppress compiler warnings: Eigen/Boost/StanHeaders headers emit an
34+
# enormous volume of template-instantiation warnings under -Wall
35+
# (190,000+ log lines for a single file), and Windows named pipes have
36+
# far smaller buffers than Unix -- a plausible cause of the observed
37+
# "Error in proc$get_built_file(): Build process failed" is the R-side
38+
# monitoring process losing sync with the compiler's stdout under that
39+
# volume, independent of actual memory exhaustion.
40+
override CXX17FLAGS = -O1 -w -mfpmath=sse -msse2 -mstackrealign

0 commit comments

Comments
 (0)