title: static build glew & glfw on linux
body: <p>In my project directory, i have:</p>
  
  <ul>
  <li>./external/glew, which has glew compiled from source (ran make)</li>
  <li>./external/glfw, which has glfw also compiled from source (ran make x11)</li>
  </ul>
  
  <p>in my .c source code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #include "external/glew/include/GL/glew.h"
  #include "external/glfw/include/GL/glfw.h"
  </code></pre>
  
  <p>i tried to compile using GCC:</p>
  
  <pre><code>gcc test1.c -o test1 -DGLEW_STATIC -L./external/glew/lib -lGLEW -lGLU -lGL \
  -L./external/glfw/lib/x11 -lglfw
  </code></pre>
  
  <p>./external/glew/lib is where the libGLEW.a is and ./external/glfw/lib/x11 is where the libglfw.a is.</p>
  
  <p>and it compiles without error. but then i try to run ./test1 it gives me:</p>
  
  <pre><code>./test1: error while loading shared libraries: libGLEW.so.1.6: cannot
  open shared object file: No such file or directory
  </code></pre>
  
  <p>how do i compile glew &amp; glfw statically?</p>
  
  <p><strong>EDIT 1</strong> Thanks for the help guys. After some help from people in stackoverflow and old nabble I manage to write it down what needs to be done to statically linked GLFW and GLEW and put it on <a href="http://www.phacks.net/static-compile-glfw-and-glew/" rel="nofollow">http://www.phacks.net/static-compile-glfw-and-glew/</a></p>