当前位置:网站首页>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 )
边栏推荐
- BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
- 接地继电器DD-1/60
- Upper computer software development - log information is stored in the database based on log4net
- 简易零钱通
- Unity2D--人物移动并转身
- 云原生架构实战案例及优化解决方案
- Topological sorting and graphical display of critical path
- Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
- Simulink与Arduino串口通信
- 补某视频网站的js,进行视频解密
猜你喜欢
![[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)](/img/78/63ab1a8bb1b6e256cc740f3febe711.jpg)
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)

【QT】制作MyComboBox点击事件

ETCD数据库源码分析——初始化总览

2022 a special equipment related management (elevator) examination questions simulation examination platform operation

ansys命令

Arc135 C (the proof is not very clear)

C语言简易学生管理系统(含源码)

2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
![[QT] timer](/img/df/5db6af851ef19f33fd7e7a7ed46586.png)
[QT] timer

如何使用postman实现简单的接口关联【增删改查】
随机推荐
C # character similarity comparison general class
Void convolution, deformable convolution, deformable ROI pooling
冲击继电器JC-7/11/DC110V
Excel 比较日器
Design and implementation of tcp/ip series overview
tutle时钟改进版
Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技
LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
[QT] timer
云原生架构实战案例及优化解决方案
ANSYS command
RSA加密应用常见缺陷的原理与实践
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
VB. Net calls ffmpeg to simply process video (class Library-6)
724. 寻找数组的中心下标
How much computing power does transformer have
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)
left_ and_ right_ Net interpretable design
Principle and practice of common defects in RSA encryption application