Skip to content

Commit b450bbf

Browse files
committed
Windows 的构建成功了 —— 失败的是我的探针门槛问错了问题
⭐ 这一轮 Windows 那条腿把模拟器**构建出来了**并打印了 QEMU emulator version 9.2.4 而且量出了 Windows 打包真正要回答的东西:**13 个 MinGW 运行时 DLL**(用 ldd 实测, 不是抄列表)。另外四个宿主靠载荷内部的 rpath,PE 没有那个东西。 ⚠️ 失败的是引导探针那一步,而门槛问错了问题:它检查有没有 **32 位编译器**,然后放 链接过去。Windows 上前者通过 —— MinGW 的 `cc -m32` 照样产出对象 —— 然后链接倒下: ld.exe: unrecognised emulation mode: elf_i386 Supported emulations: i386pep i386pe arm64 与 macOS 的 runner 是因为另一个理由更早失败。一条检查覆盖全部:问**链接器** 认不认这个 emulation —— 那才是真正必须成功的一步。
1 parent 59ec964 commit b450bbf

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,22 @@ jobs:
420420
.bss : { *(.bss*) __bss_end = .; }
421421
}
422422
LD
423-
# The host's own toolchain assembles it; this step is about the
424-
# emulator, not about cross-compilation.
425-
if [ "$RUNNER_OS" = "macOS" ] || [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then
426-
echo "::notice::no host assembler emits x86 ELF here; the emulator's --version is the check on this leg"
423+
# ⚠️ THE GATE IS "CAN THIS HOST LINK AN x86 ELF", AND MY FIRST VERSION
424+
# ASKED THE WRONG QUESTION.
425+
#
426+
# It checked for a 32-bit COMPILER and let the link run. On Windows
427+
# that passes — MinGW's `cc -m32` happily produces an object — and
428+
# then the link fails, because the linker beside it emits PE and
429+
# nothing else:
430+
#
431+
# ld.exe: unrecognised emulation mode: elf_i386
432+
# Supported emulations: i386pep i386pe
433+
#
434+
# An arm64 or macOS runner fails earlier for a different reason. One
435+
# check covers all of them: ask the LINKER whether it knows the
436+
# emulation, which is the step that actually has to work.
437+
if ! ld -V 2>/dev/null | grep -q "elf_i386"; then
438+
echo "::notice::this host's linker emits no x86 ELF (supported: $(ld -V 2>/dev/null | tr '\n' ' ' | head -c 120)); the emulator's --version is the whole of the check on this leg"
427439
exit 0
428440
fi
429441
cc -m32 -c -o probe.o probe.S -nostdlib 2>/dev/null \

0 commit comments

Comments
 (0)