title: how to build a static library properly?
body: <p>I use log4cxx logging library. I need to link with its static version to avoid additional binary dependencies. I use it in my dynamic library. Default build of log4cxx produces static library but I cannot link with it because it was compiled w/o -fPIC flag. So I changed log4cxx bulding as:</p>
  
  <pre><code>CPPFLAGS="-fPIC -static" ./configure
  make
  </code></pre>
  
  <p>As a result I received a <code>liblog4cxx.a</code> that I can link with my .so library. Linking was done by Cmake, something like:</p>
  
  <pre><code>target_link_libraries(my_dynamic_lib log4cxx)
  link_directories(relative_path_to_dir_where_liblog4cxx.a_lives)
  </code></pre>
  
  <p>Everything looked fine until runtime. I cannot load my_dynamic_lib.so because of <code>undefined symbol "logger"</code></p>
  
  <p>Please explain me what's wrong and how to resolve this problem.</p>
  
  <p>thanks</p>