当前位置:网站首页>Configure cross compilation tool chain and environment variables
Configure cross compilation tool chain and environment variables
2022-07-04 05:41:00 【Quiet Zhiyuan 2021】
Configure the cross compilation tool chain and environment variables
Link to the original text :https://blog.csdn.net/qq_56926420/article/details/122890366
1 Set the cross compilation tool chain
The cross compilation tool chain is used in Ubuntu Compile the application on the host , And these applications are in ARM And other platforms .
Setting the cross compilation tool is mainly to set PATH, ARCH and CROSS_COMPILE Three environment variables , The following describes the specific setting method .
Set this 3 There are several ways to create an environment variable , Choose any one of these methods , It is recommended to use “ permanent ” Methods . I use a variety of development boards when recording videos , So I always use... In videos “ Provisional entry into force ” Methods .
Library environment variable settings :export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/X11/lib:$LD_LIBRARY_PATH/
1.1 permanent
If permanent modification is required , Please modify the user profile .
Be careful : If you don't use vim command , You can use graphical editing tools , perform :gedit ~/.bashrc
vim ~/.bashrc
(1)
Add or modify... At the end of the line , Add the following lines ( The first 3 Xing di 4 Act one line command ):
export ARCH=arm
export CROSS_COMPILE=arm-buildroot-linux-gnueabihf-
export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin
After setting up , To execute source ~/.bashrc Order it to take effect , This command is the environment variable that loads these settings .
After setting up , To execute source ~/.bashrc Order it to take effect , This command is the environment variable that loads these settings .
[email protected]:~$ source ~/.bashrc
[email protected]:~$ arm-buildroot-linux-gnueabihf-gcc -v
1.2 Provisional entry into force
It can also be done manually “export” Command to set environment variables , This setting is only valid for the current terminal ( To open another terminal, you need to set it again ).
(1)
Perform the following 3 An order , The first 3 The order is very long , You need to include all copies of the fourth line :
[email protected]:~$ export ARCH=arm
[email protected]:~$ export CROSS_COMPILE=arm-buildroot-linux-gnueabihf-
[email protected]:~$ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin
1.3 Specify manually
First set up PATH environment variable , And then in make Specified at compile time ARCH framework CROSS_COMPILE Cross compile toolchain ( perform make Parameters specified during command , Only valid for the current command ; The next time to perform make You still need to specify those parameters again ).
(1) Example
[email protected]:~$ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin
[email protected]:~$ make ARCH=arm CROSS_COMPILE=arm-buildroot-linux-gnueabihf-
[email protected]:~$ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin
[email protected]:~$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
2 Test cross compilation tool chain
2.1 Test environment variables
[email protected]:~$ echo $ARCH
arm
[email protected]:~$ echo $CROSS_COMPILE
arm-buildroot-linux-gnueabihf-
2.2 Test cross compiler
Execute the following command , See the following figure for the results :
[email protected]:~$ arm-buildroot-linux-gnueabihf-gcc -v
(1).
Configure environment variable 1 :
Use export Order direct modification PATH Value ,
For example, after the cross compilation tool chain is installed ,
Execute the following commands or execute
export PATH=$PATH:/opt/hisi_linux/x86-arm/arm-himix100-linux/bin
explain :/opt/hisi_linux/x86-arm/arm-himix100-linux/bin Directory installed for compilation
(2). Configure environment variable 2 :
By modifying the ~/.bashrc File :
Add or modify... At the end of the line , Add the following sentence
export PATH=$PATH:/opt/hisi_linux/x86-arm/arm-himix100-linux/bin
After setting up , To execute source ~/.bashrc Order it to take effect , This command is the environment variable that loads these settings .
Environment variable configuration method :
Direct definition
export
Shell The configuration file
And Bash Shell The related configuration files mainly include
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
/etc/bashrc
/etc/bash.bashrc
/etc/profile.d/*.sh
Shell Execution order
/etc/profiles->/.profile(/.bash_profile、~/.bash_login)
Modify the configuration file
All users 、 Shared by all processes :/etc/bash.bashrc
A user 、 Shared by all processes :~/.bashrc
shell The effect of startup mode on variables
Son shell In process execution :/bin/bash Will create shell The child process and ./
Executing in the current process :source and .
3 How to add cross compilation tool chain (toolchain) To environment variable ?(–sysroot route )( new :ubuntu Configuration of environment variables of cross compilation tool chain )
边栏推荐
- ansys命令
- tutle时钟改进版
- Enterprise level log analysis system elk (if things backfire, there must be other arrangements)
- Signification des lettres du module optique et abréviation des paramètres Daquan
- 2022 t elevator repair operation certificate examination question bank and simulation examination
- Graduation design of small programs -- small programs of food and recipes
- How to clone objects
- JS string splicing
- [QT] create mycombobox click event
- Use of hutool Pinyin tool
猜你喜欢
空洞卷积、可变形卷积、可变形ROI Pooling
[excel] PivotChart
BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
How to configure static IP for Kali virtual machine
How to use postman to realize simple interface Association [add, delete, modify and query]
19. Framebuffer application programming
光模块字母含义及参数简称大全
Take you to quickly learn how to use qsort and simulate qsort
Simulink与Arduino串口通信
Solar insect killing system based on single chip microcomputer
随机推荐
接地继电器DD-1/60
tutle时钟改进版
Flink1.13 basic SQL syntax (II) join operation
LC周赛300
2022 question bank and answers for safety management personnel of hazardous chemical business units
Void convolution, deformable convolution, deformable ROI pooling
Just do it with your hands 7 - * project construction details 2 - hook configuration
企业级日志分析系统ELK(如果事与愿违那一定另有安排)
JS扁平化数形结构的数组
Use of hutool Pinyin tool
Integer type of C language
Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
光模块字母含义及参数简称大全
Nodejs learning document
2022 R2 mobile pressure vessel filling retraining question bank and answers
拓扑排序和关键路径的图形化显示
[Excel] 数据透视图
Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
BUU-Crypto-[GUET-CTF2019]BabyRSA
"In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming