"./configure"有什么区别?选项"--build",“-host"和"--target"? [英] What's the difference of "./configure" option "--build", "--host" and "--target"?

查看:734
本文介绍了"./configure"有什么区别?选项"--build",“-host"和"--target"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

脚本./configure接受3个选项--build--host--target.我混淆了他们的角色.它们的区别和语义是什么?

The script ./configure accepts 3 options --build, --host and --target. I'm confusing their roles. What's the difference and semantics of them?

推荐答案

As noted in this blog post and alluded to in the GCC Configure Terms, --target only applies when you are compiling toolchains. When you are doing normal cross-compilation of a library or binary you use

--build=the architecture of the build machine
--host=the architecture that you want the file to run on

但是,当您构建工具链时,事情可能会变得更加复杂.我认为以下是正确的(尽管我不能说我曾经手动编译过交叉调试器):

However, when you are building toolchains, things can get more complicated. I think that the following is correct (though I can't say I've ever manually compiled a cross-debugger):

让我们说您拥有:

  • 您将要在其上进行所有编译的powerpc构建机器
  • 将要在其上运行代码的多个具有mips处理器的嵌入式设备
  • 将用于在现场调试这些设备的x86笔记本电脑

您将配置并构建调试服务器(例如gdbserver)以使用

You would configure and build your debugging server (eg gdbserver) to run on your embedded device with

./configure --build=powerpc --host=mips

以便您可以将腻子安装到嵌入式设备上并运行"gdbserver:1234 a.out"以开始调试并在端口1234上侦听.

so that you could putty on to your embedded device and run "gdbserver :1234 a.out" to start debugging and listen on port 1234.

然后您将使用

./configure --build=powerpc --host=i686 --target=mips 

您将其复制到x86笔记本电脑,以便在该字段中可以运行"gdbclient Embedded.device:1234"以调试a.out程序.

which you would copy to your x86 laptop so that in the field you could run "gdbclient embedded.device:1234" in order to debug your a.out program.

这也同样适用于编译器,您可能想要查看上面的GCC链接或有关加拿大十字架编译.

This all applies to compilers too for which you might want to look at the GCC link above or this section about the Canadian cross compile.

还要注意,实际上,您可能看不到指定的内部版本,主机或目标,因为根据

Also note that, in practice, you might not see build, host or target specified because, according to this Autoconf manual page, "target defaults to host, host to build, and build to the result of config.guess."

总而言之,在--build上构建代码,并在--target架构环境下在--host上运行它.

In a word, build the code on --build, run it on --host with --target architecture environment.

这篇关于"./configure"有什么区别?选项"--build",“-host"和"--target"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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