Closed link2xt closed 1 year ago
That change was reverted in https://github.com/ziglang/zig/pull/13460?
That change was reverted in ziglang/zig#13460?
No, it does not fully revert the change. I think this is why it says "not arch" in the title.
The output of zig targets
for me looks like this:
{
"arch": [
"arm",
"armeb",
"aarch64",
"aarch64_be",
"aarch64_32",
"arc",
"avr",
"bpfel",
"bpfeb",
"csky",
"dxil",
"hexagon",
"loongarch32",
"loongarch64",
"m68k",
"mips",
"mipsel",
"mips64",
"mips64el",
"msp430",
"powerpc",
"powerpcle",
"powerpc64",
"powerpc64le",
"r600",
"amdgcn",
"riscv32",
"riscv64",
"sparc",
"sparc64",
"sparcel",
"s390x",
"tce",
"tcele",
"thumb",
"thumbeb",
"x86",
"x86_64",
"xcore",
"nvptx",
"nvptx64",
"le32",
"le64",
"amdil",
"amdil64",
"hsail",
"hsail64",
"spir",
"spir64",
"spirv32",
"spirv64",
"kalimba",
"shave",
"lanai",
"wasm32",
"wasm64",
"renderscript32",
"renderscript64",
"ve",
"spu_2"
],
"os": [
...
There is no i386
architecture, the architecture (first word in the target triple) is named x86
now, but it was named i386
in zig 0.10.
In cpus
section there are many CPUs defined, including:
"i386": [
"slow_unaligned_mem_16",
"vzeroupper",
"x87"
],
"i486": [
"slow_unaligned_mem_16",
"vzeroupper",
"x87"
],
"i586": [
"cx8",
"slow_unaligned_mem_16",
"vzeroupper",
"x87"
],
"i686": [
"cmov",
"cx8",
"slow_unaligned_mem_16",
"vzeroupper",
"x87"
],
This is what goes into -mcpu
flag as far as I understand.
New Zig versions use
x86
instead ofi386
as an architecture name: https://github.com/ziglang/zig/pull/13101For Windows there is already a check for new Zig: https://github.com/rust-cross/cargo-zigbuild/blob/f2c70a102908aabfe7256fad3533a3701839acbe/src/zig.rs#L735-L738 It was introduced in https://github.com/rust-cross/cargo-zigbuild/pull/110
For Linux cargo-zigbuild still uses "i386" unconditionally: https://github.com/rust-cross/cargo-zigbuild/blob/f2c70a102908aabfe7256fad3533a3701839acbe/src/zig.rs#L713-L714
I am filing the issue so it is easier to find the reason for those who try to compile for i686 on Linux using nightly Zig builds. There is however no need to fix this now as I plan to switch from cargo-zigbuild to my own simple wrapper here: https://github.com/deltachat/deltachat-core-rust/pull/4243 Maybe it is easier to wait until Zig 0.11 release and switch to using
x86
unconditionally or at least wait for someone requesting this bug to be fixed in the comment to this issue.