Lib install step is failing inconsistently

I added doc gen step some time ago and CI started to fail the install step:

/Users/runner/hostedtoolcache/zig/0.13.0/arm64/zig build-lib -OReleaseSmall -Mroot=/Users/runner/work/ghext/ghext/src/ghext.zig -femit-docs --cache-dir /Users/runner/work/ghext/ghext/.zig-cache --global-cache-dir /Users/runner/.cache/zig --name Ghext -static --listen=- 
install
+- install Ghext
   +- zig build-lib Ghext ReleaseSmall native 1 errors
error: unable to open directory '/Users/runner/.cache/zig/b/2d05b7bc152e8d13afc06cd74557488a/': FileNotFound
error: the following command failed with 1 compilation errors:
/Users/runner/hostedtoolcache/zig/0.13.0/arm64/zig build-lib -OReleaseSmall -Mroot=/Users/runner/work/ghext/ghext/src/ghext.zig -femit-docs --cache-dir /Users/runner/work/ghext/ghext/.zig-cache --global-cache-dir /Users/runner/.cache/zig --name Ghext -static --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
+- install Ghext transitive failure
   +- zig build-lib Ghext ReleaseSmall native 1 errors
error: the following build command failed with exit code 1:
/Users/runner/work/ghext/ghext/.zig-cache/o/d872461e49eb1e474a487fbd556822e3/build /Users/runner/hostedtoolcache/zig/0.13.0/arm64/zig /Users/runner/work/ghext/ghext /Users/runner/work/ghext/ghext/.zig-cache /Users/runner/.cache/zig --seed 0xf9dea468 -Z595328890561959e --release=small --verbose --summary all
Error: Process completed with exit code 1.

green lights on 2nd run fix(build): correct library name · charlesrocket/ghext@6d9e472 · GitHub

Purged the cache but no results.

I am not sure what is the build problem.


By looking at your build.zig, I found that documentation generation is done for lib because lib.getEmittedDocs(); adds the flag -femit-docs on your lib build step.

To avoid that you can add:

    const lib_docs = b.addStaticLibrary(.{
        .name = "docs",
        .root_source_file = root_source_file,
        .target = target,
        .optimize = optimize,
    });

and change lib.getEmittedDocs to:

    const docs = lib_docs.getEmittedDocs();
1 Like

Thank you, I’ll try it out