Skip to content
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

installHeader not working with addModule and local .path dependency: C import failed, file not found #19840

Closed
actondev opened this issue May 2, 2024 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@actondev
Copy link

actondev commented May 2, 2024

Zig Version

0.12.0

Steps to Reproduce and Observed Behavior

This is weird to describe, so I'm attaching a minimal reproduction project with a build.zig file. Even though in the passed -I generated directory the foo.h is there, the compilation fails
foo.zip

Another related issue that came up when doing the reproduction scenario is #19839 . In my own project where this issue came up when trying to upgrade to 0.12, apart from the missing header issue (which could be bypassed by hardcoding the header path to an absolute path), the compiler was just crashing. I hope that these 2 issues take care of the 0.12 issues I encountered. I also tried 0.13.0-dev.46+3648d7df1 but got the same results

Expected Behavior

Expecting the given project to compile with zig build

@actondev actondev added the bug Observed behavior contradicts documented or intended behavior label May 2, 2024
@ianprime0509
Copy link
Contributor

This is a consequence of #18160: include paths (-I) are per-module now, so the clib library has to be linked to the binding module. If I change exe.linkLibrary(lib.artifact("foo")); to binding.linkLibrary(lib.artifact("foo"));, your example project builds for me (since binding is the module that's importing foo.h).

@actondev
Copy link
Author

actondev commented May 2, 2024

Oh, I see! Thank you so much!

@actondev actondev closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants