lballabio / QuantLib-SWIG

QuantLib wrappers to other languages
Other
338 stars 282 forks source link

error building Quantlib SWIG 1.34 #649

Closed masoudms closed 3 months ago

masoudms commented 3 months ago

I am getting this error when I try to make python wrapper - successfully ./configure; python Python/setup.py wrap

root@e79c3a4839ad:/workspace/QuantLib-SWIG-1.34# make -C Python make: Entering directory '/workspace/QuantLib-SWIG-1.34/Python' make all-am make[1]: Entering directory '/workspace/QuantLib-SWIG-1.34/Python' CXXFLAGS="-g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" CC="gcc" CXX="g++" /app/.heroku/python/bin//python3 setup.py build running build running build_py running build_ext building 'QuantLib._QuantLib' extension gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPy_LIMITED_API=0x03080000 -DNDEBUG -I/app/.heroku/python/include/python3.7m -I/usr/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.linux-x86_64-cpython-37/QuantLib/quantlib_wrap.o -Wno-unused -g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings QuantLib/quantlib_wrap.cpp: In function ‘QuantLib::Real ExpSinhIntegral_integrate(QuantLib::ExpSinhIntegral, PyObject)’: QuantLib/quantlib_wrap.cpp:18115:37: error: no matching function for call to ‘QuantLib::ExpSinhIntegral::integrate(UnaryFunction&)’ return self->integrate(f); ^ In file included from /usr/local/include/ql/math/integrals/all.hpp:6:0, from /usr/local/include/ql/math/all.hpp:35, from /usr/local/include/ql/quantlib.hpp:52, from QuantLib/quantlib_wrap.cpp:6121: /usr/local/include/ql/math/integrals/expsinhintegral.hpp:95:14: note: candidate: virtual QuantLib::Real QuantLib::ExpSinhIntegral::integrate(const std::function<double(double)>&, QuantLib::Real, QuantLib::Real) const Real integrate(const ext::function<Real(Real)>& f, Real a, Real b) const override { ^~~~~ /usr/local/include/ql/math/integrals/expsinhintegral.hpp:95:14: note: candidate expects 3 arguments, 1 provided QuantLib/quantlib_wrap.cpp: In function ‘PyObject YearOnYearInflationSwap_swigregister(PyObject, PyObject*)’: QuantLib/quantlib_wrap.cpp:448921:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers SWIG_TypeNewClientData(SWIGTYPE_p_ext__shared_ptrT_YearOnYearInflationSwap_t, SWIG_NewClientData(obj));

error: command '/usr/bin/gcc' failed with exit code 1 Makefile:436: recipe for target '.build-stamp' failed make[1]: [.build-stamp] Error 1 make[1]: Leaving directory '/workspace/QuantLib-SWIG-1.34/Python' Makefile:229: recipe for target 'all' failed make: [all] Error 2 make: Leaving directory '/workspace/QuantLib-SWIG-1.34/Python'

boring-cyborg[bot] commented 3 months ago

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

lballabio commented 3 months ago

What version of QuantLib (the C++ library) do you have?

(Also, you probably know this already, but if you don't need to modify the wrappers you can use pip install QuantLib to get precompiled wrappers.)

masoudms commented 3 months ago

Quantlib 1.34

lballabio commented 3 months ago

Ok, I had a look - if you can upgrade to Boost 1.69 or above, it should fix the problem. If you can't, you'll have to edit ql/math/integrals/expsinhintegral.hpp after the #else and add the missing method; it can throw an exception like the others.

masoudms commented 3 months ago

Thanks Luigi! That worked!