zoukankan      html  css  js  c++  java
  • 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

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

  • 相关阅读:
    Asp.net web api部署在某些服务器上老是404
    log4net记录日志到数据库自定义字段
    PIE-Basic 投影变换
    PIE-Basic 波段合成
    PIE-Basic 空间量测
    PIE-Basic 存储格式转换
    PIE-Basic 位深转换
    PIE-Basic 数据拉伸与显示
    PIE-Basic数据信息查看
    PIE-Basic 影像格式转换
  • 原文地址:https://www.cnblogs.com/biglucky/p/3904905.html
Copyright © 2011-2022 走看看