You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ncdu links against ncursesw which itself links to tinfo and because shared objects only embed the dependency name and not a full path it will attempt to find the library, which it won't succeed with[1].
pkg-config omits system paths automatically but can be instructed to keep them
this would still break anything not using pkg-config
add the library directories of all linked libraries
[1] Zig will add the libc installation path to the linker paths which is likely to be the normal lib dir masking this issue
[2] the previous command was ran with a stubbed cc binary otherwise it would be adding -L /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64
Expected Behavior
zig just work
The text was updated successfully, but these errors were encountered:
Jan200101
added
the
bug
Observed behavior contradicts documented or intended behavior
label
May 10, 2025
Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
Found while trying to package ncdu for Fedora
ncdu links against ncursesw which itself links to tinfo and because shared objects only embed the dependency name and not a full path it will attempt to find the library, which it won't succeed with[1].
the full chain of commands goes:
/usr/bin/zig build
/usr/bin/zig build-exe -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw -ltinfo -lzstd -fno-strip -ODebug -Mroot=/home/sentry/git/ncdu/src/main.zig -lc --cache-dir /home/sentry/git/ncdu/.zig-cache --global-cache-dir /home/sentry/.cache/zig --name ncdu --zig-lib-dir /usr/lib/zig/ --listen=-
ld.lld --error-limit=0 -mllvm -float-abi=hard --entry _start -z stack-size=16777216 --image-base=16777216 --eh-frame-hdr -znow -m elf_x86_64 -o ncdu /home/sentry/.cache/zig/o/e6af199bb17435a138866251ed3ea3fd/crt1.o -dynamic-linker /lib64/ld-linux-x86-64.so.2 ncdu.o --as-needed /lib64/libncursesw.so /lib64/libtinfo.so /lib64/libzstd.so /home/sentry/.cache/zig/o/31ee13b287dd6a347b524ffe90ce7ffc/libm.so.6 /home/sentry/.cache/zig/o/31ee13b287dd6a347b524ffe90ce7ffc/libc.so.6 /home/sentry/.cache/zig/o/31ee13b287dd6a347b524ffe90ce7ffc/libld.so.2 /home/sentry/.cache/zig/o/31ee13b287dd6a347b524ffe90ce7ffc/libresolv.so.2 /home/sentry/.cache/zig/o/e88f83e50bb73388bec0b5dfa5fa9721/libc_nonshared.a /home/sentry/.cache/zig/o/bb531447702b6bcd68ce0c01e22e5e5d/libcompiler_rt.a
[2]which then errors with
> error: ld.lld: unable to find library -ltinfo
/lib64/libtinfo.so
does nothing-L /usr/lib64
makes it work/lib64/libncursesw.so
outputs linker errors due to ncursesw missing, but the library error no longer appearsldd output of ncursesw
solutions:
[1] Zig will add the libc installation path to the linker paths which is likely to be the normal lib dir masking this issue
[2] the previous command was ran with a stubbed cc binary otherwise it would be adding
-L /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64
Expected Behavior
zig just work
The text was updated successfully, but these errors were encountered: