title: Why does g++ look in LIBRARY_PATH/../lib64 and where is this documented?
body: <p>My <code>LIBRARY_PATH</code> environment variable has a custom directory in it: <code>/cs/public/lib/pkg/opencv/lib</code>.</p>
  
  <p>But, when I use <code>g++ --print-search-dirs</code>, I get this instead:</p>
  
  <pre><code>libraries: =
  /cs/public/lib/pkg/opencv/lib/x86_64-suse-linux/4.6/:
  /cs/public/lib/pkg/opencv/lib/../lib64/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.6/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/../lib64/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../x86_64-suse-linux/4.6/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../lib64/:
  /lib/x86_64-suse-linux/4.6/:
  /lib/../lib64/:
  /usr/lib/x86_64-suse-linux/4.6/:
  /usr/lib/../lib64/:
  /cs/public/lib/pkg/opencv/lib/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/:
  /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../:
  /lib/:
  /usr/lib/
  </code></pre>
  
  <p>Why does g++ look in these alternatives and a whole bunch of other system locations <em>before</em> what I explicitly specify in the <code>LIBRARY_PATH</code> variable, and where is this documented?</p>
  
  <p>I would understand if system defaults were searched before LIBRARY_PATH and LIBRARY_PATH/../lib64, etc, but g++ puts LIBRARY_PATH/../lib64, then system paths, then LIBRARY_PATH. Where is this ordering documented?</p>
  
  <p>My g++ version is <code>g++ (SUSE Linux) 4.6.2</code></p>
  
  <p>My OS is <code>openSUSE 12.1 (x86_64)</code></p>