我一直在尝试安装QuantLib,并想在Python中使用它。然而,我在构建Quantlib-SWIG时遇到了很大的麻烦,希望我能在这里得到一些帮助。
我能够按照http://quantlib.org/install/macosx.shtml的步骤构建Quantlib并成功运行所有测试套件(如果重要的话,我在Lion上)。在我下载并解压Quantlib-SWIG并尝试构建python setup.py后,我得到了很多错误,所有这些似乎都在某种程度上重复了以下内容:
QuantLib/quantlib_wrap.cpp:5640: instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = boost::shared_ptr<QuantLib::Quote>]’
QuantLib/quantlib_wrap.cpp:4663: instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’
QuantLib/quantlib_wrap.cpp:43476: instantiated from here
/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,
QuantLib/quantlib_wrap.cpp:5558: error: conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’
QuantLib/quantlib_wrap.cpp:5585: error: in call to ‘assign’
/opt/local/include/boost/assign/assignment_exception.hpp: In static member function ‘static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >, std::allocator<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > > > >, T = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’:
QuantLib/quantlib_wrap.cpp:5640: instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’
QuantLib/quantlib_wrap.cpp:4663: instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >, std::allocator<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > > > >]’
QuantLib/quantlib_wrap.cpp:45813: instantiated from here
/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,
QuantLib/quantlib_wrap.cpp:5558: error: conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’
QuantLib/quantlib_wrap.cpp:5585: error: in call to ‘assign’
/opt/local/include/boost/assign/assignment_exception.hpp: In static member function ‘static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<boost::shared_ptr<QuantLib::StochasticProcess>, std::allocator<boost::shared_ptr<QuantLib::StochasticProcess> > >, T = boost::shared_ptr<QuantLib::StochasticProcess>]’:
QuantLib/quantlib_wrap.cpp:5640: instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = boost::shared_ptr<QuantLib::StochasticProcess>]’
QuantLib/quantlib_wrap.cpp:4663: instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<boost::shared_ptr<QuantLib::StochasticProcess>, std::allocator<boost::shared_ptr<QuantLib::StochasticProcess> > >]’
QuantLib/quantlib_wrap.cpp:124772: instantiated from here
/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,
QuantLib/quantlib_wrap.cpp:5558: error: conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’
QuantLib/quantlib_wrap.cpp:5585: error: in call to ‘assign’我尝试了几个版本的SWIG和Quantlib-SWIG,但似乎没有任何运气。我试过SWIG 3.0.6和3.0.2。Quantlib-SWIG 1.5和1.6。我的Quantlib版本是1.6,boost应该是最新的,因为我是从macports安装的。
我是不是遗漏了什么?
发布于 2015-09-15 10:57:50
这似乎是一个未指定命名空间的问题。添加命名空间后,它被正确编译。
https://stackoverflow.com/questions/31331535
复制相似问题