-
Notifications
You must be signed in to change notification settings - Fork 5
Name clash with LLVM intrinsics #5
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
Comments
Sorry, I realized it's not a real issue since we don't run tests directly on |
My bad, it's an issue and my previous comment is wrong. (I ran a test in my personal folder and How to reproduce: |
Although not expected, I think we can make it a patch. Expected outputzig build test --summary all
all clang modules (0.00ms)
1 of 1 test passed
Slowest 1 test:
0.00ms all clang modules
all LLVM modules (0.00ms)
1 of 1 test passed
Slowest 1 test:
0.00ms all LLVM modules
Build Summary: 5/5 steps succeeded
test success
└─ run llvm-tests success 480us MaxRSS:2M
└─ zig test llvm-tests Debug native success 1s MaxRSS:239M
└─ run clang-tests success 472us MaxRSS:2M
└─ zig test clang-tests Debug native success 1s MaxRSS:238M patch suggestiondiff --git a/build.zig b/build.zig
index f3ead38..3f608d7 100644
--- a/build.zig
+++ b/build.zig
@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void {
// LLVM MODULE
const llvm_module = b.addModule("llvm", .{
- .root_source_file = b.path("src/llvm.zig"),
+ .root_source_file = b.path("src/llvm-bindings.zig"),
.target = target,
.optimize = optimize,
});
@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
switch (target.result.os.tag) {
- .linux => clang_module.linkSystemLibrary("clang-19", .{}), // Ubuntu
+ .linux => clang_module.linkSystemLibrary("clang", .{}), // Ubuntu
.macos => {
clang_module.addLibraryPath(.{
.cwd_relative = "/opt/homebrew/opt/llvm/lib",
@@ -114,23 +114,29 @@ const BuildInfo = struct {
};
fn buildTests(b: *std.Build, target: std.Build.ResolvedTarget) void {
+ const custom_test_runner: std.Build.Step.Compile.TestRunner = .{
+ .path = b.dependency("test_runner", .{}).path("test_runner.zig"),
+ .mode = .simple,
+ };
+
const llvm_tests = b.addTest(.{
- .root_source_file = b.path("src/llvm.zig"),
+ .root_source_file = b.path("src/llvm-bindings.zig"),
.target = target,
.optimize = .Debug,
.name = "llvm-tests",
+ .test_runner = custom_test_runner,
});
const clang_tests = b.addTest(.{
.root_source_file = b.path("src/clang.zig"),
.target = target,
.optimize = .Debug,
.name = "clang-tests",
+ .test_runner = custom_test_runner,
});
llvm_tests.root_module.addImport("llvm", b.modules.get("llvm").?);
clang_tests.root_module.addImport("clang", b.modules.get("clang").?);
- // TODO: CI build LLVM tests with clang
- // llvm_tests.step.dependOn(&clang_tests.step);
+ llvm_tests.step.dependOn(&b.addRunArtifact(clang_tests).step);
const run_llvm_tests = b.addRunArtifact(llvm_tests);
const test_llvm_step = b.step("test", "Run LLVM-binding tests");
test_llvm_step.dependOn(&run_llvm_tests.step);
diff --git a/build.zig.zon b/build.zig.zon
index 6759d76..34cd624 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -1,6 +1,12 @@
.{
.name = .llvm_zig,
.version = "1.0.0",
+ .dependencies = .{
+ .test_runner = .{
+ .url = "git+https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b#1f317ebc9cd09bc50fd5591d09c34255e15d1d85",
+ .hash = "N-V-__8AANwlAADW-4Yu_sYSZkL_6wcz13gOf9pkOLCjct-F",
+ },
+ },
.minimum_zig_version = "0.14.0",
.fingerprint = 0xbf48c74bc4247821,
.paths = .{
diff --git a/src/llvm.zig b/src/llvm.zig
deleted file mode 100644
index aefc818..0000000
--- a/src/llvm.zig
+++ /dev/null
@@ -1,48 +0,0 @@
-pub const analysis = @import("analysis.zig");
-pub const blake3 = @import("blake3.zig");
-pub const bitreader = @import("bitreader.zig");
-pub const bitwriter = @import("bitwriter.zig");
-pub const core = @import("core.zig");
-pub const debug = @import("debuginfo.zig");
-pub const disasm = @import("disassembler.zig");
-pub const engine = @import("executionEngine.zig");
-pub const errors = @import("errors.zig");
-pub const error_handling = @import("error_handling.zig");
-pub const initialization = @import("initialization.zig");
-pub const irreader = @import("irreader.zig");
-pub const linker = @import("linker.zig");
-pub const lto = @import("lto.zig");
-pub const jit = @import("lljit.zig");
-pub const orc = @import("orc.zig");
-pub const orcee = @import("orcee.zig");
-pub const remarks = @import("remarks.zig");
-pub const support = @import("support.zig");
-pub const target = @import("target.zig");
-pub const target_machine = @import("target_machine.zig");
-pub const transform = @import("transform.zig");
-pub const types = @import("types.zig");
-
-test "all LLVM modules" {
- _ = analysis;
- _ = blake3;
- _ = bitreader;
- _ = bitwriter;
- _ = core;
- _ = debug;
- _ = disasm;
- _ = engine;
- _ = errors;
- _ = error_handling;
- _ = initialization;
- _ = irreader;
- _ = linker;
- _ = lto;
- _ = jit;
- _ = orc;
- _ = orcee;
- _ = remarks;
- _ = support;
- _ = target;
- _ = target_machine;
- _ = transform;
-} |
Done |
Uh oh!
There was an error while loading. Please reload this page.
Environment
Issue
When running tests in
src/llvm.zig
, it raises error:Possible reasons and mitigations
I found two similar issues in zig-lang upstream, it's not fixed yet.
ziglang/zig#11525
ziglang/zig#2291
It can be mitigated by change the name of
llvm.zig
to_llvm.zig
.The text was updated successfully, but these errors were encountered: