title: Boost.Python | Symbol in .so file but I get ImportError: undefined symbol
body: <p>I'm using Boost.Python to embed C++ code in my Python app.  The module builds fine with a few warnings.  When I import the module in Python I get this error:</p>
  
  <pre><code>ImportError: .../cdtm_ext.so: undefined symbol: gsl_multimin_fdfminimizer_conjugate_fr
  </code></pre>
  
  <p>This symbol is defined in an external library (Gnu Scientific Library) header file, and the symbol exists in the .so file:</p>
  
  <pre><code>$ nm cdtm_ext.so | grep gsl_multimin_fdfminimizer_conjugate_fr
     U gsl_multimin_fdfminimizer_conjugate_fr
  </code></pre>
  
  <p>Here is my <code>Jamroot</code> file:</p>
  
  <pre><code>import python ;
  
  if ! [ python.configured ]
  {
      ECHO "notice: no Python configured in user-config.jam" ;
      ECHO "notice: will use default configuration" ;
      using python ;
  }
  
  use-project boost
    : ../../../.. ;
  
  project
    : requirements 
      &lt;library&gt;/boost/python//boost_python
      &lt;include&gt;/usr/local/include/gsl
      ;
  
  python-extension cdtm_ext : cdtm.boost.cpp cdtm/cdtm-model.cpp cdtm/corpus.cpp    cdtm/main.cpp cdtm/opt.cpp cdtm/utils.cpp : &lt;library-path&gt;/usr/local/include/gsl ;
  
  install convenient_copy 
    : cdtm_ext 
    : &lt;install-dependencies&gt;on &lt;install-type&gt;SHARED_LIB &lt;install-type&gt;PYTHON_EXTENSION
      &lt;location&gt;. 
    ;
  </code></pre>
  
  <p>I had a similar problem when I wrote my own extension using low-level C++ interface.  I fixed the problem there by adding the library name <code>gsl</code> in the libraries list of the <code>Extension</code> function call.  <code>module = Extension(... libraries = ['gsl', 'cblas'] ...)</code>.  I have no idea how to do the same thing with Boost.Python.</p>