title: Cross compiling C++ project, Relocations in generic ELF (EM: 3)
body: <p>I've been working on a c++ project for a while now, but would like to port it over to my arm processor.  I already have all of my cross-compile tools (I'm using CodeSourcery) and thought I could just change my makefile to point to that compiler.  It compiles fine using the default g++, but When try a make pointing to the cross-compiler I get relocation errors: </p>
  
  <blockquote>
    <p>/home/oryan/CodeSourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.2/../../../../arm-none-linux-gnueabi/bin/ld: ServerSocket.o: Relocations in generic ELF (EM: 3)<br>
    ServerSocket.o: could not read symbols: File in wrong format<br>
    collect2: ld returned 1 exit status<br>
    make: *** [simple_server] Error 1   </p>
  </blockquote>
  
  <p>It seems like I don't have a proper link set up or it's pointing to a wrong location.  I'm not that familiar with makefiles and am probably missing something obvious.  The makefile I've been using is from <a href="http://tldp.org/LDP/LG/issue74/tougher.html" rel="noreferrer">http://tldp.org/LDP/LG/issue74/tougher.html</a> with the client side removed:</p>
  
  <pre><code># Makefile for the socket programming example
  #
  
  simple_server_objects = ServerSocket.o Socket.o simple_server_main.o
  
  all : simple_server
  
  simple_server: $(simple_server_objects)
           /home/matt/CodeSourcery/bin/arm-none-linux-gnueabi-g++ -o simple_server $(simple_server_objects)
  
  
  Socket: Socket.cpp
  ServerSocket: ServerSocket.cpp
  simple_server_main: simple_server_main.cpp
  
  clean:
          rm -f *.o simple_server
  </code></pre>
  
  <p>Right now I am manually compiling each file and it works great, but I'd like to further my understanding here.</p>
  
  <p>Thanks!</p>