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

Transitive lazy dependencies are not fetched #20716

Open
ianprime0509 opened this issue Jul 21, 2024 · 0 comments
Open

Transitive lazy dependencies are not fetched #20716

ianprime0509 opened this issue Jul 21, 2024 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@ianprime0509
Copy link
Sponsor Contributor

Zig Version

0.14.0-dev.477+08cddaf11

Steps to Reproduce and Observed Behavior

  1. Clone https://github.com/ianprime0509/pathological-packages and check out the transitive-lazy-dependency branch (commit 0eba431bfea69a0b46e7c0e5fc845a5c2c91bf6f)
  2. Run zig build

Error:

thread 1019738 panic: unable to find module 'main'
/var/home/ian/src/zig/lib/std/Build.zig:1888:18: 0x116cf07 in module (build)
            panic("unable to find module '{s}'", .{name});
                 ^
/var/home/ian/src/pathological-packages/build.zig:17:72: 0x111c3ec in build (build)
    exe.root_module.addImport("lazy_dependency", lazy_dependency.module("main"));
                                                                       ^
/var/home/ian/src/zig/lib/std/Build.zig:2147:33: 0x1101833 in runBuild__anon_10316 (build)
        .Void => build_zig.build(b),
                                ^
/var/home/ian/src/zig/lib/compiler/build_runner.zig:314:29: 0x10fc9b4 in main (build)
        try builder.runBuild(root);
                            ^
/var/home/ian/src/zig/lib/std/start.zig:532:37: 0x10d88f5 in posixCallMainAndExit (build)
            const result = root.main() catch |err| {
                                    ^
/var/home/ian/src/zig/lib/std/start.zig:277:5: 0x10d8411 in _start (build)
    asm volatile (switch (native_arch) {
    ^
???:?:?: 0x8 in ??? (???)
Unwind information for `???:0x8` was not available, trace may be incomplete

error: the following build command crashed:
/var/home/ian/src/pathological-packages/.zig-cache/o/d9f0b52a358eb1bd754724aec1f0ec19/build /var/home/ian/src/zig/build/stage3/bin/zig /var/home/ian/src/zig/lib /var/home/ian/src/pathological-packages /var/home/ian/src/pathological-packages/.zig-cache /var/home/ian/.cache/zig --seed 0x6c218f91 -Z792625fefc8b025c

The error can be resolved by first checking out the lazy-dependency branch (commit e1d9f46cfc6d71475ac9fe77a85555a606712e0b) and running zig build there (which fetches the lazy dependency on the branch single-module into the cache).

Expected Behavior

The initial zig build on the transitive-lazy-dependency branch should fetch all necessary dependencies and succeed.

The motivating example behind this issue is I have a WIP library zig-libxml2 which fetches upstream sources for libxml2 and libxslt and builds them, but the upstream libxslt tarball is a lazy dependency, enabled only with a build option xslt. Hence, due to this issue, it currently isn't possible to depend on zig-libxml2 from another project and try to use libxslt.

@ianprime0509 ianprime0509 added the bug Observed behavior contradicts documented or intended behavior label Jul 21, 2024
@andrewrk andrewrk added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Jul 26, 2024
@andrewrk andrewrk added this to the 0.14.0 milestone Jul 26, 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 zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

2 participants