• arm汇编--ubuntu12.04 安装arm-linux交叉编译环境


    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
    ");
    }
    

     终端进入到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

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

  • 相关阅读:
    HTTP状态代码
    安装mySQL数据库常见问题
    python3.6安装版本选择
    用连接池提高Servlet访问数据库的效率
    策略模式
    如何在vue项目中修改less变量,多主题项目解决方案
    【前端】vue项目 url中传递数组参数
    element date-picker默认值问题
    echart 折线图legend不显示的问题
    vue学习之父子组件通信两种方法
  • 原文地址:https://www.cnblogs.com/biglucky/p/3904905.html
Copyright © 2020-2023  润新知