title: Cross compile with another library
body: <p>How to compile with another set of libraries. When I compile on i686 Fedora 13 computer, it works fine. However, when I take the executable (via thumbdrive) and try to run it on another i386 machine, I get the following error message.</p>
  
  <pre><code>/usr/lib/libstdc++.so.6: version ‘GLIBCXX_3.4.9’ not found (required by ./Recorder)
  </code></pre>
  
  <p>Okay, so I have to compile using the i386 libraries so it's compatible. However, the i368 machine doesn't have a compiler. So I have to find a way to cross-compile with using the i386 machine libraries. So I copy all of i386 directory tree into the i686 machine and try to use -nostdlib and point all libraries to use the i386, and I've played with settings all day long and get no where.</p>
  
  <p>I went ahead and tried to make a small program as a test and see if I could get it to cross compile first. Still no luck. </p>
  
  <pre><code>/// \file main.cpp
  #include &lt;pthread.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;  
  #include &lt;iostream&gt;
  int main()
  {
     std::cout &lt;&lt; "Testing!" &lt;&lt; std::endl;
     #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
        printf("POSIX Thread Priority Scheduling supported\n");
     #else
        #warning "POSIX Thread Priority Scheduling NOT supported."
     #endif
     #ifdef _POSIX_THREAD_PRIO_PROTECT
        printf("POSIX Thread Priority Ceiling supported");
     #else
        #warning "POSIX Thread Priority Ceiling NOT supported"
     #endif
     #ifdef _POSIX_THREAD_PRIO_INHERIT
        printf("POSIX Thread Priority Ceiling supported");
     #else
        #warning "POSIX Thread Priority Ceiling NOT supported"
     #endif
     return 0;
  }
  </code></pre>
  
  <p>I compile the program with this command.</p>
  
  <pre><code>g++ -O3 -pedantic -Wextra -Wall -g -c /home/dmiller3/Experiments/Test2/main.cpp -o obj/Debug/main.o
  </code></pre>
  
  <p>I get the error when linking.</p>
  
  <pre><code>g++ -L../../TargetLibraries/cw_1901-glibc_std-standard-dist/lib  -o bin/Debug/Test2 obj/Debug/main.o   -nostdlib ../../TargetLibraries/cw_1901-glibc_std-standard-dist/lib/libpthread-2.5.so ../../TargetLibraries/cw_1901-glibc_std-standard-dist/lib/libc-2.5.so 
  </code></pre>
  
  <blockquote>
  <pre><code>/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
  </code></pre>
    
    <p>00000000080482a0
        obj/Debug/main.o: In function <code>__static_initialization_and_destruction_0':
        /usr/lib/gcc/i686-redhat-linux/4.4.4/../../../../include/c++/4.4.4/iostream:72:
    undefined reference to
    </code>std::ios_base::Init::Init()'
        ...Lot more errors...</p>
  </blockquote>
  
  <p>How do we compile with another library? Why do I have to explicity point to the libc library (shouldn't this be automatic)?
  I've done some searching on the internet, and some articles state that I'm missing a crt0.o file, however I can't find this file on the i386 directory tree.</p>