如何为ARM交叉编译autotools项目? [英] How to cross-compile a autotools project for ARM?

查看:42
本文介绍了如何为ARM交叉编译autotools项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望交叉编译一个使用 GNU autotools 构建系统的现有库.我的主机上安装了 Linaro arm-gcc 工具链,我可以直接使用 arm-gcc 编译小程序.

I am looking to cross-compile an existing library which uses GNU autotools build system. I have a Linaro arm-gcc toolchain installed in my host machine and I am able to compile small programs directly using arm-gcc.

  • 主机: Ubuntu 12.04 Intel x64
  • 目标机器: Ubuntu 14.04 ARM 32 位(类似于 Raspberry-Pi 的板)
  • Host machine: Ubuntu 12.04 Intel x64
  • Target machine: Ubuntu 14.04 ARM 32-bit (a board similar to Raspberry-Pi)

我有一个库源代码,其中包含 configure.ac 和 Makefile.am 文件.我想在主机上编译此代码并生成可以复制到目标平台的 ARM 二进制文件.

I have a library source code which has configure.ac and Makefile.am files for it. I want to compile this code on host machine and generate ARM binaries which can be copied over to the target platform.

执行此操作的规范方法是什么?

What is the canonical way to do this?

具体来说,我正在寻找可以使用 arm-linux-gnueabi-gcc 和 autotools 交叉编译的 C 语言Hello World"应用程序/库的东西.

For specifics, I am looking for something that would work for a "Hello World" application/library in C cross-compiled using arm-linux-gnueabi-gcc and autotools.

推荐答案

--build=`./config.guess` --host=arm-linux-gnueabi

可能就足够了,因为它会寻找相应的 ARM 工具链.否则,尝试添加:CC="arm-linux-gnueabi-gcc"

might be sufficient, as it will look for a corresponding ARM toolchain. Otherwise, try adding: CC="arm-linux-gnueabi-gcc"

您还可以添加:CFLAGS="-pipe -Wall -O2 ... <other arm-gcc flags>"
更好的代码优化.

You can also add: CFLAGS="-pipe -Wall -O2 ... <other arm-gcc flags>"
for better code optimization.

这篇关于如何为ARM交叉编译autotools项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆