Closed barracuda156 closed 1 year ago
cc1plus: out of memory allocating 411159056 bytes
It's an out-of-memory error, it looks like your system does not have enough RAM
Might be related to 32-bitness
Oh it's a 32-bit system? Yep it's definitely just a memory issue, blavaan has very large models so it's unsurprising that they exceed 4GB at points during compilation
@andrjohns Yes, but it builds fine with an earlier rstan
. VM has 8 GB allocated to it, though perhaps any single app is allowed to access only 4 GB.
Any workaround to try? I has been actually using blavaan
myself, not just maintaining it for Macports.
P. S. I am away from native powerpc hardware until beginning of October, so some chances are that it only fails in VM (Rosetta), which is of no big concern. But we do want it to work on ppc
and i386
natively.
@andrjohns Yes, but it builds fine with an earlier rstan.
The 2.21 -> 2.26 upgrade is 5 versions and multiple years of updates to the code & complexity of the Stan & Math libraries, with increased complexity comes increased compilation overhead
VM has 8 GB allocated to it, though perhaps any single app is allowed to access only 4 GB.
Yes, with a 32-bit system no process can address more than 4GB of RAM
Any workaround to try?
You can try some compiler flags which reduce compilation memory at the cost of (much) greater compilation time. Try adding --param ggc-min-expand=10
to your CXXFLAGS
I'm going to close this for now, since it's not a blavaan
/rstan
issue, but feel free to open a new issue for installing on 32-bit systems if you still have memory issues
@andrjohns Could you advise how to pass CXXFLAGS to blavaan
build? I tried adding these to PKG_CXXFLAGS, but Makevars gets overwritten by rstantools
, so this does not work. Passing CXXFLAGS='--param ggc-min-expand=10'
in environment apparently is ignored by the build system.
For locally installing, you would set it in the CXXFLAGS
in your ~/.R/Makevars
file.
If you want to change the Makevars
in blavaan
itself, then you need to add a line to the bottom of the package's configure
script to append the flag to the package's Makevars
after generation by rstantools
.
So the configure
script would then contain:
#! /bin/sh
"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()"
echo "PKG_CXXFLAGS += --param ggc-min-expand=10" >> src/Makevars
For other approaches to reducing memory usage when building for 32bit systems, you can also look at the Debian guidelines: https://wiki.debian.org/ReduceBuildMemoryOverhead
@andrjohns Thank you very much! Will try it now.
UPD. That worked perfectly, blavaan
now compiles! Thanks again.
Something was broken in the last update to
rstan
, apparently, which breaksblavaan
build. Might be related to 32-bitness. Might be related to a move toQuickJSR
.With
rstan
v. 2.26.23,blavaan
0.5-2 (and also 0.5-1) fails to build:With everything else identical, but
rstan
v. 2.21.8,blavaan
0.5-1 builds and installs fine.R Version:
R
4.3.1Operating System:
macOS 10.6.8, gcc 12.2.0
@andrjohns Could you please take a look at this?
blavaan_fail_rstan_2.26.23.txt blavaan_success_rstan_2.21.8.txt