title: Cross compiling gcc 7.2 from x86_64 to aarch64
body: <p>I have successfully compiled gcc 7.2 from source on an x86_64. Native to native, so the resulting compiler is an x86_64 binary which works fine.</p>
  
  <p>I would also like to have a working compiler for aarch64 (so, not a cross compiler. An aarch64 compiler binary producing aarch64 results.) This is where I'm stuck.</p>
  
  <p>There's two options, a native-to-native compilation of gcc on the aarch64 host. This causes problems, and on top, is slow as mollasses, or a cross compilation of gcc on x86_64, resulting in an aarch64 compiler binary able to produce other aarch64 binaries.</p>
  
  <p>I downloaded and unpacked gcc 7.2, and did the <code>download_prerequisites</code> step. Then I used the following <code>configure</code>:</p>
  
  <pre><code>../gcc-7.2.0/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu \
  --target=x86_64-linux-gnu --prefix=/usr/local/gcc-7.2 \
  --enable-checking=release --enable-languages=c,c++ --disable-multilib \
  --program-suffix=-7.2
  </code></pre>
  
  <p>I suspect the <code>--build</code>, <code>--host</code> and <code>--target</code> are overkill in the native case, though.
  My question is now, what should I set these three to if I want to end up with the aarch64 compiler?</p>
  
  <p>Down the line, I would also like an armv7l version. What would be the options for this?</p>