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

zig-run for files with external dependencies #96

Closed
corpix opened this issue Jan 19, 2024 · 1 comment
Closed

zig-run for files with external dependencies #96

corpix opened this issue Jan 19, 2024 · 1 comment

Comments

@corpix
Copy link

corpix commented Jan 19, 2024

Let's say I have src/main.zig with following:

const std = @import("std");
const zap = @import("zap");

...

I have zap defined in build.zig & build.zig.zon, zig build succeeds.
But when I try to zig-runfrom Emacs it fails with:

main.zig:2:21: error: no package named 'zap' available within package 'root'

I probably know why it happens (sorry I am relatively new to Zig), because zig run does not play well with build.zig. But doesn't this make zig run and zig-run Emacs function useless for larger (and practical) projects?

How do you run your code from within Emacs while making projects with Zig?

@joachimschmidt557
Copy link
Contributor

zig-run will not use a build.zig even if one is present. For larger projects, you're right, it's very unlikely to be used, but for small single-file "scratchpads" it can be useful.

(zig--run-cmd "run" (file-local-name (buffer-file-name)) "-O" zig-run-optimization-mode))

#99 is a proposal to add zig build run as a new function. I'll close this issue in favor of that one. If you think this topic deserves a separate issue, we can reopen this again.

@joachimschmidt557 joachimschmidt557 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants