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
I think we need to rework what "static" means in the context of executables. I started off by using the same concept as exists in C compilers, but then drifted away as other ideas started to make more sense, and now I think there is a clear direction for where to take this.
Here is some background:
On Linux it's possible to create fully static executables because the stable syscall ABI is at the interrupt level.
On Windows all executables dynamically link against kernel32.dll which is the stable syscall ABI.
On MacOS all executables dynamically link against libSystem which is the stable syscall ABI.
On FreeBSD all executables dynamically link against libc which is the stable syscall ABI.
So for an executable, there's not really any concept of "static" except on Linux. But even there, there's an easy way to determine if an executable should be static: it should be static if and only if all of its libraries are static, and this is only ever true for Linux and Freestanding.
I think we should remove the --static flag for executables. It really only applies to libraries.
Mind if I hijack this issue and turn it into an accepted proposal?
andrewrk
changed the title
can't build static executables
make --static only apply to libraries. link exes with static flag when all libraries are static.
Dec 13, 2018
andrewrk
added
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
accepted
This proposal is planned.
labels
Dec 13, 2018
--static is no longer an option that Zig offers. Instead, everything is as static as possible, and if you want something dynamic instead, use -dynamic.
I'm using macos
I created a simple zig program from
zig init-exe
without any modification. Only updatedbuild.zig
toaddStaticExecutable
.Full
build.zig
I buiild zig from source
this is what I get when running zig build
Am I missing something?
The text was updated successfully, but these errors were encountered: