-
Notifications
You must be signed in to change notification settings - Fork 98
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
Errors when build with latest version of cppad and cppadcg on 3 years old code. #206
Comments
The first error is
Also see the heading API warning on It looks to me like you need to update the following files (in CppAD CodeGen) I suggest using the CPPAD_NUMERIC_LIMITS algorithm; see You will then need to run all the CppAD CodeGen tests to see if there are any other problems using the newer version of CppAD. If they pass, and your old code above works, you could make a pull request the CppAD CodeGen project. One other thing, just so you know about it, there is some code generation built into CppAD and inspired by CppAD CodeGen; see |
Thanks for the quick response! Cheers! |
Hi Should I also add this to the base_float.hpp I tried the above and run the codegen test. Still the same error. -- package dl found CMake Warning at cmake/FindClang.cmake:25 (MESSAGE): -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) Thanks! |
I think CPPAD_NUMERIC_LIMITS is defined when CppAD CodeGen's base_double.hpp is included and all you need to do is namespace CppAD { to define all the numeric limits for cg::CG. I think the current version of CppAD CodeGen's base_double.hpp was written before CPPAD_NUMERIC_LIMITS was added to CppAD. |
Yes! It proceeded, but there is a new error: In file included from /usr/local/include/cppad/cg/cppadcg.hpp:157: Thanks for the patience! |
Are you able to run the CppADCodeGen test using an old version of CppAD and no changes to CppADCodeGen ? See Testing on |
CppAD 2024 add a `max_digits10` member to `CppAD::numeric_limits`. This member is not defined in CppADCodeGen and this create compilation issue with clang based compiler. To avoid future issue, we use `CPPAD_NUMERIC_LIMITS` macro that will ensure we always have an up to date version of `CppAD::numeric_limits`. See [CppAD#206](coin-or/CppAD#206).
CppAD 2024 add a `max_digits10` member to `CppAD::numeric_limits`. This member is not defined in CppADCodeGen and this create compilation issue with clang based compiler. To avoid future issue, we use `CPPAD_NUMERIC_LIMITS` macro that will ensure we always have an up to date version of `CppAD::numeric_limits`. See [CppAD#206](coin-or/CppAD#206).
Hello @xiao-wang007, @bradbell, The following CppADCodgeGen PR should have fix this issue. |
@xiao-wang007 If the new version of CppADCodeGen (see message above) fixes your problem, please close this issue |
Hi
I was trying some old codes from github, which depends on cppad and cppadcg. But when I build it, it got stopped with these errors.
Is this because of the version?
Cheers
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.cpp:8:
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.h:8:
In file included from /Users/xiao/0_codes/to-ihc-2/common.h:11:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/declarations.h:4:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/rbd_types.h:12:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/../scalar_traits.h:9:
In file included from /usr/local/include/cppad/cg.hpp:18:
In file included from /usr/local/include/cppad/cg/cppadcg.hpp:81:
In file included from /usr/local/include/cppad/base_require.hpp:159:
/usr/local/include/cppad/core/numeric_limits.hpp:248:58: error: no member named 'max_digits10' in 'CppAD::numeric_limits<cg::CG>'
static const int max_digits10 = numeric_limits::max_digits10;
~~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/cppad/core/forward/forward.hpp:167:38: note: in instantiation of template class 'CppAD::numeric_limits<CppAD::AD<CppAD::cg::CG>>' requested here
taylor_[C * j + k] = CppAD::numeric_limits::quiet_NaN();
^
/usr/local/include/cppad/core/jacobian.hpp:202:4: note: in instantiation of function template specialization 'CppAD::ADFun<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG>::Forward<Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
Forward(0, x);
^
/Users/xiao/0_codes/to-ihc-2/common.h:123:63: note: in instantiation of function template specialization 'CppAD::ADFun<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG>::Jacobian<Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
MATRIX_AS_VECTOR_AD(full_jacobian) = ad_fun.base2ad().Jacobian(ad_x_);
^
/Users/xiao/0_codes/to-ihc-2/dynamics.cpp:146:5: note: in instantiation of member function 'ADBase<Dynamics, 10, 6, 8>::build_jacobian' requested here
build_jacobian();
^
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.cpp:8:
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.h:8:
In file included from /Users/xiao/0_codes/to-ihc-2/common.h:11:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/declarations.h:4:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/rbd_types.h:12:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/../scalar_traits.h:9:
In file included from /usr/local/include/cppad/cg.hpp:18:
In file included from /usr/local/include/cppad/cg/cppadcg.hpp:157:
In file included from /usr/local/include/cppad/cppad.hpp:53:
In file included from /usr/local/include/cppad/core/ad_fun.hpp:874:
In file included from /usr/local/include/cppad/core/fun_eval.hpp:9:
/usr/local/include/cppad/core/forward/forward.hpp:167:58: error: incomplete definition of type 'CppAD::numeric_limits<CppAD::AD<CppAD::cg::CG>>'
taylor_[C * j + k] = CppAD::numeric_limits::quiet_NaN();
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/local/include/cppad/core/jacobian.hpp:202:4: note: in instantiation of function template specialization 'CppAD::ADFun<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG>::Forward<Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
Forward(0, x);
^
/Users/xiao/0_codes/to-ihc-2/common.h:123:63: note: in instantiation of function template specialization 'CppAD::ADFun<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG>::Jacobian<Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
MATRIX_AS_VECTOR_AD(full_jacobian) = ad_fun.base2ad().Jacobian(ad_x_);
^
/Users/xiao/0_codes/to-ihc-2/dynamics.cpp:146:5: note: in instantiation of member function 'ADBase<Dynamics, 10, 6, 8>::build_jacobian' requested here
build_jacobian();
^
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.cpp:8:
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.h:8:
In file included from /Users/xiao/0_codes/to-ihc-2/common.h:11:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/declarations.h:4:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/rbd_types.h:12:
In file included from /Users/xiao/0_codes/to-ihc-2/hopper/../scalar_traits.h:9:
In file included from /usr/local/include/cppad/cg.hpp:18:
In file included from /usr/local/include/cppad/cg/cppadcg.hpp:157:
In file included from /usr/local/include/cppad/cppad.hpp:53:
In file included from /usr/local/include/cppad/core/ad_fun.hpp:875:
In file included from /usr/local/include/cppad/core/drivers.hpp:8:
/usr/local/include/cppad/core/jacobian.hpp:135:13: error: no matching member function for call to 'Forward'
v = f.Forward(1, u);
~~^~~~~~~
/usr/local/include/cppad/core/jacobian.hpp:221:7: note: in instantiation of function template specialization 'CppAD::JacobianFor<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG, Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
JacobianFor(*this, x, jac);
^
/Users/xiao/0_codes/to-ihc-2/common.h:123:63: note: in instantiation of function template specialization 'CppAD::ADFun<CppAD::AD<CppAD::cg::CG>, CppAD::cg::CG>::Jacobian<Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>>' requested here
MATRIX_AS_VECTOR_AD(full_jacobian) = ad_fun.base2ad().Jacobian(ad_x_);
^
/Users/xiao/0_codes/to-ihc-2/dynamics.cpp:146:5: note: in instantiation of member function 'ADBase<Dynamics, 10, 6, 8>::build_jacobian' requested here
build_jacobian();
^
/usr/local/include/cppad/core/ad_fun.hpp:357:15: note: candidate template ignored: substitution failure [with BaseVector = Eigen::Matrix<CppAD::AD<CppAD::cg::CG>, -1, 1>]
BaseVector Forward(
^
/usr/local/include/cppad/core/ad_fun.hpp:353:15: note: candidate function template not viable: requires 3 arguments, but 2 were provided
BaseVector Forward(size_t q, size_t r, const BaseVector& x);
^
4 errors generated.
make[2]: *** [CMakeFiles/control.dir/dynamics.cpp.o] Error 1
make[1]: *** [CMakeFiles/control.dir/all] Error 2
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered: