title: Having troubles with mixing library types (static vs. dynamic)
body: <p>After battling my makefile woes I'm now onto problems with how the two libraries are supposed to interact.  So, this is on Linux (CentOS 6.2 - 6.4, not that that seems to make much difference in terms of tools).  The project, on the whole, is to be deployed in two flavors</p>
  
  <ul>
  <li>A C++ Static library which is used for linking with other C++ appications (a *.a file)</li>
  <li>A shared *.so which is deployed through python using Boost.python</li>
  </ul>
  
  <p>I have everything compiling, but I'm not linking correctly somehow.  In the case of the static library, it is built in two ways:</p>
  
  <ul>
  <li>If meant to be linked with other C++ code, <code>-fPIC</code> is <strong>not</strong> used</li>
  <li>If meant to be linked into the python module, <strong>use</strong> <code>-fPIC</code></li>
  </ul>
  
  <p>I control this through passing parameters to the make program.  Presently, I'm trying to build the boost python module because the static stuff compiles just fine.  So, I have dependencies on the boost libraries and zlib.  The final linking command looks like this:</p>
  
  <pre><code>g++ -o pythonmod.so -L/boost/boost_libs -L/zlibs -lz -lboost_python -lboost_thread -lboost_regex -lboost_system /path/to/static.a -fPIC -shared [many_objects]
  </code></pre>
  
  <p>The "many_objects" comes from the various wrappers, and other code, that wraps the "pure" C++ from the boost.python layer in the code.  Each of these object files are compiled with -fPIC as well.  Their compiled with:</p>
  
  <pre><code>g++ -I/boost/boost_1_47 -I/usr/include/python2.6 -D _linux -MMD -std=c++0x -c -m32 -fPIC &lt;input&gt; -o &lt;output&gt;
  </code></pre>
  
  <p>The lines compiling the object files for the archive file look quite similar to the above only they do not include the python include directory.</p>
  
  <p>I've found other links here to similar problems and tried the solutions but to no avail thus far.  For example, <a href="https://stackoverflow.com/a/5445043/988207">this link</a> uses <code>-Wl,--whole-archive ... -Wl,--no-whole-archive</code>.  I tried this solution when I was trying to link in the static library archive before I was compiling it with -fPIC.  Now that I'm doing that, I've tried <a href="https://stackoverflow.com/a/6637842/988207">this solution</a> but also to no avail.  In each case, every time I load up python and import the module, I get some sort of undefined symbol error --> something went wrong during linking.</p>
  
  <p>How should I mix these libraries together to make the python module work?</p>