Index
Thu Nov 27 17:33:29 CST 2025
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /usr/bin/x86_64-w64-mingw32-ld: error: export ordinal too large: 66174
collect2: error: ld returned 1 exit status
编译 rio terminal 的时候遇到了这个。
检查了一下发现 rio 的 gh workflow 用的是 msvc 的 target,所以不会遇到这个问题。
所以现在我需要配一下 msvc 的工具链了。
https://jake-shadle.github.io/xwin/
速速看教程。
To be honest, I rejected this one pretty much immediately simply because the gnu environment is not the "native" msvc environment for Windows. Targeting x86_64-pc-windows-gnu would not be representative for actual builds used by users, and it would be different from the local builds built by developers on Windows, which made it an unappealing option. That being said, generally speaking, Rust crates tend to support x86_64-pc-windows-gnu fairly well, which as we'll see later is a good thing due to my chosen strategy.
好吧,原来 gnu 工具链是个 anti pattern
也不是那么 anti
https://github.com/rust-cross/cargo-xwin
Cross compile Cargo project to Windows MSVC target with ease
专用工具,试试
我草,直接帮我把 sdk 下载下来了。轮椅啊
一下就编译好了。这个好。
Mon Dec 1 21:19:55 CST 2025
https://zhuanlan.zhihu.com/p/691206786
讲 rust 交叉编译的文章。比较水,但是还是可以看。
https://github.com/cross-rs/cross
Rust 的交叉编译工具,利用 docker 来实现零配置的交叉编译。
但是默认不提供 MSVC 和 Apple Darwin 的镜像,因为版权原因。
哦,那 cargo xwin 的 sdk 和工具链是哪来的……
一个看起来专门做 rust 交叉编译的组织,zigbuild 和 xwin 都是他们的。
https://actually.fyi/posts/zig-makes-rust-cross-compilation-just-work/
zigbuild 的起源。
cargo zigbuild 不知道和 cross 有啥区别。
https://github.com/cross-rs/cross/wiki/Configuration
cross 也能用 zig 当链接器。
问了一下 yinmo,群友说 zigbuild 不用 docker。还可能出现 cross 行但是 zigbuild 不行的情况,或者是反过来。所以最好把两个都备上。
好吧。那就两个都备上。