QuantLib icon indicating copy to clipboard operation
QuantLib copied to clipboard

Python Swig not working.

Open moritzmcgarrie opened this issue 10 years ago • 3 comments

Hi, I have got pyql bindings to work, did the test and install and also looked at examples all fine for pyql using git clone https://github.com/enthought/pyql.git cd pyql python setup.py build python setup.py test python setup.py install, but not the SWIG Python bindings. On a mac, with Boost and Quantlib 1.7.1 installed, also the xcode command line tools etc. cd to QuantLib-SWIG-1.7/Python then python setup.py build

and get the following - >

running build running build_py running build_ext building 'QuantLib._QuantLib' extension /usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -m32 -m32 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/include -I/opt/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.macosx-10.9-x86_64-2.7/QuantLib/quantlib_wrap.o -Wno-unused -m32 In file included from QuantLib/quantlib_wrap.cpp:3940: In file included from /opt/local/include/ql/quantlib.hpp:43: In file included from /opt/local/include/ql/experimental/all.hpp:25: In file included from /opt/local/include/ql/experimental/volatility/all.hpp:21: In file included from /opt/local/include/ql/experimental/volatility/zabr.hpp:31: In file included from /opt/local/include/ql/math/statistics/incrementalstatistics.hpp:35: In file included from /opt/local/include/boost/accumulators/statistics/stats.hpp:14: In file included from /opt/local/include/boost/accumulators/statistics_fwd.hpp:12: /opt/local/include/boost/mpl/print.hpp:50:19: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] const int m_x = 1 / (sizeof(T) - sizeof(T)); ^ In file included from QuantLib/quantlib_wrap.cpp:3940: In file included from /opt/local/include/ql/quantlib.hpp:47: In file included from /opt/local/include/ql/math/all.hpp:38: In file included from /opt/local/include/ql/math/matrixutilities/all.hpp:4: In file included from /opt/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4032: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, ^ QuantLib/quantlib_wrap.cpp:7271: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:3940: In file included from /opt/local/include/ql/quantlib.hpp:47: In file included from /opt/local/include/ql/math/all.hpp:38: In file included from /opt/local/include/ql/math/matrixutilities/all.hpp:4: In file included from /opt/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4033:46: error: 'value_type' is a private member of 'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >' scalar_expr, Expr> > ^ QuantLib/quantlib_wrap.cpp:7356:62: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] PyObject pyResult = PyObject_CallFunction(function,"d",x); ^ QuantLib/quantlib_wrap.cpp:7364:43: warning: conversion from string literal to 'char ' is deprecated [-Wc++11-compat-deprecated-writable-strings] PyObject_CallMethod(function,"derivative","d",x); ^ QuantLib/quantlib_wrap.cpp:7364:56: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] PyObject_CallMethod(function,"derivative","d",x); ^ QuantLib/quantlib_wrap.cpp:7396:62: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] PyObject pyResult = PyObject_CallFunction(function,"dd",x,y); ^ 5 warnings and 2 errors generated. error: command '/usr/bin/clang' failed with exit status 1

moritzmcgarrie avatar May 01 '16 08:05 moritzmcgarrie

What Boost version are you using? Also, may you try the pre-release versions of QuantLib and QuantLib-SWIG at https://sourceforge.net/projects/quantlib/files/QuantLib/prerelease/ and see if they have the same problem?

lballabio avatar May 02 '16 22:05 lballabio

Have got it working. Completely cleaned the Homebrew and macports installation of boost and quantlib. Then sudo port install boost, then installed QuantLib-1.8 and then only the QuantLib-SWIG-1.8 Python Swig. Other attempts failed so had to completely wipe any version of boost and quantlib before attempting. Cheers.

moritzmcgarrie avatar May 14 '16 20:05 moritzmcgarrie

Ok, thanks.

lballabio avatar May 17 '16 10:05 lballabio