title: building my own gcc version
body: <p>My distro (CentOS 6.3) comes with gcc 4.4.6. Since I wanted to try out the Fortran2003 features I decided to compile gcc 4.7.</p>
  
  <p>I followed the steps I found online: compiled separately first gmp, mpc, mpfr, ppl and cloog and the compiled gcc.</p>
  
  <p>I run the configured script as:</p>
  
  <pre><code>configure --prefix=... --with-gmp=... --with-mpfr=... --with-mpc=... --program-suffix=-4.7 --enable-cloog-backend=isl --with-ppl=... --with-cloog=... --disable-multilib
  </code></pre>
  
  <p>This worked all right and I was able to compile with <code>make</code> &amp; <code>make install</code>.</p>
  
  <p>Now, when trying my new compiler with a simple test program (a hello world kind of thing) I get the error:</p>
  
  <pre><code>gfortran-4.7 -o test test.F90
  
  /home/amcastro/gcc-4.7/output/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/f951: error while loading shared libraries: libcloog-isl.so.1: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>So I decide to set <code>LD_LIBRARY_PATH=/home/amcastro/gcc-4.7/output/lib</code>
  and then I can compile.</p>
  
  <p>When running I get the error:</p>
  
  <pre><code>./test
  
  ./test: error while loading shared libraries: libquadmath.so.0: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>So I set <code>LD_LIBRARY_PATH=/home/amcastro/gcc-4.7/output/lib:/home/amcastro/gcc-4.7/output/lib64</code></p>
  
  <p>and now the program runs normally.</p>
  
  <p>The question is: Why is that my distro version of gcc (4.4.6) does not need me to set <code>LD_LIBRARY_PATH</code>? how does the distro gcc know where to look for these dynamically liked libraries? should I somehow make them to link statically?
  I read also that setting <code>LD_LIBRARY_FLAG</code> is not a good idea. Is there another solution?</p>
  
  <p>Thank you in advance</p>
  
  <p>A.</p>