1

I just installed boost.python following the instructions on https://www.boost.org/doc/libs/1_69_0/libs/python/doc/html/building/no_install_quickstart.html but when I try to run the code

    bjam toolset=gcc --verbose-test test 

it throws:

...found 23 targets...
...updating 6 targets...
gcc.link.dll extending.so
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status

    "g++"    -o "extending.so" -Wl,-h -Wl,extending.so -shared -Wl,--start-group "extending.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -Wl,--end-group -fPIC -g 

...failed gcc.link.dll extending.so...
...skipped <p.>test_ext for lack of <p.>extending.so...
gcc.link test_embed
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status

    "g++" -L"/usr/lib" -L"/usr/lib/python2.7/config" -Wl,-rpath -Wl,"/usr/lib" -Wl,-rpath -Wl,"/usr/lib/python2.7/config"  -o "test_embed" -Wl,--start-group "embedding.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -lpython2.7 -Wl,--end-group -fPIC -g 

...failed gcc.link test_embed...
...skipped <p.>test_embed.run for lack of <p.>test_embed...
...failed updating 2 targets...
...skipped 4 targets...

Anyone knows how to solve it? I only want boost to use boost.python. Thanks

1 Answers1

1

It's a linker error. Probably the lib file is under a different name, so have to create a symbolic link manually.

Search and locate the "libboost_pythonXX.so" file in the usr/lib directory

XX will match the python version with which you configured boost while building, From the exception thrown you probably configured it with python2.7, so the file probably will be named as libboost_python27.so

and then create a symbolic link :

sudo ln -s "libboost_pythonXX.so" libboost_python.so

You can use this link for reference.

https://github.com/BVLC/caffe/issues/4843

It helped me to solve the error for me.

Ajay S
  • 11
  • 2