title: libboost_python3.so.1.56.0: undefined symbol: PyClass_Type
body: <p>I'm trying to create a helloWorld module for Python 3 in C++ using the boost::python library.</p>
  <p>Here is a <code>CmakeList.txt</code>:</p>
  <pre><code>set(Python_ADDITIONAL_VERSIONS 3.4)
  find_package( PythonLibs 3.4 REQUIRED )
  include_directories( ${PYTHON_INCLUDE_DIRS} )
  
  find_package( Boost 1.56.0 EXACT COMPONENTS python3 REQUIRED )
  include_directories( ${Boost_INCLUDE_DIR} )
  
  # Define the wrapper library that wraps our library
  add_library( hello SHARED main.cpp )
  target_link_libraries( hello ${Boost_LIBRARIES} ${PythonLibs_LIBRARIES} )
  
  # don't prepend wrapper library name with lib
  set_target_properties( hello PROPERTIES PREFIX &quot;&quot; OUTPUT_NAME hello)
  </code></pre>
  <p>main.cpp</p>
  <pre><code>#include &lt;boost/python.hpp&gt;
  
  char const* greet( )
  {
      return &quot;Hello world&quot;;
  }    
  BOOST_PYTHON_MODULE(mymodule)
  {
      using namespace boost::python;
      def( &quot;greet&quot;, greet );
  }
  </code></pre>
  <p>I installed boost libraries from the source described <a href="https://coderwall.com/p/0atfug" rel="nofollow noreferrer">here</a>, but it does not allow me to use the boost-python3 library (have an error in Cmake). For this purpose I used</p>
  <pre><code>./bootstrap.sh --with-python-version=3.4 --prefix=/usr/local
  </code></pre>
  <p>instead of</p>
  <pre><code>./bootstrap.sh --prefix=/usr/local
  </code></pre>
  <p>to explicitly specify version of python;</p>
  <p>As an output, we get a shared library <code>hello.so</code>. All seems to be ok. But...</p>
  <p>When I try to import the library to python script <code>script.py</code> with content:</p>
  <pre><code>import hello
  </code></pre>
  <p>in terminal using command <em>...$ python3 script.py</em></p>
  <p>I receive an error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;script.py&quot;, line 1, in &lt;module&gt;
      import hello 
  ImportError: /usr/local/lib/libboost_python3.so.1.56.0: undefined symbol: PyClass_Type
  </code></pre>
  <p>The question is: How to make the boost library compatible with Python 3? There are no problems with <code>python2</code>. But I need <code>python3</code>.
  I also saw the <a href="https://stackoverflow.com/questions/19865757/importerror-usr-lib-libboost-python-so-1-54-0-undefined-symbol-pyclass-type/19894643#19894643">page</a> when the same error happens but it didn't help me.</p>
  <p>My software:</p>
  <ul>
  <li>boost version 1.56.0</li>
  <li>Python 3.4</li>
  <li>cmake version 2.8.12.2</li>
  <li>gcc  4.8.2</li>
  <li>OS: Ubuntu 14.04 LTS, 64 bit</li>
  </ul>