Linux configuration cross compilation tool chain

1 Introduction

The cross-compilation tool chain is mainly used for systems that are compiled on the ubuntu host and claimed to be able to run on other platforms.
Setting the cross-compilation tool mainly sets the three environment variables of PATH, ARCH and CROSS_COMPILE. The following describes the
specific setting methods.
There are 3 ways to set these environment variables.

2. Permanently effective

For permanent modification, please modify the user configuration file, under Ubuntu system, modify as follows:
vim ~/.bashrc
add or modify at the end of the line:

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=$PATH:<WORKDIR>100ask_am335x/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-
linux-gnueabihf/bin

Then exit and execute
source ~/.bashrc

3. Temporarily effective

After executing the "export" command, this setting is only valid for the current terminal:

book@100ask$ export PATH=$PATH:<WORKDIR>100ask_am335x/ToolChain/gcc-linaro-6.2.1-
2016.11-x86_64_arm-linux-gnueabihf/bin
book@100ask$ export ARCH=arm
book@100ask$ export CROSS_COMPILE=arm-linux-gnueabihf-

4. Manually specify

Specify the ARCH architecture CROSS_COMPILE cross-compilation tool chain when make compiles. This method is the least efficient:

book@100ask$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- [命令]

5. Test

Test environment variables:

book@100ask$ source ~/.bashrc
book@100ask$ echo $ARCH
arm
book@100ask$ echo $CROSS_COMPILE
arm-linux-gnueabihf-

Test the cross compiler:
book@100ask$ arm-linux-gnueabihf-gcc -v

Guess you like

Origin blog.csdn.net/qq_18077275/article/details/108867282