Boost logo

Boost :

Subject: [boost] [python] Help with boost python build
From: Andy Thomason (a.thomason_at_[hidden])
Date: 2015-08-10 07:36:49


Hi All,

I have had highly variable results with Boost.Python mostly due to
linker errors
or failures of Python to find DLLs.

Python is not great at reporting why it fails, for example not naming
failures
to load dependent DLLs on Windows which does not make this a joyous
experience.

I have never managed to get any Boost.Python example - mine or otherwise
- working
on Windows and have had limited success on Linux. It is little surprise
that all the
examples on Stackoverflow avoid Bjam for builds.

For my genetics library, I have an example that has a single source file
and the Jamfile
reads thus:

python-extension genetics : bindings.cpp :
<toolset>gcc:<cxxflags>-std=c++11 ;

with:

using python : 2.7 ;

in ~/boost-config.jam

ie. as minimal as possible.

This builds well on linux (I am adding a library to the head of modular
boost).

When I run:

python -c "import genetics"

with appropriate PYTHONPATH

I get a run-time symbol search error:

ImportError: <...>/genetics.so: undefined symbol:
_ZNK5boost6python7objects21py_function_impl_base9max_arityEv

My guess would be that rather than this one symbol, Python is failing to
load the shared lib:

~/modular-boost/bin.v2/libs/python/build/gcc-4.8/debug/libboost_python.so.1.59.0

As a postscript, It would be lovely if there were no static or dynamic
libraries to link with
when compiling with Boost.Python and a unity build would be a nice
option as this would bypass
linker and runtime related errors. It would probably compile faster in
my long experience
with such projects.

Any help would be welcome.

Andy.

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk