Open alashworth opened 5 years ago
Comment by bgoodri Wednesday Feb 28, 2018 at 15:15 GMT
It is a Stan (Math) issue and has already had several issues filed about it over the years, such as https://github.com/stan-dev/math/issues/712
Comment by bob-carpenter Wednesday Feb 28, 2018 at 16:12 GMT
Closed. See #712 as @bgoodri pointed out.
I'll try to prioritize getting this fixed. Do you know if that compiler is available on Mac OSX or if there's a way to test with it easily?
Comment by syclik Wednesday Feb 28, 2018 at 16:25 GMT
I spun up a docker image and tested it with Ubuntu with g++ 7.2.0. It works fine with CmdStan.
I'm trying to reproduce the error in RStan, but having trouble installing RStan under that configuration.
Comment by zottelef Wednesday Feb 28, 2018 at 16:30 GMT
if you think I could be of any help (I am a really entry-level STAN user) let me know!
Comment by syclik Wednesday Feb 28, 2018 at 16:49 GMT
@zottelef, thank you!
There is something you could try to help us figure this out. Can you:
make/local
two lines:
CXX=g++-7
CC=g++-7
make build
(or if you have many cores: make -j8 build
)issue-2478.stan
make issue-2478
What I'm trying to tease apart is whether this is a configuration problem in RStan or CmdStan / Stan.
Comment by syclik Wednesday Feb 28, 2018 at 16:54 GMT
@bgoodri, this is the result I have from building from CmdStan (tagged version v2.17.1):
# make issue-2478
--- Translating Stan model to C++ code ---
bin/stanc issue-2478.stan --o=issue-2478.hpp
Model name=issue_2478_model
Input file=issue-2478.stan
Output file=issue-2478.hpp
Compiling pre-compiled header
g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -I src -isystem stan/src -isystem stan/lib/stan_math/ -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-local-typedefs -DEIGEN_NO_DEBUG -DNO_FPRINTF_OUTPUT -pipe -c -O3 stan/src/stan/model/model_header.hpp -o stan/src/stan/model/model_header.hpp.gch
--- Linking C++ model ---
g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -I src -isystem stan/src -isystem stan/lib/stan_math/ -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-local-typedefs -DEIGEN_NO_DEBUG -DNO_FPRINTF_OUTPUT -pipe -lpthread -O3 -o issue-2478 src/cmdstan/main.cpp -include issue-2478.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a
No compiler error.
# g++-7 -v
Using built-in specs.
COLLECT_GCC=g++-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-1ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-1ubuntu1~16.04)
Comment by syclik Wednesday Feb 28, 2018 at 16:56 GMT
@zottelef, please let me know if you run into any trouble getting that up and running. It took me less than 30 minutes, but I know CmdStan inside and out.
Comment by bob-carpenter Wednesday Feb 28, 2018 at 16:59 GMT
Thanks. Yikes. How in the world would R be messing things up? Is it something in the Makevars?
Comment by bgoodri Wednesday Feb 28, 2018 at 19:16 GMT
goodrich@T540p:/opt/cmdstan$ make /tmp/sqrt
--- Translating Stan model to C++ code ---
bin/stanc /tmp/sqrt.stan --o=/tmp/sqrt.hpp
Model name=sqrt_model
Input file=/tmp/sqrt.stan
Output file=/tmp/sqrt.hpp
--- Linking C++ model ---
g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe -lpthread -O3 -o /tmp/sqrt src/cmdstan/main.cpp -include /tmp/sqrt.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a
In file included from <command-line>:0:0:
/tmp/sqrt.hpp: In member function ‘void sqrt_model_namespace::sqrt_model::ctor_body(stan::io::var_context&, unsigned int, std::ostream*)’:
/tmp/sqrt.hpp:125:240: error: call of overloaded ‘sqrt(int)’ is ambiguous
:model::rvalue(qr_Q(x), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_min_max(1, K), stan::model::nil_index_list())), "qr_Q(x)"),sqrt((N - 1))));
^
In file included from /usr/include/features.h:419:0,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h:9,
from stan/lib/stan_math/stan/math/memory/stack_alloc.hpp:6,
from stan/lib/stan_math/stan/math/rev/core/autodiffstackstorage.hpp:4,
from stan/lib/stan_math/stan/math/rev/core.hpp:4,
from stan/lib/stan_math/stan/math/rev/mat.hpp:4,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from /tmp/sqrt.hpp:3,
from <command-line>:0:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:149:1: note: candidate: double sqrt(double)
__MATHCALL (sqrt,, (_Mdouble_ __x));
^
In file included from stan/lib/stan_math/lib/boost_1.64.0/boost/config/no_tr1/cmath.hpp:21:0,
from stan/lib/stan_math/lib/boost_1.64.0/boost/math/tools/config.hpp:19,
from stan/lib/stan_math/stan/math/rev/core/var.hpp:7,
from stan/lib/stan_math/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from stan/lib/stan_math/stan/math/rev/core.hpp:12,
from stan/lib/stan_math/stan/math/rev/mat.hpp:4,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from /tmp/sqrt.hpp:3,
from <command-line>:0:
/usr/include/c++/7/cmath:463:3: note: candidate: constexpr float std::sqrt(float)
sqrt(float __x)
^~~~
/usr/include/c++/7/cmath:467:3: note: candidate: constexpr long double std::sqrt(long double)
sqrt(long double __x)
^~~~
/usr/include/c++/7/cmath:475:5: note: candidate: constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp) [with _Tp = int; typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type = double]
sqrt(_Tp __x)
^~~~
In file included from stan/lib/stan_math/stan/math/rev/scal/fun/pow.hpp:5:0,
from stan/lib/stan_math/stan/math/rev/scal/fun/inc_beta.hpp:7,
from stan/lib/stan_math/stan/math/rev/scal/fun/grad_inc_beta.hpp:12,
from stan/lib/stan_math/stan/math/rev/scal.hpp:50,
from stan/lib/stan_math/stan/math/rev/arr.hpp:9,
from stan/lib/stan_math/stan/math/rev/mat.hpp:13,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from /tmp/sqrt.hpp:3,
from <command-line>:0:
stan/lib/stan_math/stan/math/rev/scal/fun/sqrt.hpp:50:16: note: candidate: stan::math::var stan::math::sqrt(const stan::math::var&)
inline var sqrt(const var& a) {
^~~~
In file included from stan/lib/stan_math/stan/math/prim/mat.hpp:209:0,
from stan/lib/stan_math/stan/math/rev/mat.hpp:12,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from /tmp/sqrt.hpp:3,
from <command-line>:0:
stan/lib/stan_math/stan/math/prim/mat/fun/sqrt.hpp:32:5: note: candidate: typename stan::math::apply_scalar_unary<stan::math::sqrt_fun, T>::return_t stan::math::sqrt(const T&) [with T = int; typename stan::math::apply_scalar_unary<stan::math::sqrt_fun, T>::return_t = double]
sqrt(const T& x) {
^~~~
make: *** [make/models:12: /tmp/sqrt] Error 1
Comment by bob-carpenter Wednesday Feb 28, 2018 at 20:18 GMT
The solution's the same here. Write our own sqrt() and make sure we call that.
On Feb 28, 2018, at 2:16 PM, bgoodri notifications@github.com wrote:
goodrich@T540p:/opt/cmdstan$ make /tmp/sqrt
--- Translating Stan model to C++ code --- bin/stanc /tmp/sqrt.stan --o=/tmp/sqrt.hpp Model name=sqrt_model Input file=/tmp/sqrt.stan Output file=/tmp/sqrt.hpp
--- Linking C++ model --- g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe -lpthread -O3 -o /tmp/sqrt src/cmdstan/main.cpp -include /tmp/sqrt.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a In file included from
:0:0: /tmp/sqrt.hpp: In member function ‘void sqrt_model_namespace::sqrt_model::ctor_body(stan::io::var_context&, unsigned int, std::ostream*)’: /tmp/sqrt.hpp:125:240: error: call of overloaded ‘sqrt(int)’ is ambiguous :model::rvalue(qr_Q(x), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_min_max(1, K), stan::model::nil_index_list())), "qr_Q(x)"),sqrt((N - 1)))); ^ In file included from /usr/include/features.h:419:0, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdint.h:26, from /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h:9, from stan/lib/stan_math/stan/math/memory/stack_alloc.hpp:6, from stan/lib/stan_math/stan/math/rev/core/autodiffstackstorage.hpp:4, from stan/lib/stan_math/stan/math/rev/core.hpp:4, from stan/lib/stan_math/stan/math/rev/mat.hpp:4, from stan/lib/stan_math/stan/math.hpp:4, from stan/src/stan/model/model_header.hpp:4, from /tmp/sqrt.hpp:3, from :0: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:149:1: note: candidate: double sqrt(double) MATHCALL (sqrt,, (Mdouble x)); ^ In file included from stan/lib/stan_math/lib/boost_1.64.0/boost/config/no_tr1/cmath.hpp:21:0, from stan/lib/stan_math/lib/boost_1.64.0/boost/math/tools/config.hpp:19, from stan/lib/stan_math/stan/math/rev/core/var.hpp:7, from stan/lib/stan_math/stan/math/rev/core/gevv_vvv_vari.hpp:5, from stan/lib/stan_math/stan/math/rev/core.hpp:12, from stan/lib/stan_math/stan/math/rev/mat.hpp:4, from stan/lib/stan_math/stan/math.hpp:4, from stan/src/stan/model/model_header.hpp:4, from /tmp/sqrt.hpp:3, from :0: /usr/include/c++/7/cmath:463:3: note: candidate: constexpr float std::sqrt(float) sqrt(float x) ^~~~ /usr/include/c++/7/cmath:467:3: note: candidate: constexpr long double std::sqrt(long double) sqrt(long double x) ^~~~ /usr/include/c++/7/cmath:475:5: note: candidate: constexpr typename gnu_cxx::__enable_if<std::is_integer<_Tp>::value, double>::type std::sqrt(_Tp) [with _Tp = int; typename gnu_cxx::__enable_if<std::is_integer<_Tp>::value, double>::type = double] sqrt(_Tp __x) ^~~~ In file included from stan/lib/stan_math/stan/math/rev/scal/fun/pow.hpp:5:0, from stan/lib/stan_math/stan/math/rev/scal/fun/inc_beta.hpp:7, from stan/lib/stan_math/stan/math/rev/scal/fun/grad_inc_beta.hpp:12, from stan/lib/stan_math/stan/math/rev/scal.hpp:50, from stan/lib/stan_math/stan/math/rev/arr.hpp:9, from stan/lib/stan_math/stan/math/rev/mat.hpp:13, from stan/lib/stan_math/stan/math.hpp:4, from stan/src/stan/model/model_header.hpp:4, from /tmp/sqrt.hpp:3, from :0: stan/lib/stan_math/stan/math/rev/scal/fun/sqrt.hpp:50:16: note: candidate: stan::math::var stan::math::sqrt(const stan::math::var&) inline var sqrt(const var& a) { ^~~~ In file included from stan/lib/stan_math/stan/math/prim/mat.hpp:209:0, from stan/lib/stan_math/stan/math/rev/mat.hpp:12, from stan/lib/stan_math/stan/math.hpp:4, from stan/src/stan/model/model_header.hpp:4, from /tmp/sqrt.hpp:3, from :0: stan/lib/stan_math/stan/math/prim/mat/fun/sqrt.hpp:32:5: note: candidate: typename stan::math::apply_scalar_unary<stan::math::sqrt_fun, T>::return_t stan::math::sqrt(const T&) [with T = int; typename stan::math::apply_scalar_unary<stan::math::sqrt_fun, T>::return_t = double] sqrt(const T& x) { ^~~~ make: *** [make/models:12: /tmp/sqrt] Error 1 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Comment by syclik Wednesday Feb 28, 2018 at 21:02 GMT
@bgoodri, is that compiler installed on the linux box?
If so, I think we can run a test in Stan (compile all models) with Jenkins that will test that things are C++ compilable with that compiler.
Comment by syclik Wednesday Feb 28, 2018 at 21:02 GMT
(I can't reproduce the failure with g++ 7.2.0.)
Comment by bgoodri Wednesday Feb 28, 2018 at 21:06 GMT
Yes
On Wed, Feb 28, 2018 at 4:02 PM, Daniel Lee notifications@github.com wrote:
@bgoodri https://github.com/bgoodri, is that compiler installed on the linux box?
If so, I think we can run a test in Stan (compile all models) with Jenkins that will test that things are C++ compilable with that compiler.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/stan/issues/2478#issuecomment-369381498, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqiVqlorn9SiB9foEJPc_h1wxV-ydks5tZb7QgaJpZM4SWwLs .
Comment by syclik Thursday Mar 01, 2018 at 19:56 GMT
@bgoodri, mind doing me a favor and seeing if this test fails in Stan? (after setting CXX = g++-7
in make/local)
./runTests.py src/test/integration
We've written out a lot of Stan programs that we assume to be compilable by the C++ compiler and the two tests in there make sure they're parsed properly and that they compile. If that catches when it doesn't work, we can put that into a Jenkins job and make sure we are able to keep compiling with changes to the code base.
Comment by zottelef Friday Mar 02, 2018 at 08:39 GMT
@syclik : sorry for the late answer. I did not notice the advances in the topic. Really sorry about that. However, following the work flow you gave me I obtain:
> make issue-2478
--- Translating Stan model to C++ code ---
bin/stanc issue-2478.stan --o=issue-2478.hpp
Model name=issue_2478_model
Input file=issue-2478.stan
Output file=issue-2478.hpp
Compiling pre-compiled header
g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -I src -isystem stan/src -isystem stan/lib/stan_math/ -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-local-typedefs -DEIGEN_NO_DEBUG -DNO_FPRINTF_OUTPUT -pipe -c -O3 stan/src/stan/model/model_header.hpp -o stan/src/stan/model/model_header.hpp.gch
--- Linking C++ model ---
g++-7 -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -I src -isystem stan/src -isystem stan/lib/stan_math/ -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-local-typedefs -DEIGEN_NO_DEBUG -DNO_FPRINTF_OUTPUT -pipe -lpthread -O3 -o issue-2478 src/cmdstan/main.cpp -include issue-2478.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a
Comment by bob-carpenter Wednesday Mar 14, 2018 at 07:08 GMT
OK, this is the one I meant to reopen, as the problem's in this repo.
Comment by stenknutsen Monday Oct 15, 2018 at 14:48 GMT
Summary:
Compilation fails when using sqrt()
.
Description:
After compilation failed, I replaced sqrt()
with pow(x , 0.5)
and everything ran fine.
Reproducible Steps:
Tried running Gaussian_Stan.R
from https://github.com/stan-dev/example-models/tree/master/Bayesian_Cognitive_Modeling/ParameterEstimation/Gaussian
# clears workspace:
rm(list=ls())
library(rstan)
Sys.setenv(USE_CXX14=1)
#### Notes to Stan model #######################################################
## 1) If parameter's prior distribution is not specified, Stan will assume that
## you want it to be distributed uniformly with boundaries given by variable
## constraints. Here constrains <lower=0,upper=10> give uniform (0, 100)
## 2) In Stan, most of the sampling statements can be vectorized. In this example
## you can see it in the statement for vector x. Instead of using for loop for
## each element of the vector, we can simple write it as above. This saves code,
## speeds up computation. For more information read Vectorization chapter in
## the Stan manual (p.231 in version 2.4.0)
################################################################################
model <- "
// Inferring the Mean and Standard Deviation of a Gaussian
data {
int<lower=1> n;
vector<lower=0>[n] x;
}
parameters {
real mu;
real<lower=0,upper=10> sigma;
}
model {
// Priors
mu ~ normal(0, sqrt(1000)); #### Looks like it gets confused by sqrt(1000) here -- pow(1000 , 0.5) works though.
// Data Come From A Gaussian
x ~ normal(mu, sigma);
}"
x <- c(1.1, 1.9, 2.3, 1.8)
n <- length(x)
data <- list(x=x, n=n) # to be passed on to Stan
myinits <- list(
list(mu=0, sigma=1))
# parameters to be monitored:
parameters <- c("mu", "sigma")
# The following command calls Stan with specific options.
# For a detailed description type "?rstan".
samples <- stan(model_code=model,
data=data,
init=myinits, # If not specified, gives random inits
pars=parameters,
iter=10000,
chains=1,
thin=1,
# warmup = 100, # Stands for burn-in; Default = iter/2
# seed = 123 # Setting seed; Default is random seed
)
# Now the values for the monitored parameters are in the "samples" object,
# ready for inspection.
mu <- extract(samples)$mu
sigma <- extract(samples)$sigma
Current Output: Relevant error messages:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
#pragma clang diagnostic pop
^
file2de046558108.cpp:211:56: error: call to 'sqrt' is ambiguous
lp_accum__.add(normal_log<propto__>(mu, 0, sqrt(1000)));
^~~~
/usr/local/clang4/bin/../include/c++/v1/math.h:917:1: note: candidate function [with _A1 = int]
sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/sqrt.hpp:31:59: note: candidate function [with T = int]
inline typename apply_scalar_unary<sqrt_fun, T>::return_t sqrt(const T& x) {
^
/usr/include/math.h:447:15: note: candidate function
extern double sqrt(double);
^
/usr/local/clang4/bin/../include/c++/v1/math.h:910:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);}
^
/usr/local/clang4/bin/../include/c++/v1/math.h:911:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/scal/fun/sqrt.hpp:46:12: note: candidate function
inline var sqrt(const var& a) { return var(new sqrt_vari(a.vi_)); }
^
13 warnings and 1 error generated.
make: *** [file2de046558108.o] Error 1
ERROR(s) during compilation: source code errors or compiler configuration errors!
and
Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In file included from file2de046558108.cpp:8: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resour
Expected Output:
Two arrays populated with values: mu
and sigma
Current Version: v2.17.4
Issue by syclik Wednesday Feb 28, 2018 at 14:35 GMT Originally opened as https://github.com/stan-dev/stan/issues/2478
Summary:
A valid Stan program is failing to C++ compile on Linux using g++ 7.2.0.
This is failing from RStan, so we need to see if it's a Stan problem or an RStan problem.
(Originally reported by @zottelef on Discourse: http://discourse.mc-stan.org/t/qr-reparametrization-error/3426/9)
Description:
This program generates C++ code and then fails to compile.
Reproducible Steps:
We need to determine if this is an RStan or a Stan problem. This error was reported using:
Current Output:
The relevant part of the compiler error is:
Here's the rest of the reported compiler error:
Expected Output:
No error.
Current Version:
v2.17.1