Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose_stan_functions still sometimes fails with ..._lp functions #1114

Closed
sbfnk opened this issue Feb 8, 2024 · 0 comments · Fixed by #1115
Closed

expose_stan_functions still sometimes fails with ..._lp functions #1114

sbfnk opened this issue Feb 8, 2024 · 0 comments · Fixed by #1115

Comments

@sbfnk
Copy link
Contributor

sbfnk commented Feb 8, 2024

Summary:

As a follow-up to #1093 and #1098 using expose_stan_functions can still cause unspecific errors sometimes.

Description:

expose_stan_function yields an unspecific error sometimes when used on ..._lp functions.

Reproducible Steps:

library("rstan")
#> Loading required package: StanHeaders
#> 
#> rstan version 2.32.5 (Stan version 2.32.2)
#> For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores()).
#> To avoid recompilation of unchanged Stan programs, we recommend calling
#> rstan_options(auto_write = TRUE)
#> For within-chain threading using `reduce_sum()` or `map_rect()` Stan functions,
#> change `threads_per_chain` option:
#> rstan_options(threads_per_chain = 1)

## make temporary directory
tmpdir <- tempdir()

## definfe test stan function
stan_function <- 'functions{ void test(real variable) {} }'
stan_function_lp <- 'functions{ void test_lp(real variable1, real variable2, real long_variable_name) {} }'

## write stan function to file
writeLines(stan_function, file.path(tmpdir, "test.stan"))
writeLines(stan_function_lp, file.path(tmpdir, "test_lp.stan"))

## compile stan function
expose_stan_functions(file.path(tmpdir, "test.stan"))
message("Success")
#> Success
expose_stan_functions(file.path(tmpdir, "test_lp.stan"))
#> 
#> WARNING: The tools required to build C++ code for R were not found.
#> 
#> Please install Command Line Tools for XCode (or equivalent).
#> Error in expose_stan_functions(file.path(tmpdir, "test_lp.stan")): Compilation failed!

Created on 2024-02-08 with reprex v2.1.0

Current Output:

An error.

Expected Output:

No error.

RStan Version:

Latest develop (277167c): 2.33.1.9000

R Version:

R version 4.3.2 (2023-10-31)

Operating System:

macOS 14.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant