Search code examples
c++gcccross-compilinggnubinutils

How to determine architecture to build GCC cross compiler?


I'm trying to set up a build server on Linux which I will use to build C/C++ apps for Windows and Mac. I know that GCC supports a body of different architectures but I can't figure out how to determine targets against which I need to build GCC cross compiler.

Could someone please explain this to me?

Thanks in advance.

P.S. I know that precompiled solutions already exist, but I just want to understand this in detail by making a deep dive.


Solution

  • On the target machine, run:

    gcc -dumpmachine
    

    Then use the result in the --target option when building your cross toolchain.