交叉编译的configure
2015-08-19 15:11
399 查看
Cross-Compilation
To cross-compile is to build on one platform a binary that will run on another platform. When speaking of cross-compilation, it is important to distinguish between the build platform on which thecompilation is performed, and the host platform on which the resulting executable is expected to run. The following
configureoptions are used to specify each of them:
--build=build
The system on which the package is built.
--host=host
The system where built programs and libraries will run.
When the --host is used,
configurewill search for the cross-compiling suite for this platform. Cross-compilation tools commonly have their target architecture as prefix of their name.
For instance my cross-compiler for MinGW32 has its binaries called
i586-mingw32msvc-gcc,
i586-mingw32msvc-ld,
i586-mingw32msvc-as, etc.
Here is how we could build
amhello-1.0for
i586-mingw32msvcon a GNU/Linux PC.
~/amhello-1.0 % ./configure --build i686-pc-linux-gnu --host i586-mingw32msvc checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for i586-mingw32msvc-strip... i586-mingw32msvc-strip checking for i586-mingw32msvc-gcc... i586-mingw32msvc-gcc checking for C compiler default output file name... a.exe checking whether the C compiler works... yes checking whether we are cross compiling... yes checking for suffix of executables... .exe checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether i586-mingw32msvc-gcc accepts -g... yes checking for i586-mingw32msvc-gcc option to accept ANSI C... … ~/amhello-1.0 % make … ~/amhello-1.0 % cd src; file hello.exe hello.exe: MS Windows PE 32-bit Intel 80386 console executable not relocatable
The --host and --build options are usually all we need for cross-compiling. The only exception is if the package being built is itself a cross-compiler: we need a third option to specify
its target architecture.
--target=target
When building compiler tools: the system for which the tools will create output.
For instance when installing GCC, the GNU Compiler Collection, we can use --target=target to specify that we want to build GCC as a cross-compiler for target. Mixing --build and --target,
we can actually cross-compile a cross-compiler; such a three-way cross-compilation is known as a Canadian cross.
See Specifying the System Type in The Autoconf Manual, for more information
about these
configureoptions.
相关文章推荐
- 统计学方法与数据分析学习笔记1
- hibernate某些版本(4.3)下报错 NoSuchMethodError: javax.persistence.Table.indexes()
- 电脑经验--IPTV设置
- Struts2的ResultType和Action处理链
- 走吧走吧,拿着更多的票子把活干吧!
- Lua 语言基础
- 海量数据查找中位数
- BPM那些事儿——BPM流程管理软件的五大创新
- 教你如何做个有“钱”途的测试工程师
- ios中webview与js交互代码
- UI学习之Label
- 5-3 多级派生类的构造函数
- windows server 2003下安装.net framework 3.5 一直安装不成功
- Android(java)学习笔记177:BroadcastReceiver之 应用程序安装和卸载 的广播接收者
- 电脑经验--bootmgr is missing解决办法
- Java Split用法
- webim(icomet) 使用
- FAQ 测试BUG集锦
- 4.4网络图片查看器HttpURLConnection
- 树结构练习——排序二叉树的中序遍历