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

Error in TMB::compile(paste0(Version, ".cpp")) : Compilation failed #218

Closed
JenM1 opened this issue Feb 10, 2020 · 15 comments
Closed

Error in TMB::compile(paste0(Version, ".cpp")) : Compilation failed #218

JenM1 opened this issue Feb 10, 2020 · 15 comments

Comments

@JenM1
Copy link

JenM1 commented Feb 10, 2020

Part of the output below:
Calculated and saved to /private/var/folders/87/z7zyllzd4hld9fwy_7s535p00000gp/T/RtmpC4fB10/Summer-Gadus_chalcogrammus-2020-02-10//Kmeans-500.RData

Making data object

FieldConfig_input is:
Component_1 Component_2
Omega -2 -2
Epsilon -2 -2
Beta -2 -2
Epsilon_time -3 -3
OverdispersionConfig_input is:
Eta1 Eta2
-1 -1
Calculating range shift for stratum #1:

Making TMB object

Note: Using Makevars in /Users/jmmarsh/.R/Makevars
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/jmmarsh/Library/R/3.6/library/TMB/include -I/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_VAST_v9_1_0 -DTMB_LIB_INIT=R_init_VAST_v9_1_0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c VAST_v9_1_0.cpp -o VAST_v9_1_0.o
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:535:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/LU:47:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Cholesky:12:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Jacobi:29:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Cholesky:43:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/QR:17:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Householder:27:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:5:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/SVD:48:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:6:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Geometry:58:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:7:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Eigenvalues:58:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:54:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Sparse:26:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/SparseCore:66:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:54:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Sparse:27:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/OrderingMethods:71:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:54:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Sparse:29:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/SparseCholesky:43:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:54:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Sparse:32:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/SparseQR:35:
/Users/jmmarsh/Library/R/3.6/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
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:54:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Sparse:33:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46:
/Users/jmmarsh/Library/R/3.6/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
^
VAST_v9_1_0.cpp:725:18: error: call to 'sqrt' is ambiguous
Range_raw1 = sqrt(8) / exp( logkappa1 ); // Range = approx. distance @ 10% correlation
^~~~
/usr/local/clang7/include/c++/v1/math.h:1038:1: note: candidate function [with _A1 = int]
sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
^
VAST_v9_1_0.cpp:68:6: note: candidate function [with Type = int]
Type sqrt(Type x){
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:433:15: note: candidate function
extern double sqrt(double);
^
/usr/local/clang7/include/c++/v1/math.h:1031:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
^
/usr/local/clang7/include/c++/v1/math.h:1032:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
^
VAST_v9_1_0.cpp:726:18: error: call to 'sqrt' is ambiguous
Range_raw2 = sqrt(8) / exp( logkappa2 ); // Range = approx. distance @ 10% correlation
^~~~
/usr/local/clang7/include/c++/v1/math.h:1038:1: note: candidate function [with _A1 = int]
sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
^
VAST_v9_1_0.cpp:68:6: note: candidate function [with Type = int]
Type sqrt(Type x){
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:433:15: note: candidate function
extern double sqrt(double);
^
/usr/local/clang7/include/c++/v1/math.h:1031:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
^
/usr/local/clang7/include/c++/v1/math.h:1032:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
^
VAST_v9_1_0.cpp:848:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if( (Options_vec(8)==1) ){
~~~~~~~~~~~~~~^~~
VAST_v9_1_0.cpp:848:24: note: remove extraneous parentheses around the comparison to silence this warning
if( (Options_vec(8)==1) ){
~ ^ ~
VAST_v9_1_0.cpp:848:24: note: use '=' to turn this equality comparison into an assignment
if( (Options_vec(8)==1) ){
^~
=
VAST_v9_1_0.cpp:848:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if( (Options_vec(8)==1) ){
~~~~~~~~~~~~~~^~~
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1135:6: note: in instantiation of member function 'objective_function<CppAD::AD >::operator()' requested here
F(); // Run through user template (modifies reportvector)
^
VAST_v9_1_0.cpp:848:24: note: remove extraneous parentheses around the comparison to silence this warning
if( (Options_vec(8)==1) ){
~ ^ ~
VAST_v9_1_0.cpp:848:24: note: use '=' to turn this equality comparison into an assignment
if( (Options_vec(8)==1) ){
^~
=
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:676:24: error: no matching function for call to 'fmax'
_Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
^~~~
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:542:74: note: in instantiation of function template specialization 'std::__1::operator/<CppAD::AD >' requested here
ComplexScalar cc = ComplexScalar(Scalar(0),-m_matT.coeff(n-1,n)) / ComplexScalar(m_matT.coeff(n-1,n-1)-p,q);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:447:7: note: in instantiation of member function 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >::doComputeEigenvectors' requested here
doComputeEigenvectors();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:156:7: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >::compute<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >' requested here
compute(matrix.derived(), computeEigenvectors);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:39:12: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >::EigenSolver<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >' requested here
return EigenSolver(m_eval, false).eigenvalues();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:69:81: note: in instantiation of member function 'Eigen::internal::eigenvalues_selector<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1>, false>::run' requested here
return internal::eigenvalues_selector<Derived, NumTraits::IsComplex>::run(derived());
^
VAST_v9_1_0.cpp:475:58: note: in instantiation of member function 'Eigen::MatrixBase<Eigen::Matrix<CppAD::AD, -1, -1, 0, -1, -1> >::eigenvalues' requested here
vector< std::complex > eigenvalues_B_ff = B_ff.eigenvalues();
^
VAST_v9_1_0.cpp:778:10: note: in instantiation of function template specialization 'calculate_B<CppAD::AD >' requested here
B_ff = calculate_B( VamConfig(0), n_f1, VamConfig(1), Chi_fr, Psi_fr, jnll_comp(13) );
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1135:6: note: in instantiation of member function 'objective_function<CppAD::AD >::operator()' requested here
F(); // Run through user template (modifies reportvector)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:532:15: note: candidate function not viable: no known conversion from 'AD' to 'double' for 1st argument
extern double fmax(double, double);
^
/usr/local/clang7/include/c++/v1/math.h:1217:46: note: candidate function not viable: no known conversion from 'AD' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1218:46: note: candidate function not viable: no known conversion from 'AD' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1228:1: note: candidate template ignored: substitution failure [with _A1 = CppAD::AD, _A2 = CppAD::AD]: no type named 'type' in 'std::__1::__lazy_enable_if<false, std::__1::__promote<CppAD::AD, CppAD::AD, void> >'
fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:684:15: error: no matching function for call to 'scalbn'
_Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD >::value' was not satisfied [with _A1 = CppAD::AD]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:685:15: error: no matching function for call to 'scalbn'
_Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD >::value' was not satisfied [with _A1 = CppAD::AD]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
VAST_v9_1_0.cpp:848:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if( (Options_vec(8)==1) ){
~~~~~~~~~~~~~~^~~
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1369:34: note: in instantiation of member function 'objective_function::operator()' requested here
PROTECT( res = asSEXP( pf->operator()() ) );
^
VAST_v9_1_0.cpp:848:24: note: remove extraneous parentheses around the comparison to silence this warning
if( (Options_vec(8)==1) ){
~ ^ ~
VAST_v9_1_0.cpp:848:24: note: use '=' to turn this equality comparison into an assignment
if( (Options_vec(8)==1) ){
^~
=
VAST_v9_1_0.cpp:848:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if( (Options_vec(8)==1) ){
~~~~~~~~~~~~~~^~~
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:906:20: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD > >::operator()' requested here
Type ans=this->operator()();
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1418:10: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD > >::evalUserTemplate' requested here
y[0]=F.evalUserTemplate();
^
VAST_v9_1_0.cpp:848:24: note: remove extraneous parentheses around the comparison to silence this warning
if( (Options_vec(8)==1) ){
~ ^ ~
VAST_v9_1_0.cpp:848:24: note: use '=' to turn this equality comparison into an assignment
if( (Options_vec(8)==1) ){
^~
=
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:676:24: error: no matching function for call to 'fmax'
_Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
^~~~
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:542:74: note: in instantiation of function template specialization 'std::__1::operator/<CppAD::AD<CppAD::AD > >' requested here
ComplexScalar cc = ComplexScalar(Scalar(0),-m_matT.coeff(n-1,n)) / ComplexScalar(m_matT.coeff(n-1,n-1)-p,q);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:447:7: note: in instantiation of member function 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >::doComputeEigenvectors' requested here
doComputeEigenvectors();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:156:7: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >::compute<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >' requested here
compute(matrix.derived(), computeEigenvectors);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:39:12: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >' requested here
return EigenSolver(m_eval, false).eigenvalues();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:69:81: note: in instantiation of member function 'Eigen::internal::eigenvalues_selector<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1>, false>::run' requested here
return internal::eigenvalues_selector<Derived, NumTraits::IsComplex>::run(derived());
^
VAST_v9_1_0.cpp:475:58: note: in instantiation of member function 'Eigen::MatrixBase<Eigen::Matrix<CppAD::AD<CppAD::AD >, -1, -1, 0, -1, -1> >::eigenvalues' requested here
vector< std::complex > eigenvalues_B_ff = B_ff.eigenvalues();
^
VAST_v9_1_0.cpp:778:10: note: in instantiation of function template specialization 'calculate_B<CppAD::AD<CppAD::AD > >' requested here
B_ff = calculate_B( VamConfig(0), n_f1, VamConfig(1), Chi_fr, Psi_fr, jnll_comp(13) );
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:906:20: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD > >::operator()' requested here
Type ans=this->operator()();
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1418:10: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD > >::evalUserTemplate' requested here
y[0]=F.evalUserTemplate();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:532:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'double' for 1st argument
extern double fmax(double, double);
^
/usr/local/clang7/include/c++/v1/math.h:1217:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1218:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1228:1: note: candidate template ignored: substitution failure [with _A1 = CppAD::AD<CppAD::AD >, _A2 = CppAD::AD<CppAD::AD >]: no type named 'type' in 'std::__1::__lazy_enable_if<false, std::__1::__promote<CppAD::AD<CppAD::AD >, CppAD::AD<CppAD::AD >, void> >'
fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:684:15: error: no matching function for call to 'scalbn'
_Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD<AD > >::value' was not satisfied [with _A1 = CppAD::AD<CppAD::AD >]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:685:15: error: no matching function for call to 'scalbn'
_Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD<AD > >::value' was not satisfied [with _A1 = CppAD::AD<CppAD::AD >]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
VAST_v9_1_0.cpp:848:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if( (Options_vec(8)==1) ){
~~~~~~~~~~~~~~^~~
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:906:20: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<CppAD::AD > > >::operator()' requested here
Type ans=this->operator()();
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1533:12: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<CppAD::AD > > >::evalUserTemplate' requested here
y[0] = F.evalUserTemplate();
^
VAST_v9_1_0.cpp:848:24: note: remove extraneous parentheses around the comparison to silence this warning
if( (Options_vec(8)==1) ){
~ ^ ~
VAST_v9_1_0.cpp:848:24: note: use '=' to turn this equality comparison into an assignment
if( (Options_vec(8)==1) ){
^~
=
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:676:24: error: no matching function for call to 'fmax'
_Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
^~~~
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:542:74: note: in instantiation of function template specialization 'std::__1::operator/<CppAD::AD<CppAD::AD<CppAD::AD > > >' requested here
ComplexScalar cc = ComplexScalar(Scalar(0),-m_matT.coeff(n-1,n)) / ComplexScalar(m_matT.coeff(n-1,n-1)-p,q);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:447:7: note: in instantiation of member function 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >::doComputeEigenvectors' requested here
doComputeEigenvectors();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/EigenSolver.h:156:7: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >::compute<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >' requested here
compute(matrix.derived(), computeEigenvectors);
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:39:12: note: in instantiation of function template specialization 'Eigen::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >::EigenSolver<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >' requested here
return EigenSolver(m_eval, false).eigenvalues();
^
/Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h:69:81: note: in instantiation of member function 'Eigen::internal::eigenvalues_selector<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1>, false>::run' requested here
return internal::eigenvalues_selector<Derived, NumTraits::IsComplex>::run(derived());
^
VAST_v9_1_0.cpp:475:58: note: in instantiation of member function 'Eigen::MatrixBase<Eigen::Matrix<CppAD::AD<CppAD::AD<CppAD::AD > >, -1, -1, 0, -1, -1> >::eigenvalues' requested here
vector< std::complex > eigenvalues_B_ff = B_ff.eigenvalues();
^
VAST_v9_1_0.cpp:778:10: note: in instantiation of function template specialization 'calculate_B<CppAD::AD<CppAD::AD<CppAD::AD > > >' requested here
B_ff = calculate_B( VamConfig(0), n_f1, VamConfig(1), Chi_fr, Psi_fr, jnll_comp(13) );
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:906:20: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<CppAD::AD > > >::operator()' requested here
Type ans=this->operator()();
^
/Users/jmmarsh/Library/R/3.6/library/TMB/include/tmb_core.hpp:1533:12: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<CppAD::AD > > >::evalUserTemplate' requested here
y[0] = F.evalUserTemplate();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:532:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'double' for 1st argument
extern double fmax(double, double);
^
/usr/local/clang7/include/c++/v1/math.h:1217:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1218:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1228:1: note: candidate template ignored: substitution failure [with _A1 = CppAD::AD<CppAD::AD<CppAD::AD > >, _A2 = CppAD::AD<CppAD::AD<CppAD::AD > >]: no type named 'type' in 'std::__1::__lazy_enable_if<false, std::__1::__promote<CppAD::AD<CppAD::AD<CppAD::AD > >, CppAD::AD<CppAD::AD<CppAD::AD > >, void> >'
fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:684:15: error: no matching function for call to 'scalbn'
_Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD<AD<AD > > >::value' was not satisfied [with _A1 = CppAD::AD<CppAD::AD<CppAD::AD > >]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
In file included from VAST_v9_1_0.cpp:2:
In file included from /Users/jmmarsh/Library/R/3.6/library/TMB/include/TMB.hpp:53:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Users/jmmarsh/Library/R/3.6/library/RcppEigen/include/Eigen/Core:96:
/usr/local/clang7/include/c++/v1/complex:685:15: error: no matching function for call to 'scalbn'
_Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
^~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:409:15: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'double' for 1st argument
extern double scalbn(double, int);
^
/usr/local/clang7/include/c++/v1/math.h:1485:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'float' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1486:46: note: candidate function not viable: no known conversion from 'AD<CppAD::AD<CppAD::AD > >' to 'long double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
^
/usr/local/clang7/include/c++/v1/math.h:1491:1: note: candidate template ignored: requirement 'std::is_integral<AD<AD<AD > > >::value' was not satisfied [with _A1 = CppAD::AD<CppAD::AD<CppAD::AD > >]
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
^
18 warnings and 11 errors generated.
make: *** [VAST_v9_1_0.o] Error 1
Error in TMB::compile(paste0(Version, ".cpp")) : Compilation failed

@Cole-Monnahan-NOAA
Copy link
Collaborator

I wonder if you are using the wrong compiler? Please run where("g++") in the console and report back what it says.

Can you run other TMB models? Does TMB::run_example('simple') work?

@Cole-Monnahan-NOAA
Copy link
Collaborator

I should have said this: TMB::runExample(all=TRUE, clean=TRUE) that will run all examples after cleaning to force a recompilation of all .cpp files.

@JenM1
Copy link
Author

JenM1 commented Feb 10, 2020 via email

@JenM1
Copy link
Author

JenM1 commented Feb 10, 2020 via email

@colemonnahan
Copy link

colemonnahan commented Feb 10, 2020 via email

@JenM1
Copy link
Author

JenM1 commented Feb 10, 2020 via email

@JenM1
Copy link
Author

JenM1 commented Feb 10, 2020 via email

@Cole-Monnahan-NOAA
Copy link
Collaborator

Cole-Monnahan-NOAA commented Feb 10, 2020 via email

@megan221
Copy link

If you get the 'Compilation failed' warning using Windows OS you might try using an earlier version of Rtools. I had installed Rtools35 and had issues with compile but installed Rtools34 instead and ran the TMB simple example successfully

@cheryl-barnes
Copy link

Below is a complete list of steps to make compilers functional with:

  • macOS Catalina (10.15.3)
    -- should also work on macOS Sierra and Mojave (< 10.15)
  • R 3.6.2
  • RStudio 1.2.5033.
Note: The order and methods used to install programs matter.
install.packages("devtools")
  require(devtools)
install.packages("Matrix")
  require(Matrix)

Before proceeding, follow these instructions: https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/. Recommend using the "Manual Install Guide" instructions (via the terminal [Applications > Utilities > Terminal]).

Install TMB from CRAN:

install.packages("TMB")
  # select option 1 (update all packages), if prompted
require(TMB)


Replace ~/.R/Makevars contents with the following (type 'open ~/.R/Makevars' in the terminal to edit) :

CC=gcc
CXX=/usr/local/gfortran/bin/g++
CXX1X=/usr/local/clang7/bin/clang++
CXX98=/usr/local/clang7/bin/clang++
CXX11=/usr/local/clang7/bin/clang++
CXX14=/usr/local/clang7/bin/clang++
CXX17=/usr/local/clang7/bin/clang++
LDFLAGS=-L/usr/local/clang7/lib

   # The final line with no data may be necessary...for some unknown reason.


Test TMB following code from: https://github.com/nwfsc-assess/geostatistical_delta-GLMM/wiki/Steps-to-install-TMB.

Version = "linear_mixed_model"

# Simulate data for a linear mixed model with random intercepts:
set.seed(1)
Factor = rep(1:10, each=10)
Z = rnorm(length(unique(Factor)), mean=0, sd=1)

X0 = 0
Y = Z[Factor] + X0 + rnorm( length(Factor), mean=0, sd=1)

# Download CPP file:
setwd(tempdir())
download.file(url="https://raw.githubusercontent.com/James-Thorson/mixed-effects/master/linear_mixed_model/linear_mixed_model.cpp", destfile="linear_mixed_model.cpp", method="auto")
compile(paste0(Version,".cpp"))

# Generate inputs for TMB:
Data = list("n_data"=length(Y), "n_factors"=length(unique(Factor)), "Factor"=Factor-1, "Y"=Y)
Parameters = list("X0"=-10, "log_SD0"=2, "log_SDZ"=2, "Z"=rep(0,Data$n_factor))
Random = c("Z")

# Build TMB object:
dyn.load(dynlib(Version))
Obj = MakeADFun(data=Data, parameters=Parameters, random=Random)  #

# Check that TMB is working properly:
Obj$fn(Obj$par)
  # This should return 313.4137.


Install VAST dependency, FishStatsUtils:

install_github("james-thorson/FishStatsUtils", INSTALL_opts="--no-staged-install")
require(FishStatsUtils)

Install VAST dependency, INLA:

install.packages("INLA", repos=c(getOption("repos"), INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)
require(INLA)

Install the latest version of VAST, dowloaded from github: https://github.com/James-Thorson-NOAA/VAST.

install_local("~/Downloads/VAST-master")
require(VAST)

Test VAST using code from: https://github.com/James-Thorson-NOAA/VAST/wiki/Simple-example):

setwd("~/Desktop/VAST") 
# change for your requirements; this is where model results and plots will be saved

# load data set
# see `?load_example` for list of stocks with example data 
# that are installed automatically with `FishStatsUtils`. 
example = load_example(data_set="EBS_pollock")

# Make settings (turning off bias.correct to save time for example):
settings = make_settings(n_x=100, Region=example$Region, purpose="index", 
  strata.limits=example$strata.limits, bias.correct=FALSE)

# Run model
fit = fit_model("settings"=settings, "Lat_i"=example$sampling_data[,'Lat'], 
  "Lon_i"=example$sampling_data[,'Lon'], "t_i"=example$sampling_data[,'Year'], 
  "c_i"=rep(0,nrow(example$sampling_data)), "b_i"=example$sampling_data[,'Catch_KG'], 
  "a_i"=example$sampling_data[,'AreaSwept_km2'], "v_i"=example$sampling_data[,'Vessel'])

# Plot results
install.packages("rnaturalearthdata")
  require(rnaturalearthdata)
plot(fit)

@cheryl-barnes
Copy link

Please disregard "If, after completing the steps above, you still have compilation issues - consider installing Xcode 11.3 from https://developer.apple.com/download/more/" from my comment above.

Installing Xcode from Apple Developer seems to be causing (or at least not resolving) issues for people. If you go to install the Xcode CLI toolchain from Terminal and get a message about the software already being installed, run:

sudo rm -rf/Library/Developer/CommandLineTools

< and then >

xcode -select --install

If you follow the remaining steps above, all should be right in the world!

@cheryl-barnes
Copy link

If you are having installation issues with INLA, use the 'testing' version instead of the 'stable' version (this is recommended by the authors):
install.packages("INLA", repos=c(getOption("repos"), INLA="https://inla.r-inla-download.org/R/testing"), dep=TRUE)

Also, make sure that gfortran is up-to-date. I recently updated R (v4.0.0) and RStudio (v1.2.5042) and needed to use gfortran 8.2.

@hhamazaki
Copy link

hhamazaki commented Jul 20, 2020

I am having the same issue with Windows 10 machine. R4.02. Rtool4.0. TMB sample c;ode worked fine. Simple VAST example does not work

Making TMB object

Error in TMB::compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
Discarded datum Unknown based on WGS84 ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
Discarded datum Unknown based on WGS84 ellipsoid in CRS definition
3: In sp::spTransform(posTri, CRSobj = map_data@proj4string) :
NULL target CRS comment, falling back to PROJ string

System check appears to be correct

system('where g++')
C:\rtools40\mingw64\bin\g++.exe
[

@James-Thorson-NOAA
Copy link
Owner

Hi all,

After lots of back-and-forth about these issues, I have decided to comment out the VamConfig[1]=3 feature (which constrained oscillations arising from species interactions in a VAM). This then eliminates all the macOS compiler errors that are documented above. The new Version = "VAST_v9_4_0" file in VAST release 3.5.3 should now compile on macOS.

Dan Cushing has already checked this fix on his machine, but could anyone else on this thread also try to re-install latest numeric release of VAST, and check whether the compiler errors are now fixed?

I'm closing the issue for now, but happy to re-open or hear other encouragement about it being fixed :)

@cheryl-barnes
Copy link

Note: CRAN R 4.0.0 builds and higher no longer use any custom compilers and thus this directory is no longer relevant. We now use Apple Xcode 10.1 and GNU Fortran 8.2 from https://github.com/fxcoudert/gfortran-for-macOS/releases. For more details on compiling R, please see also https://mac.R-project.org/tools/

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

No branches or pull requests

7 participants