Incremental compilation breaks when compiling libncursesw

I have a project that links against libncursesw. It builds fine when I run basic zig build, but when I run zig build -fincremental I get the following error

➜  chat-client git:(prompt-improvements) zig build -fincremental
install
└─ install chat-client
   └─ compile exe chat-client Debug native 1 errors
error: bad ident
    note: while parsing /lib64/libncursesw.so
error: 1 compilation errors
failed command: /usr/bin/zig build-exe -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw -ODebug -Mroot=/home/ebianchi/code/chat-client/src/main.zig -lc --cache-dir .zig-cache --global-cache-dir /home/ebianchi/.cache/zig --name chat-client --zig-lib-dir /usr/lib/zig/ -fincremental --listen=-

Build Summary: 0/3 steps succeeded (1 failed)
install transitive failure
└─ install chat-client transitive failure
   └─ compile exe chat-client Debug native 1 errors

error: the following build command failed with exit code 1:
.zig-cache/o/64ac8a44c396009b0fe6095b5a37b7db/build /usr/bin/zig /usr/lib/zig /home/ebianchi/code/chat-client .zig-cache /home/ebianchi/.cache/zig --seed 0xbf9f08f4 -Z5f6e6769267f680f -fincremental
➜  chat-client git:(prompt-improvements)

Is this expected with incremental? Am I missing something? I’m on x64 linux.

What version of Zig are you using?

➜  ~ zig version
0.16.0
➜  ~

The -fincremental flag is currently only working together with the --watch flag when you’ve setup a build.zig. Also there are still rough edges around this, in particular for 0.16. Though, at least for me, master is working flawlessly.

If you upgrade to latest development version and can reproduce the issue, that would be a great bug report that I predict to be fixed swiftly.

This is indeed a good candidate for a bug report if it still reproduces on master, however FWIW this was a known issue in 0.16.0 which should indeed be fixed on master (I would be very surprised if it still reproduced!).

This is indeed fixed on latest master. Only extra thing I needed to fix was usage of @cImport, which was quite easy. Thanks for the help! Looking forward to 0.17

1 Like