stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
388 stars 133 forks source link

Installation error #599

Closed gaborcsardi closed 8 months ago

gaborcsardi commented 1 year ago

Summary:

rstanarm (CRAN or dev version) fails to install on a container with clang 16 and libc++.

Description:

rstanarm fails to install on this container: https://r-hub.github.io/containers/containers.html#clang16

The error is

"/opt/R/devel/lib/R/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
0,248,Js_of_ocaml__Js.Error,16,TypeError: not a function
Error in rstan::stanc(file, allow_undefined = TRUE, obfuscate_model_name = FALSE) :
  parser failed badly
Calls: make_cc -> <Anonymous>
Execution halted

Complete output: https://github.com/r-hub/repos/actions/runs/6277015937/job/17047933214#step:4:12133

Reproducible Steps:

docker run -ti ghcr.io/r-hub/containers/clang16:latest bash
R
pak::pkg_install("rstanarm")

RStanARM Version:

Version: 2.26.1

R Version:

> getRversion()
[1] ‘4.4.0’

Operating System:

Ubuntu 22.04.3 LTS

Complete system info here: https://r-hub.github.io/containers/containers.html#clang16

~/.R/Makevars has

CC=clang-16 -std=gnu2x
CXX=clang++-16 -stdlib=libc++ -std=gnu++14
CXX11=clang++-16 -stdlib=libc++
CXX14=clang++-16 -stdlib=libc++
CXX17=clang++-16 -stdlib=libc++
CXX20=clang++-16 -stdlib=libc++
CXX23=clang++-16 -stdlib=libc++
FC=gfortran-12

CFLAGS=-O3 -Wall -pedantic
FFLAGS=-O2 -mtune=native -Wall -pedantic
CXXFLAGS=-O3 -Wall -pedantic -frtti
jgabry commented 1 year ago

@bgoodri any ideas what’s going on here?

bgoodri commented 1 year ago

My guess is that it will be OK if you have the V8 package installed, in which case it will try to use that rather than QuickJSR. But we have other problems with rstanarm and clang++-16 that will have to get fixed.

andrjohns commented 1 year ago

@bgoodri FYI that stanc won't delegate to V8 until you submit the new version of rstan to CRAN

andrjohns commented 1 year ago

It looks like this is another issue of the # character causing breakages, the model parses without issue when I remove this line: https://github.com/stan-dev/rstanarm/blob/ebd07d4603efa397f580f3ec99c3d99637758986/src/stan_files/functions/SSfunctions.stan#L3

gaborcsardi commented 1 year ago

So, I installed V8: https://github.com/r-hub/repos/actions/runs/6537719530/job/17752131768#step:3:93 and I recompiled the new version of rstan: https://github.com/r-hub/repos/actions/runs/6537719530/job/17752131768#step:5:3232 but the rstanarm build still fails: https://github.com/r-hub/repos/actions/runs/6537719530/job/17752131768#step:5:3235

Do you have another idea to make this work?

bgoodri commented 1 year ago

That combination is working on CRAN. Possibly you have a different version of V8 than what they are using. We'll see what happens once StanHeaders 2.32.x goes up (its Javascript parser is somewhat more reliable on well-formatted Stan programs).

gaborcsardi commented 8 months ago

FWIW this is now fixed on my machines, so I am going to close this issue.