Programming 板


LINE

GNU Autotools 的 build / host / target 术语,最初是专门为编译 GCC 打造的。 GCC命名前缀是target For native builds, some of the installed programs are also installed with the target alias in front of their name https://gcc.gnu.org/install/configure.html 原始定义正确的逻辑 Original definition of correct logic 1. July 8, 1999 describes events that occurred in 1995. http://www.kilmnj.com/g77/what.html Around late 1995, I did a criss-cross build of g77, which entailed building a version of g77 on a Linux/Intel platform that ran on a DOS/Intel platform and generated code for an ecoff/i960 machine. It was about a weeks' work, but some of the problems I ran into have been fixed since then in g77, gcc, and the cross-platform development tools provided (generously) by Cygnus Support. (Cygnus and others use the term Canadian Cross to mean what I call criss-cross, that is, three-system, builds, where a compiler for machine C is built to run on B from machine A.) 2. The document was created on March, 17 2001 https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_3.html "3. Installing GNU CC" The build machine is the system which you are using, the host machine is the system where you want to run the resulting compiler, and the target machine is the system for which you want the compiler to generate code. 3. The GNU configure and build system 1998 https://www.mediafire.com/view/tk1v3pw53z17lpe/build_host_target_1998.jpg/file page. 28 6.2 Canadian Cross Concepts The system on which the tools are being built is called the build system. The system on which the tools will run is called the host system. An example of building a cross compiler using a Canadian Cross would be building a Windows cross MIPS ELF compiler on a GNU/Linux system. In this case the build system would be GNU/Linux, the host system would be Windows, and the target system would be MIPS ELF. 4. The Definitive Guide to GCC Second Edition 2006 https://www.mediafire.com/view/6kl9xbzfz0a7erq/build_host_target_2006.jpg/file Page. 233 CHAPTER 11 COMPILING GCC The build system is the machine on which you build GCC; the host system is the machine on which the completed compiler will run; and the target system is the machine for which the compiler will generate code. To build GCC for a Microsoft Windows based Intel x86 system, you could use a cross-compiler executing on a SPARC system running Solaris that know how to create a binary that run on a W-intel system The logic completely corresponds to the second statement: To execute sparc-solaris-gcc in Sparc and generate gcc name x86-windows-gcc, build is sparc. x86-windows-gcc run in intel x86 and generate tvprogram, host is intel x86. tvprogram run in intel x86 target is intel x86. 5. https://stackoverflow.com/questions/47010422/cross-compilation-terminologies-build-host-and-target I have a PowerPC machine making a compiler that you will run on an x86 machine that will This creates binaries that run on an ARM architecture. That makes the PPC the build, the x86 the host, and the target the ARM. The logic completely corresponds to the second statement: To execute powerpc-linux-gcc in powerpc and generate gcc name arm64-linux-gcc, build is powerpc. arm64-linux-gcc run in intel x86 and generate tvprogram, host is intel x86. tvprogram run in arm64, target is arm64. 6. https://blog.csdn.net/liufuchun111/article/details/81509651 (google translate to english) ./configure --build=i386-linux --host=powerpc-linux --target=powerpc-linux This uses the i386-linux (--build) compiler to compile gcc. The compiled gcc runs on powerpc-linux (--host). This gcc is used to compile code that can run on powerpc-linux (--target). The logic completely corresponds to the third statement: To execute i386-linux-gcc in i386 and generate gcc name powerpc-linux-gcc, build is i386. powerpc-linux-gcc run in powerpc and generate tvprogram, host is powerpc tvprogram run in powerpc, target is powerpc. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ School A - Classical / Proper-Noun School: The "a mouse is a computer input device" logic. It strictly follows the GNU Autotools and GCC specifications.[1998][2006] Definition: In this specification, build / host / target are technical terms that specifically describe the production and operation relationship of the Toolchain. Facts: build = the place where the toolchain is built. host = the environment where the toolchain runs, and is used to build the tvprogram. Stance: Technical terms have a rigorous physical definition and historical context. You cannot arbitrarily guess or conflate them using the literal, everyday meaning of English. School B - Vernacular / Verb-Literal School: The "build is just the verb to build" logic. It forcibly interprets system terminology using everyday English verb grammar [Build = Make / Compile]. Definition: When they see the environment for building the tvprogram, their brain automatically translates it as: Building tvprogram implies The machine that builds tvprogram implies Build Machine Ignoring that in Autotools, host is defined as "the environment that executes the compile action and produces the binary", they mistakenly think the machine whose CPU is currently spinning running gcc is called build. A 派(古典专有名词派):Mouse 是指电脑输入设备逻辑: 严格遵循 GNU Autotools (1998) 与 GCC (2006) 规范。定义: 在这套规范里,build / host / target 是专门描述 Toolchain(编译器/工具链)生产与运作关系 的专有名词。 事实: build = 打造工具链的地方。 host = 运行工具链、并用来打造 tvprogram 的环境。 立场: 专有名词有其严谨的物理定义与历史脉络,不能随意用日常英语的字面意思去瞎 猜或混用。 B 派(日常语意派):Build 就是动词「建造」逻辑: 拿日常英语的动词文法(Build = Make / Compile)来强行解读系统术语。 定义: 当他们看到中文「建立 tvprogram 的环境」时, 脑中自动翻译成: Building tvprogram implies The machine that builds tvprogram implies Build Machine, 忽略了 Autotools 中 host 才是「执行 compile 动作并产出 binary 之环境」的专有名 词定义, 误以为正在转 CPU 跑 gcc 的机器就叫 build。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2026 原定义已被污染 Wrong later, this was changed to: https://gcc.gnu.org/onlinedocs/gccint.pdf There are three system names that the build knows about: the machine you are building on (build), the machine that you are building for (host), and the machine that GCC will produce code for (target). When you configure GCC, you specify these with --build=, --host=, and --target= 最主要原因 起於 2018年 As explicitly documented in the (https://lists.openembedded.org/g/openembedded-core/topic/issues_with_meson_in_sdk_with/72348468): "meson assumes that CC, CXX, CFLAGS, and other vars point to native tools. However, in an OE SDK, they point to cross-tools. Thus meson fails under the SDK because it tries to use the cross-tools for native tasks (I get the error "nm does not work" because meson tried to use the cross-nm for symbol extraction)." meson 自己的定义 meson: https://mesonbuild.com/Cross-compilation.html On the broader architectural level, as explicitly stated in the Meson Cross-Compilation docs: build machine: The computer performing the compilation. host machine: The machine where the compiled binary runs. target machine: The machine where the compiled binary's output runs. Meson's redefinition of these core concepts fundamentally contaminates the cross-compilation pipeline by blurring the classic GNU triplets isolation model (where native code generators often get polluted by target sysroots). While migrating Mesa to CMake might be out of scope for a package repo, understanding this structural flaw explains why edge cases like the bindgen regression hit cross-compiling environments so much harder. GNU Old Definition = Past -> Present -> Future Past (build): The existing old compiler, like sparc-solaris-gcc, which existed in the past and was used to compile the new GCC. Present (host): The new compiler you just built, like x86-windows-gcc, which is currently running on the host. Future (target): The TV program that this new compiler will generate in the future, which will run on the target. Three points in time, one compilation chain. Meson = Present -> Future, no past Present (build_machine): Where you are currently building by pressing enter. Future (host_machine): Where your compiled code will run in the future. Ex: Mesa 使用meson後 很多在设定config环境时出错 cross-compile 分不清是使用x64 exe 还是arm64 exe 後来加了很多patch 如 加了 export flags 请小心使用 ※ 引述《feelthat (云端传送)》之铭言: : ubuntu x86_64 or linux : 若要编译一包 open source 通常会使用到 : ./configure --build=xxx-linux-gnu --host=xxx-linux-gnu --target=xxx-linux-gnu : 这里给出几个解释 让大家真正了解定义 : https://sensperiodit.files.wordpress.com/2011/04/hagen-the-definitive-guide-to-gcc-2e-apress-2006.pdf : CHAPTER 11 COMPILING GCC P.233 : The build system is the machine on which you build GCC; : the host system is the machine on which the completed compiler will run; : and the target system is the machine for which the compiler will generate code. : refer to: : GCC source : https://ftp.gnu.org/gnu/gcc : AR AS LD binutils source : https://ftp.gnu.org/gnu/binutils : // : https://stackoverflow.com/questions/47010422/cross-compilation-terminologies-build-host-and-target : I have a PowerPC machine making a compiler that you will run on an x86 : machine that will make binaries that run on an ARM. : That makes the PPC the build, : the x86 the host, : and the target is the ARM : // : https://blog.csdn.net/liufuchun111/article/details/81509651 : ./configure --build=i386-linux --host=powerpc-linux --target=powerpc-linux : 利用i386-linux(--build)的编译器对gcc进行编译 : 编译出来的gcc运行在powerpc-linux(--host) : 这个gcc用来编译能够在powerpc-linux(--target)运行的代码。 : // : https://linux.die.net/man/1/config.guess : config.guess : This script will guess the type of the 'build' machine. : // : https://github.com/gcc-mirror/gcc/blob/master/config.guess : Note: NetBSD doesn't particularly care about the vendor : portion of the name. We always set it to "unknown". : // : EX: ./configure --build=x86_64-unknown-linux-gnu --host=x86_64-linux-gnu : --target=x86_64-linux-gnu : build: : 编译 GCC source 与 编译 AR AS LD source : 是在 x86_64 未知制造商的 linux 系统 : host: : GCC & AR AS LD 在 86_64-linux 执行 hello_world.c 的编译 : target: : hello_world 在 CPU 为 arm64 的系统下执行 --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 39.12.154.13 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Programming/M.1789219717.A.77A.html ※ 编辑: feelthat (39.12.154.13 台湾), 09/13/2026 20:39:55







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP