title: boost python library linking issue -- undefined symbol
body: <p>I am using boost-python built for python3 to expose a simple hello-world program. The example can be found here : <a href="https://github.com/TNG/boost-python-examples/blob/master/01-HelloWorld/hello.cpp" rel="nofollow noreferrer">https://github.com/TNG/boost-python-examples/blob/master/01-HelloWorld/hello.cpp</a></p>
  
  <p>I ran the following commands to get the shared object:</p>
  
  <pre><code>g++ -fPIC -c -I/usr/include/python3.4m -I/usr/include/python3.4m  -Wno-unused-result -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security  -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -L/usr/lib/x86_64-linux-gnu/libboost_python-py34 hello.cpp
  
  g++ -shared hello.o -o hello.so
  </code></pre>
  
  <p>After this, I run the <code>python3 -c 'import hello'</code> command and I get the following error:
  Traceback (most recent call last):</p>
  
  <blockquote>
    <p>File "", line 1, in 
    ImportError: hello.so: undefined symbol: _ZTIN5boost6python7objects21py_function_impl_baseE</p>
  </blockquote>
  
  <p>I partly understand this issue may be because my boost-python installation may be built for an alternative python version (for instance python2.7). When I run the command:</p>
  
  <p><code>ls /usr/lib/x86_64-linux-gnu/libboost_python*.so</code></p>
  
  <p>There are three .so files:</p>
  
  <pre><code>1. libboost_python-py27.so
  2. libboost_python-py34.so
  3. libboost_python.so
  </code></pre>
  
  <p>How can this issue be circumvented?</p>