Created
April 22, 2017 03:14
-
-
Save bbbales2/0a2456d516bbe1200a4d1ee76b936656 to your computer and use it in GitHub Desktop.
Failing to build stan-math unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bbales2@frog:~/smath$ make test/unit/math/mix/mat/prob/categorical_test | |
make: Warning: Archive 'test/libgtest.a' seems to have been created in deterministic mode. 'test/gtest.o' will always be updated. Please consider passing the U flag to ar to avoid the problem. | |
ar rv test/libgtest.a test/gtest.o | |
r - test/gtest.o | |
make: Warning: Archive 'test/libgtest.a' seems to have been created in deterministic mode. 'test/gtest.o' will always be updated. Please consider passing the U flag to ar to avoid the problem. | |
g++ -I . -isystem lib/eigen_3.2.9 -isystem lib/boost_1.62.0 -isystemlib/cvodes_2.9.0/include -Wall -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DNO_FPRINTF_OUTPUT -pipe -fPIC -c -O3 -DGTEST_USE_OWN_TR1_TUPLE -DGTEST_HAS_PTHREAD=0 -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 test/unit/math/mix/mat/prob/categorical_test.cpp -o test/unit/math/mix/mat/prob/categorical_test.o | |
In file included from ./stan/math/fwd/core.hpp:4:0, | |
from ./stan/math/mix/mat/fun/typedefs.hpp:5, | |
from ./stan/math/mix/mat.hpp:4, | |
from test/unit/math/mix/mat/prob/categorical_test.cpp:1: | |
./stan/math/fwd/core/fvar.hpp: In substitution of ‘template<class V> stan::math::fvar<T>::fvar(const V&, typename boost::enable_if_c<stan::math::ad_promotable<V, T>::value>::type*) [with V = stan::math::fvar<stan::math::var>]’: | |
./stan/math/fwd/scal/fun/log.hpp:19:52: required from ‘stan::math::fvar<T> stan::math::log(const stan::math::fvar<T>&) [with T = stan::math::fvar<stan::math::var>]’ | |
./stan/math/prim/mat/prob/categorical_lpmf.hpp:77:27: required from ‘typename boost::math::tools::promote_args<T2>::type stan::math::categorical_lpmf(const std::vector<int>&, const Eigen::Matrix<RhsScalar, -1, 1>&) [with bool propto = false; T_prob = stan::math::fvar<stan::math::fvar<stan::math::var> >; typename boost::math::tools::promote_args<T2>::type = stan::math::fvar<stan::math::fvar<stan::math::var> >]’ | |
./stan/math/prim/mat/prob/categorical_log.hpp:50:37: required from ‘typename boost::math::tools::promote_args<T>::type stan::math::categorical_log(const std::vector<int>&, const Eigen::Matrix<Scalar, -1, 1>&) [with T_prob = stan::math::fvar<stan::math::fvar<stan::math::var> >; typename boost::math::tools::promote_args<T>::type = stan::math::fvar<stan::math::fvar<stan::math::var> >]’ | |
test/unit/math/mix/mat/prob/categorical_test.cpp:73:3: required from here | |
./stan/math/fwd/core/fvar.hpp:33:7: error: ambiguous template instantiation for ‘struct stan::math::ad_promotable<stan::math::fvar<stan::math::var>, stan::math::fvar<stan::math::var> >’ | |
fvar(const V& v, | |
^ | |
In file included from ./stan/math/fwd/scal/meta/ad_promotable.hpp:4:0, | |
from ./stan/math/fwd/core/fvar.hpp:6, | |
from ./stan/math/fwd/core.hpp:4, | |
from ./stan/math/mix/mat/fun/typedefs.hpp:5, | |
from ./stan/math/mix/mat.hpp:4, | |
from test/unit/math/mix/mat/prob/categorical_test.cpp:1: | |
./stan/math/prim/scal/meta/ad_promotable.hpp:30:12: note: candidates are: template<class T> struct stan::math::ad_promotable<T, T> [with T = stan::math::fvar<stan::math::var>] | |
struct ad_promotable<T, T> { | |
^ | |
In file included from ./stan/math/fwd/core/fvar.hpp:6:0, | |
from ./stan/math/fwd/core.hpp:4, | |
from ./stan/math/mix/mat/fun/typedefs.hpp:5, | |
from ./stan/math/mix/mat.hpp:4, | |
from test/unit/math/mix/mat/prob/categorical_test.cpp:1: | |
./stan/math/fwd/scal/meta/ad_promotable.hpp:18:12: note: template<class V, class T> struct stan::math::ad_promotable<V, stan::math::fvar<T> > [with V = stan::math::fvar<stan::math::var>; T = stan::math::var] | |
struct ad_promotable<V, fvar<T> > { | |
^ | |
In file included from ./stan/math/rev/core/operator_unary_plus.hpp:7:0, | |
from ./stan/math/rev/core.hpp:34, | |
from ./stan/math/mix/mat/fun/typedefs.hpp:6, | |
from ./stan/math/mix/mat.hpp:4, | |
from test/unit/math/mix/mat/prob/categorical_test.cpp:1: | |
./stan/math/prim/scal/fun/constants.hpp:65:18: warning: ‘stan::math::NEGATIVE_EPSILON’ defined but not used [-Wunused-variable] | |
const double NEGATIVE_EPSILON | |
^ | |
In file included from ./stan/math/rev/core.hpp:42:0, | |
from ./stan/math/mix/mat/fun/typedefs.hpp:6, | |
from ./stan/math/mix/mat.hpp:4, | |
from test/unit/math/mix/mat/prob/categorical_test.cpp:1: | |
./stan/math/rev/core/set_zero_all_adjoints.hpp:14:17: warning: ‘void stan::math::set_zero_all_adjoints()’ defined but not used [-Wunused-function] | |
static void set_zero_all_adjoints() { | |
^ | |
make/tests:24: recipe for target 'test/unit/math/mix/mat/prob/categorical_test.o' failed | |
make: *** [test/unit/math/mix/mat/prob/categorical_test.o] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a couple ways to fix this. I'm surprised it's working on other platforms. The problem is instantiating
Base template class:
and we're trying to match
ad_promotable<fvar<var>, fvar<var> >
, and we have ambiguity betweenFrom:
stan_math/stan/math/prim/scal/meta/ad_promotable.hpp
:From:
stan_math/stan/math/fwd/scal/meta/ad_promotable.hpp
:So it must be that this compiler is treating the resolution slightly differently. I see two resolutions:
We might be able to get away with just removing that first template given how explict we are in the other specializations.
We could use Boost's
disable_if
and condition on testing thatV
andfvar<T>
are the same type (I think there's anis_same
metaprogram)We could specialize further for
template <typename T> struct ad_promotable<fvar<T>, fvar<T> >
in the fvar directory.If (1) works that's cleanest. I'd actually prefer (3) to (2) because all the disable-if and enable-if stuff is hard to follow.