title: Cross compilation: GCC ignores --sysroot
body: <p>I'm trying to cross compile programs (currently avconv from libav) for a Nokia N9 phone using arm-linux-gnueabi-gcc from Linux Mint's 64-bit repository. The compiler's libc version is 2.15 and the phone has libc-2.10.1. They have an incompatibility in the math library, which gives me a segfault when I compile and run the avconv program from libav.</p>
  
  <p>I'd need to compile and link against the older libc version, but I haven't managed to get the <code>--sysroot</code> option to work.</p>
  
  <p>I made a small test program to avoid repeatedly configuring and compiling libav.</p>
  
  <pre><code>arm-linux-gnueabi-gcc --sysroot=/opt/CrossCompilation/NokiaN9/ -o output.sysroot hello.c
  arm-linux-gnueabi-gcc -o output.nosysroot hello.c
  </code></pre>
  
  <p>Both commands create an identical output file. This is what <code>hello.c</code> looks like:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main() {
      printf("Hello, World! Sin = %f\n", sin(0.6451));
  }
  </code></pre>
  
  <p>The strangest part is that gcc completely ignores the <code>--sysroot</code> option. If I pass a nonexisting directory to sysroot, it still produces exactly the same output binary:</p>
  
  <pre><code>arm-linux-gnueabi-gcc --sysroot=/foo/bar -o output.foobar hello.c
  </code></pre>
  
  <p>It doesn't even complain about any errors. What's the problem?</p>