当前位置:网站首页>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 )
边栏推荐
- 1480. 一维数组的动态和
- What is MQ?
- Kubernets first meeting
- 19. Framebuffer application programming
- Google Chrome browser will support the function of selecting text translation
- 724. Find the central subscript of the array
- Introduction to AMBA
- LabVIEW错误对话框的出现
- flink1.13 sql基础语法(二)join操作
- SQL performance optimization skills
猜你喜欢
检漏继电器JY82-2P
Signification des lettres du module optique et abréviation des paramètres Daquan
空洞卷积、可变形卷积、可变形ROI Pooling
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
How much computing power does transformer have
How to configure static IP for Kali virtual machine
Simulink and Arduino serial port communication
一键过滤选择百度网盘文件
Just do it with your hands 7 - * project construction details 2 - hook configuration
win10清除快速访问-不留下痕迹
随机推荐
VB.net GIF(制作、拆解——优化代码,类库——5)
基于单片机的太阳能杀虫系统
Evolution of system architecture: differences and connections between SOA and microservice architecture
Excel comparator
flink1.13 sql基础语法(一)DDL、DML
Notepad++--显示相关的配置
What is MQ?
如何使用postman实现简单的接口关联【增删改查】
接地继电器DD-1/60
(4) Canal multi instance use
光模块字母含义及参数简称大全
Nodejs learning document
Flink1.13 basic SQL syntax (II) join operation
19.Frambuffer应用编程
HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
[Excel] 数据透视图
left_and_right_net可解释性设计
Solar insect killing system based on single chip microcomputer
flink1.13 sql基础语法(二)join操作
空洞卷积、可变形卷积、可变形ROI Pooling