fix static builds of zig from requiring c compiler

to be installed when linking libc.

When zig links against libc, it requires a dynamic linker path.
Usually this can be determined based on the architecture and operating
system components of the target. However on some systems this is not
correct; because of this zig checks its own dynamic linker.

When zig is statically linked, this information is not available, and so
it resorts to using cc -print-filename=foo to find the dynamic linker
path.

Before this commit, Zig incorrectly exited with an error if there was
no c compiler installed. Now, Zig falls back to the dynamic linker
determined based on the arch and os when no C compiler can be found.
This commit is contained in:
Andrew Kelley
2019-05-15 21:47:15 -04:00
parent b64e6cb813
commit 6b36b756eb
6 changed files with 20 additions and 5 deletions

View File

@@ -54,6 +54,7 @@ const char *err_str(Error err) {
case ErrorOperationAborted: return "operation aborted";
case ErrorBrokenPipe: return "broken pipe";
case ErrorNoSpaceLeft: return "no space left";
case ErrorNoCCompilerInstalled: return "no C compiler installed";
}
return "(invalid error)";
}