title: Why do I get "DSO missing" error even when the linker can locate the library?
body: <p>I am compiling a program against a shared library I have written.  This library in turn relies on <code>Boost::program_options</code> (among other libraries).  When I compile my program, I need of course to mention my library, but I get a DSO error:</p>
  
  <pre><code>g++ ism_create_conf.cc -o ism_create_conf -lglsim_ol -lglsim -lhdf5 -lgsl
  
  /usr/bin/ld.real: /tmp/cc9mBWmM.o: undefined reference to symbol_ZN5boost15program_options8validateERNS_3anyERKSt6vectorISsSaISsEEPSsi'
  //usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.55.0: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I know that the error goes away if I add <code>-lboost_program_options</code>.  What I don't understand is </p>
  
  <ol>
  <li><p>Why do I have to do this even if my program does not call Boost directly (only through my glsim library).</p></li>
  <li><p>Why does the linker want <code>-lboost_program_options</code> when it actually found the correct library (and location) by itself (see the second line of the error message).</p></li>
  </ol>
  
  <p>The situation is similar to what was asked e.g <a href="https://stackoverflow.com/questions/19901934">here</a>, but I am asking something different: I know the solution is to mention the library in the command line, I want to know <em>why</em> I have to do this <em>even if the linker already knows</em> where the library is.  There is obviously something I do not understand about how shared libraries work, it seems to me that when I use other shared libraries, these libraries can automatically call other shared libraries <em>they</em> need.  However, the shared library I built does not have this ability.</p>