ubuntu apt arm linux,ubuntu 安装arm

系统版本:Ubuntu 18.04.1 LTS

编译器资源:arm-linux-gcc 4.4.3.tar.gz(网上搜索有资源可下载)

用windows下载arm-linux-gcc 4.4.3.tar.gz压缩包并放到samba服务的共享文件夹,这里如果windows不能访问共享文件夹的话检查下smb.conf文件的配置,是否有writeable = yes,还有就是目录的权限也要记得修改(具体网上有很多博客介绍了)。

进入ubuntu,从Ubuntu进入共享文件夹,将压缩包移动至/usr/local文件夹下(登陆root进行一系列操作)

mv  [源文件] [目标文件/目标文件夹]

将压缩包解压至目前目录(/usr/local)下

tar   zxvf  arm-linux-gcc 4.4.3.tar.gz  -C  /

修改环境变量

vi   /etc/profile

在profile文件末尾添加下列内容,将arm-linux-gcc 4.4.3的bin目录下的文件的文件路径添加到PATH变量

export PATH=$PATH:/usr/local/opt/FriendlyARM/toolschain/4.4.3/bin/(这里要看bin文件夹的具体位置,我解压后的路径是这个)

让环境变量生效

source /etc/profile(用root权限操作)

检查环境变量是否配置成功

echo $PATH

检查编译器环境是否搭建成功

arm-linux-gcc -v

如果出现以下编译器的信息则成功

Using built-in specs.

Target: arm-none-linux-gnueabi

Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace

Thread model: posix

gcc version 4.4.3 (ctng-1.6.1)

如果显示:命令未找到

则输入下列命令

sudo apt-get install ia32-lib

sudo sudo apt-get install lib32ncurses5

sudo apt-get install lib32z1

验证功能

新建hello.c

vi hello.c

输入文件内容

#include

int main()

{

printf('hello world=====\n');

return 0;

}

保存后退出,输入命令

arm-linux-gcc hello.c -o hello

若提示 error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

则输入以下命令,安装相应的库:

sudo apt-get install glibc.i686

sudo apt-get install lib32stdc++6

这里简述下gcc 和 arm-linuxgcc两者的区别

GCC :The GNU Complier Collection,是一套由GNU开发的编译器集,支持C、C++、Ada、Objective C等许多语言。

GCC编译后的可执行文件可直接在linux系统上运行

而arm-linux-gcc是基于ARM目标机的交叉编译软件,其生成的可执行文件不能直接在linux系统上运行,但可下载到目标机中执行。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值