ARM-Linux Gcc 交叉编译环境搭建
1 NFS网络文件系统搭建
测试宿主机与目标板ping通
目标板上某个文件夹(例如mnt)挂载到宿主机(192.168.1.111)的/home/nfs_dir文件夹下
mount –t nfs –o nolock 192.168.1.111:/home/nfs_dir /mnt
2 交叉编译环境的搭建
参考http://linux-sunxi.org/Toolchain 通过apt-get
可以很简单地安装交叉编译环境
Ubuntu
Recent (from12.04 on)
A complete cross toolchain is available asa package, just run:
apt-get install gcc-arm-linux-gnueabihf
Debian
Details on Cross-development Toolchainsfor Debian are at the DebianWiki.
Note: Debian now hascross-toolchains in the archive, superseding those at emdebian.org
Currently (December 2015) available forunstable and testing in the standard repositories.
Install Cross Compiler and build utilities:
dpkg --add-architecture armhf
apt-get update
apt-get install g++-arm-linux-gnueabihf
安装之后在终端输入 arm 按下tab 并且自动补全之后,输入
arm-linux-gnueabihf-gcc -v
如果安装成功终端会打印出以下信息:
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v--with-pkgversion='Ubuntu/Linaro 4.7.1-5ubuntu1~ppa1'--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr--program-suffix=-4.7 --enable-shared --enable-linker-build-id--with-system-zlib --libexecdir=/usr/lib --without-included-gettext--enable-threads=posix--with-gxx-include-dir=/usr/arm-linux-gnueabihf/include/c++/4.7.1 --libdir=/usr/lib--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm--enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb--disable-werror --enable-checking=release --build=x86_64-linux-gnu--host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf---includedir=/usr/arm-linux-gnueabihf/include--with-headers=/usr/arm-linux-gnueabihf/include--with-libs=/usr/arm-linux-gnueabihf/lib
Thread model: posix
gcc version 4.7.1 (Ubuntu/Linaro4.7.1-5ubuntu1~ppa1)
3 环境变量
apt-get
方式进行安装已经配置好了环境变量,如果自己下载源码编译安装或者直接安装bin文件,则还需要设置环境变量(链接)
vi /etc/bash.bashrc
export PATH=$PATH:编译器安装路径
source /root/.bashrc
安装完交叉编译器,就可以生成目标板的可执行程序
遇到以下问题
1 运行程序时提示“-sh: ./pl: not found”
解决办法
目标板上没有运行程序所需要的库,查看所需要的库的方法
readelf -ahello | grep NEEDED
最后终端会打印出该程序执行的依赖库,将相应的库拷贝的lib文件夹下即可。
注意:该依赖库需要使用相同版本的交叉编译器
解决方法:
方法1、 把这些所需要的库拷贝到板子上,保证板子上找得到。
方法2、 编译的时候使用静态编译,arm-linux-gcc-o hello hello.c -static
ARM-Linux Gcc 交叉编译环境搭建的更多相关文章
- Zedboard学习(二):zedboard的Linux下交叉编译环境搭建 标签: 交叉编译linuxzedboard 2017-07-04 23:49 19人阅读
环境准备 首先肯定是要下载xilinx-2011.09-50-arm-xilinx-linux-gnueabi.bin文件,这是官方提供的linux下交叉编译链安装文件,下载地址为:https://p ...
- vs与linux的交叉编译环境搭建
很久之前就想写一个linux服务器,但是对linux的vim编译工具又不是很熟,只能在win环境下写好代码拷贝到linux环境下编译运行,现在VS出了一个插件可以对linux代码远程在linux环境下 ...
- Ubuntu系统下arm-linux-gcc交叉编译环境搭建过程
搭建所需环境Linux版本:Ubuntu 14.10 交叉编译器版本:arm-linux-gcc-4.4.3资源链接 何为交叉编译环境搭建交叉编译环境,即安装.配置交叉编译工具链.在Ubuntu环境下 ...
- YA157C交叉编译环境搭建
目录 1.开发板简介 3.主机搭建交叉编译环境 4.编译第一个ARM Linux程序--Hello World 5.在开发板上运行Hello World程序 6.ssh登录开发板 7.注意 8.she ...
- Exynos4412交叉编译环境搭建
Exynos4412交叉编译环境搭建 交叉编译:在PC机(x86平台)上开发程序,在ARM板上运行,提高开发.编译速度. 环境: Tiny4412SDK1506开发板 需要软件: arm-linux- ...
- s3c6410 Linux 驱动开发环境搭建
s3c6410 Linux 驱动开发环境搭建 -- 既然你是做Linux开发的,你还用虚拟机? 非常多人都在win下做开发,于是SD_writer.exe之类的烧写工具"大行其道" ...
- Ubuntu12.4 64位 安装 arm linux gcc 4.3.2
一.下载arm linux gcc 4.3.2 http://pan.baidu.com/share/link?shareid=1575352696&uk=2754759285&fid ...
- linux下LAMP环境搭建
++++++++++++++++++++++++++++++++++++++++++++++ linux下LAMP环境搭建 ++++++++++++++++++++++++++++++++++++++ ...
- Linux vagrant+virtualbox环境搭建步骤
Linux vagrant+virtualbox环境搭建步骤 Vagrant 是一款用来构建虚拟开发环境的工具,非常适合 php/python/ruby/java 这类语言开发 web 应用. 我们可 ...
随机推荐
- D - Romantic
The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Trees Trees ar ...
- [PHP][thinkphp5] 学习三:函数助手实例说明
来源:http://blog.csdn.net/lunsunhuan1825/article/details/71086487 load_trait:快速导入Traits,PHP5.5以上无需调用 / ...
- C++创建动态库
[C++]创建动态库 有很多方法,这个只是其中一种 比较简洁的方法. char* __stdcall correction(char* str) char *_result = new char[se ...
- mybatis源码学习:插件定义+执行流程责任链
目录 一.自定义插件流程 二.测试插件 三.源码分析 1.inteceptor在Configuration中的注册 2.基于责任链的设计模式 3.基于动态代理的plugin 4.拦截方法的interc ...
- pytorch 孪生神经网络DNN
代码内容请见: https://github.com/LiuXinyu12378/DNN-network
- 不停机还能替换代码?6年的 Java程序员表示不可思议
相信很多人都有这样一种感受,自己写的代码在开发.测试环境跑的稳得一笔,可一到线上就抽风,不是缺这个就是少那个反正就是一顿报错,而线上调试代码又很麻烦,让人头疼得很.不过, 阿里巴巴出了一款名叫Arth ...
- sqlilabs less18-22 HTTP头的注入
less18 user-agent的注入 源码分析: check_input对name,password进行了过滤 function check_input($value) { if(!empty($ ...
- iOS appium
1.如果没有安装过Homebrew,先安装homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ ...
- Windows环境,获取当前线程的ID,GetCurrentThreadId
GetCurrentThreadId 打印格式:0x%08lx 头文件:processthreadsapi.h (include Windows Server 2003, Windows Vista, ...
- [Hands-on-Machine-Learning-master] 02 Housing
用到的函数 numpy.random.permutation随机排列一个序列,返回一个排列的序列. >>> np.random.permutation(10) array([1, 7 ...