title: how to force compilation of Boost to use -fPIC
body: <p>The team on which I work produces a shared library for use in Python.  This library is entirely C++ and we use Boost to expose to python.  Because we cannot guarantee that our clients have the Boost libraries installed, we pull in the functionality needed from Boost to the shared object file statically.  The final stage in compilation will look familiar to many</p>
  
  <pre><code>g++ -o &lt;output&gt; &lt;objects&gt; -Wl,-Bstatic -lboost_python -lboost_regex ... -Wl,-Bdynamic -shared &lt;other_opts&gt;
  </code></pre>
  
  <p>We've traditionally used our own build of Boost: 1.47.  This version is now quite old and so we wish to update.  However, oddly, when I install the necessary objects using yum on my CentOS 7 system, I get the following error from gcc:</p>
  
  <pre><code>relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
  </code></pre>
  
  <p>Well, I thought I'd simply download the latest boost (CentOS 7 installs Boost 1.53) and do my own build.  This, after all, has always worked for us.  I follow the <a href="http://www.boost.org/doc/libs/1_57_0/more/getting_started/unix-variants.html#prepare-to-use-a-boost-library-binary">instructions here</a> but I got the same error.  How do I force the use of -fPIC for even the static libraries that it builds?</p>