I’m trying to use the boost functions and I’m getting this error about not finding the symbols for arm64:
#include <stan/math/prim.hpp>
#include <stan/math/rev/core.hpp>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
inline double tanpi(const double& x, std::ostream* pstream__) {
return boost::math::sin_pi(x) / boost::math::cos_pi(x);
}
functions {
real tanpi(real x);
}
data {
real y_mean;
}
parameters {
real<lower=0> y;
}
transformed parameters {
// real z = tanpi(y);
}
model {
y ~ normal(y_mean, 1);
}
generated quantities {
real z = tanpi(y_mean);
}
> mod <- cmdstan_model(fp, include_paths = getwd(),
+ cpp_options = list(USER_HEADER = file.path(getwd(), hpp_file)),
+ stanc_options = list("allow-undefined")
+ )
Compiling Stan program...
undef: __ZN20test_model_namespace5tanpiIdEEN5boost4math5tools12promote_argsIT_fffffE4typeERKS5_PNSt3__113basic_ostreamIcNSA_11char_traitsIcEEEE
Undefined symbols for architecture arm64:
"boost::math::tools::promote_args<double, float, float, float, float, float>::type test_model_namespace::tanpi<double>(double const&, std::__1::basic_ostream<char, std::__1::char_traits<char> >*)", referenced from:
stan::model::model_base_crtp<test_model_namespace::test_model>::write_array(boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> >&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&, bool, bool, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in lto.o
stan::model::model_base_crtp<test_model_namespace::test_model>::write_array(boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> >&, std::__1::vector<double, std::__1::allocator<double> >&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<double, std::__1::allocator<double> >&, bool, bool, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const in lto.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/var/folders/22/bpr3xfb5343gnd0jqvhwk2380000gn/T/RtmpVCehZ1/model-c17b23c5daf4] Error 1
Error: An error occured during compilation! See the message above for more information.
tagging @rok_cesnovar and @andrjohns