title: Centos 7 with custom built GLFW binary /usr/bin/ld: /usr/local/lib/libglfw3.a(init.c.o): unrecognized relocation (0x2a) in section `.text'
body: <p>Note I'm using Centos 7 with <code>source scl_soruce enable devtoolset-6</code> and the rehl elrepo Nvidia drivers (with disabled noveau).  The gcc and g++ version through devtoolset-6 are apparently <code>GNU 6.2.1</code></p>
  
  <p>Note I also use libc version <code>ldd (GNU libc) 2.17</code></p>
  
  <p>I was following <a href="https://learnopengl.com/#!Getting-started/OpenGL" rel="nofollow noreferrer">this tutorial on opengl</a> but now I'm stuck.  I downloaded the source from <a href="http://www.glfw.org/download.html" rel="nofollow noreferrer">glfw's</a> website, and followed the tutorial to build (and saw no errors). I tried this with both the source provided and the master build from the repo with the same result. </p>
  
  <p>I extracted the source file into Home directory, ran <code>cmake .</code> inside, then ran <code>make</code> then ran <code>sudo make install</code> and no errors occurred. </p>
  
  <p>Note I also used the glad utility described in the tutorial, using opengl 3.3, </p>
  
  <p>My file structure is like so:</p>
  
  <pre><code>cmake-build-debug
      ...
  include
      glad
      KHR
  CMakeLists.txt
  glad.c
  main.cpp
  </code></pre>
  
  <p>Here is my source code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;glad/glad.h&gt;
  #include &lt;GLFW/glfw3.h&gt;
  
  int main() {
      glfwInit();
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  
      std::cout &lt;&lt; "Hello, World!" &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>And my CMakeLists.txt</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.7)
  project(opengltest)
  
  set(CMAKE_CXX_STANDARD 11)
  include_directories("include/")
  set(SOURCE_FILES main.cpp glad.c)
  add_executable(opengltest ${SOURCE_FILES})
  target_link_libraries(opengltest -L/usr/local/lib -lglfw3 -pthread -lGLU -lGL -lrt -lXrandr -lXxf86vm -lXi -lXinerama -lX11 -ldl)
  </code></pre>
  
  <p>and here is the exact output I'm getting:</p>
  
  <pre><code>/home/centos/IDE/bin/cmake/bin/cmake --build /home/centos/IDEProjects/opengltest/cmake-build-debug --target opengltest -- -j 4
  Scanning dependencies of target opengltest
  gmake[3]: Warning: File `../include/KHR/khrplatform.h' has modification time 17724 s in the future
  [ 66%] Building CXX object CMakeFiles/opengltest.dir/main.cpp.o
  [ 66%] Building C object CMakeFiles/opengltest.dir/glad.c.o
  [100%] Linking CXX executable opengltest
  /usr/bin/ld: /usr/local/lib/libglfw3.a(init.c.o): unrecognized relocation (0x2a) in section `.text'
  /usr/bin/ld: final link failed: Bad value
  collect2: error: ld returned 1 exit status
  gmake[3]: *** [opengltest] Error 1
  gmake[2]: *** [CMakeFiles/opengltest.dir/all] Error 2
  gmake[1]: *** [CMakeFiles/opengltest.dir/rule] Error 2
  gmake: *** [opengltest] Error 2
  </code></pre>