Posted by
AdrianL on
URL: http://quantlib.414.s1.nabble.com/QL-SWIG-Python-error-when-building-tp15676.html
Hi everyone,
I have a problem with building the QL for Python on Linux mint (Ubuntu downstream).
I followed the instructions from here:
http://quantess.net/2012/09/26/quantlib-get-it-working-on-ubuntu/.
I am a novice in all this compiling stuff and as I noticed later in the comments, according to this recipe the boost library is being installed into a non-standard directory. There should be the problem probably.
The result is that the QL works fine, but when building the code for Python it gets stuck somewhere with the Surface object and results into:
make: Entering directory `/usr/local/lib/QuantLib-SWIG-1.4/Python'
make all-am
make[1]: Entering directory `/usr/local/lib/QuantLib-SWIG-1.4/Python'
CXXFLAGS="-g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" /usr/bin/python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
g++ -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -I/usr/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.linux-x86_64-2.7/QuantLib/quantlib_wrap.o -Wno-unused -g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
... (some code compiling) ...
QuantLib/quantlib_wrap.cpp: In function ‘void* _p_TestSurfacePtrTo_p_boost__shared_ptrT_Surface_t(void*, int*)’:
QuantLib/quantlib_wrap.cpp:253496:41: warning: ‘Surface’ is deprecated (declared at /usr/local/include/ql/math/surface.hpp:47) [-Wdeprecated-declarations]
return (void *)((boost::shared_ptr< Surface > *) ((TestSurfacePtr *) x));
^
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'g++' failed with exit status 4
make[1]: *** [.build-stamp] Error 1
make[1]: Leaving directory `/usr/local/lib/QuantLib-SWIG-1.4/Python'
make: *** [all] Error 2
make: Leaving directory `/usr/local/lib/QuantLib-SWIG-1.4/Python'
I have also tried to install boost directly by sudo apt-get install libboost. Then I found that there is also possible sudo apt-get install python-quantlib, but importing the module results into:
import QuantLib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/QuantLib/__init__.py", line 19, in <module>
from QuantLib import *
File "/usr/lib/python2.7/dist-packages/QuantLib/QuantLib.py", line 26, in <module>
_QuantLib = swig_import_helper()
File "/usr/lib/python2.7/dist-packages/QuantLib/QuantLib.py", line 22, in swig_import_helper
_mod = imp.load_module('_QuantLib', fp, pathname, description)
ImportError: /usr/lib/python2.7/dist-packages/QuantLib/_QuantLib.so: undefined symbol: _ZThn104_N8QuantLib19CappedFlooredCoupon6updateEv
According to this link
http://forums.linuxmint.com/viewtopic.php?f=47&t=169237&p=870341, one user suggests that the problem is in the changed boost lib install directories.
Finally, I tried to install enthoughts PyQL wrapper, where I included into the build command specification of the libraries: -I/usr/local/include -I/usr/include -I. -I./cpp_layer -I/usr/include/python2.7
according to this link
http://stackoverflow.com/questions/21238056/installing-quantlib-python-pyql-library-seems-not-to-be-able-to-find-boost. Installation tests run smoothly, but importing the module did not produce anything at first and after restarting python resulted into unknown module.
Does anyone has any clue what should I do?
Thanks a lot.
Adrian