Force GCC's configure to cross-compile

Ian Lance Taylor iant@google.com
Tue Aug 2 21:43:00 GMT 2011


david.hagood@gmail.com writes:

> I am trying to build a GCC for embedded development. One of my targets is
> an X86, as are my development machines. However, I want to treat this as a
> cross compile - I do NOT want a change in the host environment's compiler
> to impact my targets, so I want to use a completely separate compiler for
> my target builds.
>
> However, GCC's configure script "helpfully" detects that my host and
> target are "the same" and decides it's NOT cross-compiling. How can I tell
> configure that it is damn well building a cross compiler no matter what it
> thinks?

I assume that your host and target are both running the same OS, e.g.,
GNU/Linux.  In that case, write something like

configure --build=x86_64-build-linux-gnu --target=x86_64-target-linux-gnu

In other words, the comparison of host and target is a simple string
compare; you can change the vendor field to make them different.

Ian



More information about the Gcc-help mailing list