1. 安装标准的C开发环境,由于Ubuntu安装默认是不安装的,所以需要先安装一下:
sudo apt-get install gcc g++ libgcc1 libg++ make gdb

2.从ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/下载最新版本的交叉编译器,我下载的是cross-3.2.tar.bz2,解压到Downloan目录,会生成home/Downloads/usr/local/arm/,然后sudo cp -r arm /usr/local/arm/

3.把交叉编译器的路径加入到PATH

sudo vi /etc/bash.bashrc
在后面加入如下代码:
if [ -d /usr/local/arm ] ; then
    PATH=/usr/local/arm/bin:"${PATH}"
fi

4.使新的环境变量生效

# source /etc/profile

5.检查是否将路径加入PATH的方法:

echo $PATH
如果显示的内容中有/usr/local/arm/bin,说明已经将交叉编译器的路径加入PATH
自此,交叉编译环境安装完成。

6. 测试示例:

代码hello.c

#include<stdio.h>
int main()
{
printf("Ubuntu, i am linux-arm-toolchain\n");
}

 终端进入到hello.c所在的目录,执行:

arm-linux-gcc hello.c -o hello

编译成功。

碰到的问题:

从网上拷贝了一份比较简单的代码,编译时遇见以下问题:

test_getopt.c:9:35: error: stray ‘\342’ in program
test_getopt.c:9:35: error: stray ‘\200’ in program
test_getopt.c:9:35: error: stray ‘\235’ in program
test_getopt.c:12:3: error: stray ‘\342’ in program
test_getopt.c:12:3: error: stray ‘\200’ in program
test_getopt.c:12:3: error: stray ‘\230’ in program
test_getopt.c:12:3: error: stray ‘\342’ in program
test_getopt.c:12:3: error: stray ‘\200’ in program
test_getopt.c:12:3: error: stray ‘\231’ in program
test_getopt.c:13:4: error: stray ‘\342’ in program
test_getopt.c:13:4: error: stray ‘\200’ in program

说一下,出现此问题的原因是,源代码中存在汉语时的字符,如“”、,等,将其改过来即可!

arm汇编--ubuntu12.04 安装arm-linux交叉编译环境的更多相关文章

  1. Ubuntu 16.04 安装 arm-linux-gcc 嵌入式交叉编译环境 问题汇总

    闲扯: 实习了将近半年一直在做硬件以及底层的驱动,最近要找工作了发现了对linux普遍要求很高,而且工作岗位也非常多,所以最近一些时间在时不时地接触linux. 正文:(我一时兴起开始写博客,准备不充 ...

  2. Ubuntu12.04 安装Samba

    Ubuntu12.04 安装Samba Ubuntu12.04 安装Samba 本教程介绍了在Ubuntu12.04安装Samba文件服务器,以及如何配置它通过SMB协议共享文件,以及如何将用户添加. ...

  3. [分享]Ubuntu12.04安装基础教程(图文)

    [分享]Ubuntu12.04安装基础教程(图文) 原文地址: http://teliute.org/linux/Ubsetup/lesson21/lesson21.html 1.进入 live cd ...

  4. Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or dir

    问题: Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared obje ...

  5. ubuntu12.04安装svn 1.7(转载)

    ubuntu12.04安装svn 1.7 分类: ubuntu2013-10-22 16:03 239人阅读 评论(0) 收藏 举报 svnubuntu   目录(?)[+]   1.问题     在 ...

  6. ubuntu12.04 安装 php5.4/php5.5

    1:修改源(我使用163的源)直接修改/etc/apt/sources.list deb http://mirrors.163.com/ubuntu/ precise main universe re ...

  7. Ubuntu12.04安装java6

    按照android官方文档 http://source.android.com 下载编译android源代码,jdk安装失败,尝试一下方法成功(2013-11-20) 下面我就把在Ubuntu12.0 ...

  8. ubuntu12.04 安装nginx+php+mysql (lnmp)的web服务器环境

    1.Ubuntu12.04 安装nginx+php+mysql (lnmp)的web服务器环境 http://blog.db89.org/ubuntu12-04-install-nginx-php-m ...

  9. ubuntu 14.04 安装torch及编译环境zbstudio

    ubuntu 14.04 安装torch及编译环境zbstudio torch zbstudio 本来是安装官网给的步骤安装torch的,可是碰到一系列的问题,后来参考网上的安装方法安装成功了 官网安 ...

随机推荐

  1. 360极速浏览器在XP系统下的一个bug

    今天在做页面开发的时候,发现360浏览器在XP系统下不支持focus事件,而主流的IE(包括IE6),firefox,chrome都没有这个问题.前段开发的悲剧啊,各种浏览器兼容性的问题.

  2. 【DP_背包专题】 背包九讲

    这段时间看了<背包九讲>,在HUST VJUDGE上找到了一个题单,挑选了其中16道题集中做了下,选题全部是HDU上的题,大多是简单题.目前做了点小总结,大概提了下每道题的思路重点部分,希 ...

  3. nodejs实现单文件上传。

    new了formidable的一个实例. formidable模块可以直接捕获当前数据流的状态并返回文件路径. 主要使用了file事件和end事件. var form = new formidable ...

  4. [DevExpress][TreeList]节点互斥

    关键代码: /// <summary> /// 节点互斥同步 /// 说明 /// eg: ///TreeListNode _node = e.Node; ///_node.SyncMut ...

  5. 青瓷qici - H5小游戏 抽奖机 0 创建工程

    安装运行平台需要nodejs,具体方法请参照官方说明文档. 运行后打开了一个空空的窗口. 首先我们进行工程设置,菜单>工程>设置 菜单里面设置我们游戏的名称,到时候会显示在游戏的title ...

  6. 数位DP入门之hdu 3652 B-number

    hdu 3652 B-number Problem Description A wqb-number, or B-number for short, is a non-negative integer ...

  7. 【资料目录收藏】.NET开发必看资料53个 经典源码77个

    简单描述:为大家整理了下载中心.net资料,都是比较热的,好评率比较高的,做了一个可收藏的下载目录,希望大家喜欢~ 基于.net构架的留言板项目大全源码 http://down.51cto.com/z ...

  8. MVC引用CSS文件の正确姿势

    你的css文件目录结构: 将路径写入BundleConfig规则中: using System.Web; using System.Web.Optimization; namespace XXXX { ...

  9. DM8168 环境搭建(1)

    参考<DM81xx_DVR_RDK_Install_Guide.pdf> location:/dvrrdk/DVRRDK_04.01.00.02/dvr_rdk/docs 1,准备工作: ...

  10. 系统调用与API的区别

    整理自系统调用与API的区别 1.为什么用户程序不能直接访问系统内核模式提供的服务? 答:在linux中,将程序的运行空间分为内核与用户空间(内核态和用户态),在逻辑上它们之间是相互隔离的,因此用户程 ...