From 6b36b756eb4b4c26b98d405310680ebe5679d111 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 15 May 2019 21:47:15 -0400 Subject: 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. --- src/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 1d7d543a49..ecdee4e9e5 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8121,7 +8121,7 @@ static void detect_dynamic_linker(CodeGen *g) { for (size_t i = 0; possible_ld_names[i] != NULL; i += 1) { const char *lib_name = possible_ld_names[i]; if ((err = zig_libc_cc_print_file_name(lib_name, result, false, true))) { - if (err != ErrorCCompilerCannotFindFile) { + if (err != ErrorCCompilerCannotFindFile && err != ErrorNoCCompilerInstalled) { fprintf(stderr, "Unable to detect native dynamic linker: %s\n", err_str(err)); exit(1); } -- cgit v1.2.3