Ubuntu18.04.3中安装交叉编译环境

Ubuntu18.04.3中安装交叉编译环境

基于智龙嵌入式开发板做的一个项目,在按照孙冬梅老师教程搭建环境时候遇到的问题。借此为了方便自己回顾,也为了白piao那么多后有所输出。谢谢大佬跳过。

  • 环境:Ubuntu18.04.3
  • 交叉编译工具:gcc-4.3-ls232
  • 工具下载地址:下载地址

安装步骤:

  • 解压缩交叉编译工具到 /opt 下:
tar zxvf gcc-4.3-ls232.tar.gz -C /opt
  • 指定编译路径,添加环境变量,打开.bashrc文件
vi ~/.bashrc
  • 在其末尾添加
export PATH=/opt/gcc-4.3-ls232/bin:$PATH
  • 重新加载路径
source ~/.bashrc
  • 在此正常安装完毕,可以执行 mipsel-linux-gcc -v ,出现以下提示即安装成功
root@ubuntu:/# mipsel-linux-gcc -v
Using built-in specs.
Target: mipsel-linux
Configured with: ../gcc-4.3.0/configure --prefix=/opt/gcc-4.3-ls232 --host=i486-pc-linux-gnu --build=i486-pc-li
nux-gnu --target=mipsel-linux --host=i486-pc-linux-gnu --with-sysroot=/opt/gcc-4.3-ls232/sysroot --with-abi=3
2 --disable-nls --enable-shared --disable-multilib --enable-__cxa_atexit --enable-c99 --enable-long-long --enab
le-threads=posix --enable-languages=c,c++,fortran --enable-poison-system-directories
Thread model: posix
gcc version 4.3.0 (GCC)

其他问题

  • 执行 mipsel-linux-gcc -v ,提示 No such file or directory。先执行
which mipsel-linux-gcc

如果可以找到文件,说明环境变量没有问题。原因是计算机上安装的是 64 位的操作系统,但是交叉工具链是 32 位的,出现兼容问题,安装32 位共享库之后,能解决绝大部分兼容性问题。

apt-get install lsb-core
apt-get install lib32z1 lib32ncurses5 

你可能感兴趣的:(智龙嵌入式开发板)