-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.13 regression: simdutf targeting x86-64 no longer builds #20414
Comments
I realized my repro has some Nix paths hardcoded. Here is a Command: const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "simdutf",
.target = target,
.optimize = optimize,
});
lib.linkLibCpp();
lib.addIncludePath(.{ .path = "vendor" });
var flags = std.ArrayList([]const u8).init(b.allocator);
defer flags.deinit();
try flags.appendSlice(&.{});
lib.addCSourceFiles(.{
.flags = flags.items,
.files = &.{
"vendor/simdutf.cpp",
},
});
lib.installHeadersDirectory(
.{ .path = "vendor" },
"",
.{ .include_extensions = &.{".h"} },
);
b.installArtifact(lib);
} |
Testing on a couple of X86 systems: Xeon W-2133 (has AVX512) |
This also affects Highway builds: https://github.com/google/highway which do similar conditional target compilation logic, but getting a clean repro of that for you is much more difficult so I think the simdutf approach is better. I'm just noting this since its not specific to one project. |
Some digging around and experimenting with the |
The issue is that Zig is including the |
Seem to be seeing a related/potentially identical issue when packaging libdeflate via the Zig package system here: I can confirm that it seems to be fixed with libdeflate by adding "evex512" to the target attributes list, but that this fix seems to break compilation on other platforms, with other C compilers (including clang itself!). While using a patched source, zig happily builds on all three of |
I needed this for stringzilla to build. Builds without complaint on gcc / clang. const stringzilla = b.addStaticLibrary(.{
.name = "stringzilla",
.root_source_file = b.path("src/stringzilla.zig"),
.target = b.resolveTargetQuery(.{
.cpu_model = .{
.explicit = &.{
.name = "ivybridge+evex512",
.llvm_name = "ivybridge+evex512",
.features = std.Target.Cpu.Feature.Set.empty,
},
},
}),
.optimize = .ReleaseFast,
.link_libc = true,
});
stringzilla.addIncludePath(stringzilla_dep.path("include"));
switch (target.result.cpu.arch) {
.x86, .x86_64 => stringzilla.addCSourceFile(.{ .file = stringzilla_dep.path("c/lib.c"), .flags = &.{
"-DSZ_USE_X86_AVX2=1",
"-DSZ_USE_X86_AVX512=1",
"-DSZ_USE_X86_NEON=0",
"-DSZ_USE_X86_SVE=0",
} }),
else => @panic("Only X86 supported for stringzilla"),
} |
Facing the same issue compiling https://github.com/theseyan/lmdbx-zig/build.zig |
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
With
zig 0.13
and the latest simdutf (5.7.8) at the time of writing amalgamation of simdutf8, targetingx86_64
(macOS or Linux works).If it makes a difference, I am cross compiling from an aarch64 machine, but I don't believe that makes a difference since another tester I'm pretty sure reproduced this while building from an x86_64 machine.
Result:
Expected Behavior
Builds.
Additional info:
llvm/llvm-project#71325
The text was updated successfully, but these errors were encountered: