-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
zig build-exe not warning for missing -lc parameter #10410
Comments
Some notes about my system:
I installed zig from the binary download available here: https://ziglang.org/download/ . I tried both 0.9.0 and master (0.10.0-dev.62+5b171f446). |
The above shows that it is indeed the missing libc NEEDED that causes this. Adding |
How would Zig figure out that libc was supposed to be linked? Perhaps by inspecting the NEEDED of libsodium.so? In such case, zig could infer |
https://refspecs.linuxfoundation.org/elf/elf.pdf
and
https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
I have no clue how this would work with __LINKEDIT of Mach-O. plan9 does not have the problem. Would be nice to tag this as "linker" and/or std object-related proposals. |
Zig Version
0.9.0
Steps to Reproduce
zig build-exe src/main.zig -lsodium
Observe that we omit
-lc
and that we get no output and no warnings:echo $? # returns 0
Expected Behavior
I expected zig build-exe to return a warning with regards to missing
-lc
argument, like so (example output obtained fromfrett27
on IRC - note that this actually happens for him but not for me, annecdotally the same zig version0.9.0
):Note that building with linkage to libc produces a working executable.
Executing resulting
main
executable (result ofzig build-exe src/main.zig -lc -lsodium
):Actual Behavior
Executing resulting
main
executable (result ofzig build-exe src/main.zig -lsodium
):The text was updated successfully, but these errors were encountered: