cross-compilingautoconfarm64

How to determine host value for configure when using cross compiler


General question: If I use a cross compiler, how can I tell the value of the "--host" option I should give when I run configure?

Specific: I'm using cross compiler for arm64 arch. What is the correct "--host" value to use?


Solution

  • If I use a cross compiler, how can I tell the value of the --host option I should give when I run ./configure?

    Three machines must be distinguished when discussing toolchain creation

    Four common build types are possible for toolchains are:

    With armed this basics coming to your question.

    For any software, first run ./configure --help

    Host type:

    --build=BUILD           configure for building on BUILD [BUILD=HOST]
    --host=HOST             configure for HOST [guessed]
    --target=TARGET         configure for TARGET [TARGET=HOST]
    

    You will find above so depending on what you want to do, you need to set it for cross compiling. If all options are available, then you want to execute on arm target then set --host={your toolchain triplet} --target={your toolchain triplet}.

    For example, if you are using arm-none-linux-gnueabi-gcc, set --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi. This will write to your makefile. Finally, generated executable will run on target. For --build this will be automatically set, no need to worry.

    For some software package only two option available i.e host and build. here if set host is enough to cross-compile

    Specific: I'm using cross compiler for arm64 arch. What is the correct --host value to use?

    For x86_64, --host={triplet} is generally given, so I think the same should work for arm64 by setting --host={triplet} for your toolchain, but I'm not sure.