libboost_python3.so installation on Ubuntu 14.04

Some software need libboost_python.

My machine ins Ubuntu 14.04 installed with boost 1.55 using boost source code

http://www.boost.org/users/history/ 

 I installed boost library with

./b2 install --with-python


When I use it on my application, I found the following error ImportError:

/usr/local/lib/libboost_python.so.1.55.0: undefined symbol: PyClass_Type



Here in this writing, I am showing my solution to this error. One need to use python3 instead of python.
My python3 version is 3.4.0. My python version is 2.7.6.
Perhaps there is a method for this installation with python2, but I have not yet found any.


Here is a lazy solution, on Boost root dir:

1. ./bootstrap.sh --with-python=/usr/bin/python3 --with-python-root=/usr
2. ./b2 --with-python --clean
% This line is to be save from linking previous installation's object files
3. ./b2 --with-python
4. ldd -r stage/lib/libboost_python3.so | grep Class
 %If you found a respond: undefined symbol: PyClass_Type. Then its no good, goto step 1
%If you found nothing, its good. proceed forward.
5. nm -D stage/lib/libboost_python3.so | grep PyClass
 %If you found a respond: U PyClass_type this is no good, goto step 1.
 %If you found nothing, its good, proceed forward.
6. sudo ./b2 --with-python install
% This should be good.


 After I tested with above solution, I do not see ImportError anymore.

ความคิดเห็น

แสดงความคิดเห็น

บทความที่ได้รับความนิยม