简体   繁体   中英

quantlib-swig python installation fails osx

Quantlib is installed and working fine out of /usr/local/include & lib. I am getting numerous errors while attempting to build quantlib-swig. I am pasting just a few examples below.

I believe these may be compiler rather than linking issues, but I am not sure if this is correct or how to continue.

Any help & pointers will be highly appreciated! Thanks!

MBP:Python timo$ python setup.py build

QuantLib/quantlib_wrap.cpp:5201:41: error: no member named 'parse' in 'QuantLib::DateParser'
        return new Date(DateParser::parse(str,fmt));
In file included from QuantLib/quantlib_wrap.cpp:3467:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 'value_type' is a private member of
  'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                      ^
QuantLib/quantlib_wrap.cpp:6170:23: note: while substituting deduced template arguments into function template 'operator<<' [with _Expr =
  boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >]
                s << (*self)[i][j];
                  ^
In file included from QuantLib/quantlib_wrap.cpp:3467:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 'value_type' is a private member of
  'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
           __scalar_expr<typename _Expr::value_type>, _Expr> >
QuantLib/quantlib_wrap.cpp:10789:19: error: no member named 'includeReferenceDateCashFlows' in 'QuantLib::Settings'
        self->includeReferenceDateCashFlows() = b;
        ~~~~  ^
QuantLib/quantlib_wrap.cpp:11175:17: error: no member named 'Surface' in namespace 'QuantLib' using QuantLib::Surface;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11176:17: error: no member named 'Domain' in namespace 'QuantLib' using QuantLib::Domain;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11178:80: error: use of undeclared identifier 'Surface' SWIGINTERN bool boost_shared_ptr_Sl_Surface_Sg____nonzero__(boost::shared_ptr< Surface > *self){
                                                                           ^
QuantLib/quantlib_wrap.cpp:11178:80: error: use of undeclared identifier 'Surface'
QuantLib/quantlib_wrap.cpp:11182:17: error: no member named 'TestSurface' in namespace 'QuantLib' using QuantLib::TestSurface;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11183:27: error: use of undeclared identifier 'Surface'
typedef boost::shared_ptr<Surface> TestSurfacePtr;
                      ^
QuantLib/quantlib_wrap.cpp:11186:43: error: unknown type name 'TestSurface'
        return new TestSurfacePtr(new TestSurface);
                                      ^
QuantLib/quantlib_wrap.cpp:11204:254: error: function definition is not allowed here ...> > const &dates,std::vector< Rate,std::allocator< Rate > > const &yields,DayCounter const &dayCounter,Calendar const &calendar=Calendar(),Linear const &i=Linear()){
                                                                                                                                                                     ^
QuantLib/quantlib_wrap.cpp:11210:100: error: function definition is not allowed here SWIGINTERN std::vector< Date,std::allocator< Date > > const &ZeroCurvePtr_dates(ZeroCurvePtr *self){
                                                                                               ^
QuantLib/quantlib_wrap.cpp:11214:104: error: function definition is not allowed here SWIGINTERN std::vector< Rate,std::allocator< Rate > > const &ZeroCurvePtr_zeroRates(ZeroCurvePtr *self){
                                                                                                   ^
QuantLib/quantlib_wrap.cpp:11218:129: error: function definition is not allowed here SWIGINTERN std::vector< std::pair< Date,Rate >,std::allocator< std::pair< Date,Rate > > > ZeroCurvePtr_nodes(ZeroCurvePtr *self){
                                                                                                                            ^
QuantLib/quantlib_wrap.cpp:11223:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196398:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196596:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196899:8: error: expected unqualified-id extern "C"

You're probably trying to use QuantLib 1.5 or later with an earlier version of QuantLib-SWIG. The members and classes referenced in the question were deprecated in QuantLib 1.3 (I think) and finally removed in version 1.5. Interfaces defined in QuantLib-SWIG 1.4 or earlier will try to find them and fail.

You can avoid the errors by using a version of QuantLib-SWIG matching the version of QuantLib you're using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM