rstan icon indicating copy to clipboard operation
rstan copied to clipboard

sh: clang++ -mmacosx-version-min=10.13: command not found

Open gustavahlberg opened this issue 4 years ago • 4 comments

Summary:

Having installed rstan on macbook air 2020 and testing the example schools.stan example in the installation guide. gives me:

Description:

fit <- stan(file = 'schools.stan', data = schools_dat)
sh: clang++ -mmacosx-version-min=10.13: command not found
The NEXT version of Stan will not be able to pre-process your Stan program.
Please open an issue at
 https://github.com/stan-dev/stanc3/issues 
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().
Warning messages:
1: In system2(CXX, args = ARGS) : error in running command
2: In file.remove(c(unprocessed, processed)) :
  cannot remove file '/var/folders/r6/qhphq41s769bj5w1_140_lr40000gn/T//RtmpvcqDc4/file350b138129b2.stan', reason 'No such file or directory'
3: There were 4 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup 
4: Examine the pairs() plot to diagnose sampling problems

Reproducible Steps:

dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M)) file.create(M)
cat("\nCXX14FLAGS += -O3 -mtune=native -arch x86_64 -ftemplate-depth-256",
    file = M, sep = "\n", append = FALSE)
Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) # only necessary for Linux without the nodejs library / headers
install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

example(stan_model, package = "rstan", run.dontrun = TRUE)
   Warning messages:
   1: In system2(CXX, args = ARGS) : error in running command
  2: In file.remove(c(unprocessed, processed)) :
       cannot remove file '/var/folders/r6/qhphq41s769bj5w1_140_lr40000gn/T//RtmpvcqDc4/file350b22886706.stan', reason 
        'No such file or directory'

library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
schools_dat <- list(J = 8,
y = c(28,  8, -3,  7, -1,  1, 18, 12),
sigma = c(15, 10, 16, 11,  9, 11, 10, 18))
fit <- stan(file = 'schools.stan', data = schools_dat)


Current Output:

If applicable, any relevant output from RStan.

Expected Output:

If applicable, the output you expected from RStan.

RStan Version:

rstan 2.21.1

R Version:

R version 4.0.4 (2021-02-15)

Operating System:

OS X 11.0.1

gustavahlberg avatar Feb 17 '21 14:02 gustavahlberg

What do you get if you run

system("clang++ --version")

in R?

jeffreypullin avatar Feb 18 '21 01:02 jeffreypullin

Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin20.1.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

gustavahlberg avatar Feb 18 '21 09:02 gustavahlberg

Ok, this thread contains solutions for the problem you're having:

https://github.com/stan-dev/rstan/issues/774

This is the accepted fix:

https://github.com/stan-dev/rstan/issues/774#issuecomment-656327377

Hopefully that works for you!

jeffreypullin avatar Feb 18 '21 09:02 jeffreypullin

Ok great! I will have a look. Thanks

gustavahlberg avatar Feb 18 '21 09:02 gustavahlberg