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/m.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燈, 水草

請輸入看板名稱,例如:BuyTogether站內搜尋

TOP