compile error

114 views
Skip to first unread message

enza calculli

unread,
Sep 15, 2021, 5:40:09 AM9/15/21
to nimble-users
Dear devs,
I have this message when running nimbleModel function:

compiling... this may take a minute. Use 'showCompilerOutput = TRUE' to see C++ compilation details.
Errore: Failed to create the shared library. Run 'printErrors()' to see the compilation errors.

Any idea about this message?
Thanks a lot,
Enza 

Luca

unread,
Sep 15, 2021, 6:16:39 AM9/15/21
to enza calculli, nimble-users
Hi Enza,

can you give the command "printErrors()" and report the output? Which operating system are you using?

Cheers,
Luca
> --
> You received this message because you are subscribed to the Google Groups "nimble-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com <mailto:nimble-users...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com <https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

enza calculli

unread,
Sep 15, 2021, 6:28:36 AM9/15/21
to nimble-users
Hi Luca,
I work with a Windows OS and this is the quite long error:

> printErrors()
P_1_code_dot_MA_MID_1_nfCode.cpp: In member function 'virtual void zlatent_L15_UID_16::simulate(const indexedNodeInfo&) const':
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:52: error: no match for 'operator-' (operand types are 'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' and 'int')
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                               ~~~~~~~~~~~~~~~~~~~~^~
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:91,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/Users/Alessio Pollice/Documents/R/win-library/4.1/nimble/include/Eigen/src/plugins/CommonCwiseBinaryOps.h:19:28: note: candidate: 'template<class OtherDerived> const Eigen::CwiseBinaryOp<Eigen::internal::scalar_difference_op<typename Eigen::internal::traits<T>::Scalar, typename Eigen::internal::traits<OtherDerived>::Scalar>, const Derived, const OtherDerived> Eigen::MatrixBase<Derived>::operator-(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = OtherDerived; Derived = Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >]'
 EIGEN_MAKE_CWISE_BINARY_OP(operator-,difference)
                            ^~~~~~~~
C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/src/Core/util/Macros.h:952:4: note: in definition of macro 'EIGEN_MAKE_CWISE_BINARY_OP'
   (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
    ^~~~~~
C:/Users/Alessio Pollice/Documents/R/win-library/4.1/nimble/include/Eigen/src/plugins/CommonCwiseBinaryOps.h:19:28: note:   template argument deduction/substitution failed:
 EIGEN_MAKE_CWISE_BINARY_OP(operator-,difference)
                            ^~~~~~~~
C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/src/Core/util/Macros.h:952:4: note: in definition of macro 'EIGEN_MAKE_CWISE_BINARY_OP'
   (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
    ^~~~~~
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   mismatched types 'const Eigen::MatrixBase<Derived>' and 'int'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/src/Core/DenseBase.h:574,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:459,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/Users/Alessio Pollice/Documents/R/win-library/4.1/nimble/include/Eigen/src/plugins/CommonCwiseUnaryOps.h:45:1: note: candidate: 'const NegativeReturnType Eigen::DenseBase<Derived>::operator-() const [with Derived = Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >; Eigen::DenseBase<Derived>::NegativeReturnType = Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, const Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> > >; typename Eigen::internal::traits<T>::Scalar = double]'
 operator-() const { return NegativeReturnType(derived()); }
 ^~~~~~~~
C:/Users/Alessio Pollice/Documents/R/win-library/4.1/nimble/include/Eigen/src/plugins/CommonCwiseUnaryOps.h:45:1: note:   candidate expects 0 arguments, 1 provided
In file included from C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_algobase.h:67,
                 from C:/rtools40/mingw64/include/c++/8.3.0/bits/char_traits.h:39,
                 from C:/rtools40/mingw64/include/c++/8.3.0/ios:40,
                 from C:/rtools40/mingw64/include/c++/8.3.0/istream:38,
                 from C:/rtools40/mingw64/include/c++/8.3.0/sstream:38,
                 from C:/rtools40/mingw64/include/c++/8.3.0/complex:45,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_iterator.h:392:5: note: candidate: 'template<class IteratorL, class IteratorR> decltype ((_y.base() - _x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_iterator.h:392:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' is not derived from 'const std::reverse_iterator<_Iterator>'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_algobase.h:67,
                 from C:/rtools40/mingw64/include/c++/8.3.0/bits/char_traits.h:39,
                 from C:/rtools40/mingw64/include/c++/8.3.0/ios:40,
                 from C:/rtools40/mingw64/include/c++/8.3.0/istream:38,
                 from C:/rtools40/mingw64/include/c++/8.3.0/sstream:38,
                 from C:/rtools40/mingw64/include/c++/8.3.0/complex:45,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_iterator.h:1188:5: note: candidate: 'template<class IteratorL, class IteratorR> decltype ((_x.base() - _y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
     operator-(const move_iterator<_IteratorL>& __x,
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_iterator.h:1188:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' is not derived from 'const std::move_iterator<_IteratorL>'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/complex:356:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)'
     operator-(const complex<_Tp>& _x, const complex<_Tp>& _y)
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/complex:356:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' is not derived from 'const std::complex<_Tp>'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/complex:365:5: note: candidate: 'template<class Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const Tp&)'
     operator-(const complex<_Tp>& _x, const Tp& __y)
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/complex:365:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' is not derived from 'const std::complex<_Tp>'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/complex:374:5: note: candidate: 'template<class Tp> std::complex<_Tp> std::operator-(const Tp&, const std::complex<_Tp>&)'
     operator-(const Tp& _x, const complex<_Tp>& __y)
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/complex:374:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   mismatched types 'const std::complex<_Tp>' and 'int'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Core:99,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/Eigen/Dense:1,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:24,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/complex:451:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&)'
     operator-(const complex<_Tp>& __x)
     ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/complex:451:5: note:   template argument deduction/substitution failed:
P_1_code_dot_MA_MID_1_nfCode.cpp:2385:54: note:   'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' is not derived from 'const std::complex<_Tp>'
 Interm_56 = (**model_vlatent)[(nimSeqByD(1,1,1,0)) - 1];
                                                      ^
In file included from C:/rtools40/mingw64/include/c++/8.3.0/vector:65,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/NimArrBase.h:38,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/RcppNimbleUtils.h:24,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/NamedObjects.h:28,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:26,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_bvector.h:210:3: note: candidate: 'std::ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const std::_Bit_iterator_base&)'
   operator-(const Bit_iterator_base& _x, const Bit_iterator_base& _y)
   ^~~~~~~~
C:/rtools40/mingw64/include/c++/8.3.0/bits/stl_bvector.h:210:3: note:   no known conversion for argument 1 from 'Eigen::CwiseNullaryOp<seqClass<Eigen::Matrix<double, -1, -1>, int, int, int, (byOrLength)0>, Eigen::Matrix<double, -1, -1> >' to 'const std::_Bit_iterator_base&'
P_1_code_dot_MA_MID_1_nfCode.cpp:2387:27: error: cannot bind non-const lvalue reference of type 'NimArr<1, double>&' to an rvalue of type 'NimArr<1, double>'
 Interm_57 = rcFun_nimble3(Interm_56, 0);
                           ^~~~~~~~~
In file included from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/RcppNimbleUtils.h:25,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/NamedObjects.h:28,
                 from C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/EigenTypedefs.h:26,
                 from P_1_code_dot_MA_MID_1_nfCode.cpp:6:
C:\Users\Alessio Pollice\Documents\R\win-library\4.1\nimble\include/nimble/NimArr.h:276:3: note:   after user-defined conversion: 'NimArr<1, T>::NimArr(int) [with T = double]'
   NimArr<1, T>(int is1) : NimArrBase<T>() { setSize(is1); }
   ^~~~~~~~~~~~
P_1_code_dot_MA_MID_1_nfCode.cpp:2313:20: note:   initializing argument 1 of 'NimArr<1, double> rcFun_nimble3(NimArr<1, double>&, int)'
 NimArr<1, double>  rcFun_nimble3 ( NimArr<1, double> & ARG1_z, int ARG2_log )  {
                    ^~~~~~~~~~~~~
make: *** [C:/PROGRA~1/R/R-4.1.0/etc/x64/Makeconf:245: P_1_code_dot_MA_MID_1_nfCode.o] Error 1


Thank you for helping.
E.

Luca

unread,
Sep 15, 2021, 6:35:38 AM9/15/21
to enza calculli, nimble-users
Hi Enza,

I could have helped if the problem had been with the Rtools installation, but that seems to work fine. I suspect that you'll have to share the Nimble code that you're trying to compile – if it's possible for you to share it, of course.

Cheers,
Luca
> > To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com <https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com> <https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/nimble-users/567db56b-8417-4c6d-b480-a03b12de201bn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups "nimble-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com <mailto:nimble-users...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/32c50a34-c7a8-4ce3-841f-7593bdfc1bf1n%40googlegroups.com <https://groups.google.com/d/msgid/nimble-users/32c50a34-c7a8-4ce3-841f-7593bdfc1bf1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

enza calculli

unread,
Sep 15, 2021, 7:04:12 AM9/15/21
to nimble-users
Sure Luca!
My script is attached.
Thanks,
Enza
model_nimble.R

Chris Paciorek

unread,
Sep 15, 2021, 8:46:36 PM9/15/21
to enza calculli, nimble-users
Hi Enza,

You're getting errors because you have K=2, which means you are passing only one probability into the stick_breaking function. In your case, this produces code that
looks like:

zlatent[1:2] <- stick_breaking_fixed(vlatent[1:1])

and the nimble compiler is having trouble with the [1:1] syntax as it's not syntax that would usually be used.

Fortunately if you have K=2 there is an easy work-around because you don't actually need the stick_breaking function. Try this:

zlatent[1:2] <- c(vlatent[1], 1-vlatent[1])

I'll also file an issue for us to fix the compiler so it works for the [1:1] special case, as it would be useful to be able to use different values of K with the same
model code and have it work for the K=2 case.

A secondary issue is that our stick_breaking function needs to be fixed to allow the case of a single input probability instead of multiple input probabilities.
We'll fix that in our upcoming release.

-Chris

To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/5e2d8102-def5-4cc2-bcb8-d51cc673fe19n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages