zig icon indicating copy to clipboard operation
zig copied to clipboard

zig build exe.addObject () does not respect addIncludePath (".");

Open wenq1 opened this issue 1 year ago • 1 comments

Zig Version

0.10.0

Steps to Reproduce and Observed Behavior

        var     exe_zig4        = builder.addExecutable ("main_zig4", null);
        var     exe_zig5        = builder.addExecutable ("main_zig5", "main.zig");

        exe_zig4.addObject (builder.addObject ("main.zig", "main.zig"));

        exe_zig4.addIncludePath ("123456");
        exe_zig5.addIncludePath ("123456");

        exe_zig4.install ();
        exe_zig5.install ();

during zig build:

/opt/homebrew/Cellar/zig/0.10.1/bin/zig build-obj /home/zig-interop/main.zig --cache-dir /home/zig-interop/zig-cache --global-cache-dir /Users/wc/.cache/zig --name main.zig --enable-cache 

/opt/homebrew/Cellar/zig/0.10.1/bin/zig build-exe /home/zig-interop/main.zig --cache-dir /home/zig-interop/zig-cache --global-cache-dir /Users/wc/.cache/zig --name main_zig5 -I /home/zig-interop/123456 --enable-cache

When building exe_zig5, -I is in the build command. when building main.zig as part of exe_zig4, -I is missing, therefore @cImport ({@cInclude ("abc.h")} will fail with C import failed

Expected Behavior

-I flag should be emitted when building objects as well as building exes.

wenq1 avatar Mar 29 '23 10:03 wenq1

Is there any news related to this?

edisontim avatar Dec 11 '23 17:12 edisontim