Skip to content

Being chatty when no lazy dependency is found#89

Closed
Interrupt wants to merge 2 commits intonatecraddock:mainfrom
Interrupt:chatty-lazy-dependency
Closed

Being chatty when no lazy dependency is found#89
Interrupt wants to merge 2 commits intonatecraddock:mainfrom
Interrupt:chatty-lazy-dependency

Conversation

@Interrupt
Copy link
Copy Markdown
Contributor

Silently breaking when no artifact is installed seems like a big footgun for people to step on. This makes needing to explicitly add a Lua dependency to a master project more explicit.

@Interrupt
Copy link
Copy Markdown
Contributor Author

Actually, maybe the message here would be to tell people to run zig build --fetch instead? I'm not sure what the best course of action would be.

@natecraddock
Copy link
Copy Markdown
Owner

Sorry for the delay

Could you explain a bit more when this situation arises? I haven't seen this issue before.

@Interrupt
Copy link
Copy Markdown
Contributor Author

Interrupt commented Jul 6, 2024

People had issues initially building a project using the Delve Framework, they ran into an error where ziglua's "lua" artifact was not found. (Interrupt/delve-framework#22)

This appears to be because lazy dependencies are not actually downloaded the first time they are encountered in the build chain if they are not top level dependencies. I never ran into this issue myself due to my zig-cache already having entries for the lua version needed, so the lazy dependencies were found just fine.

I was able to reproduce the issue in y example project by cleaning out both my project's zig cache and the global zig cache (which was under ~/.cache/zig)

Zig not downloading lazy dependencies on the fly when encountered as children in the build chain appears to be by design, they want people to run zig build --fetch in that case, which appears to go gather and download all dependencies in the chain, including lazy ones.

The problem, in my point of view, is that Zig does not make it clear that the build error would easily be cleared up by running that fetch process, this would at least make that clear in the build output.

@natecraddock
Copy link
Copy Markdown
Owner

This appears to be because lazy dependencies are not actually downloaded the first time they are encountered in the build chain if they are not top level dependencies. I never ran into this issue myself due to my zig-cache already having entries for the lua version needed, so the lazy dependencies were found just fine.

Oh weird. I didn't realize that was a side effect of lazy deps. I made lua lazy so that only the used version was downloaded.

I wonder if it would just be easier to not make the ziglua deps lazy...

@Interrupt
Copy link
Copy Markdown
Contributor Author

That would be the easy option, might be totally fine.

natecraddock added a commit that referenced this pull request Jul 12, 2024
I'm not sure the best solution, but #89 raised an issue when ziglua is a
dependency of another package and lazy dependencies are used. Not sure
on the proper solution there, but this should at least solve it for now.
With the downside of more network requests and disk usage required.
@natecraddock
Copy link
Copy Markdown
Owner

I don't have a ton of time to devote to ziglua at the moment (I hope to get back to it soon). I just pushed a commit that removes all of the lazy dependencies. Hopefully that resolves the issues!

We can revisit this later on as Zig build practices become more stable

@natecraddock
Copy link
Copy Markdown
Owner

natecraddock commented Jul 19, 2024

I just did a bit more digging. It looks like I just misunderstood lazy dependencies! I cleared out my zig caches and then built a project that depends on ziglua. Only the target lua version was fetched. Looks like nothing will need to change here :)

Wait nevermind, I was using Ziglua 0.3.0 which still has lazy deps.. Nevermind! 😅

@bfredl
Copy link
Copy Markdown
Contributor

bfredl commented Oct 13, 2024

ziglang/zig#20051 for reference, I think this (or a similar) change would need to be accepted upstream to be able to use lazy dependencies again.

@natecraddock
Copy link
Copy Markdown
Owner

@bfredl thanks! Subscribed to that PR. Hopefully something gets fixed soon so lazyDeps can be used again.

I'm also following ziglang/zig#21525 and ziglang/zig#20716 which seem related

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

Successfully merging this pull request may close these issues.

3 participants